All Translations are inside the [/locales ]()folder
Each language has a Folder with the Name of its Respective Code Based on this.
For example: English Translation would be in /locales/en and Marathi in /locales/mr
Each File Inside the Language Folder would have Multiple Files based on the Template we would give.
For generating template there would some Script that would automate this process.
By Default it would add files with English Translation and you have add translations for the words,phrases you know because we want a fallback if the translation doesn't exists.
For Example Home Page has English Translation in /locales/en/home.js
import en from '@locales/en/index';
import hi from '@locales/hi/index';
+ import mr from '@locales/mr/index';
const useLocale = (loc) => {
let t = loc;
switch (loc) {
case 'EN':
t = en;
break;
case 'HI':
t = hi;
break;
+ case 'MR':
+ t = mr;
+ break;
default:
t = en;
}
return t;
};
export default useLocale;
Adding a new Language
All Translations are inside the [
/locales
]()folderEach language has a Folder with the Name of its Respective Code Based on this.
For example: English Translation would be in
/locales/en
and Marathi in/locales/mr
Each File Inside the Language Folder would have Multiple Files based on the Template we would give.
For generating template there would some Script that would automate this process.
By Default it would add files with English Translation and you have add translations for the words,phrases you know because we want a fallback if the translation doesn't exists.
For Example Home Page has English Translation in
/locales/en/home.js
Here the
key
is the value of word we want to be translated and thevalue
is the translated word of thekey
in the respective language.To add
marathi
translations to the Home PageGotta create a file in
/locales/mr/home.js
and add the following :Things to Consider after adding the Translations:
As an example, if your adding
Marathi
LanguageAdding the new language's name and code in this
/locales/index.js
Then Updating the
useLocale.js
hook in/hooks/use-locale.js