...
Include the new language locale (using the first 2 letters of it) in the locales array located in the
i18next-parser.config.js
which looks like this. In the case of a dialect, please concatenate the language and the locality, for example ‘pt-br’ ‘pt’ for Portuguese Brazil.Code Block locales: ['en', 'es', 'pt', 'fr']
Run
npm run i18n
which should create a new folder with 2 several fileslang/[your_locale]/[translation_namespace].json
andlang/[your_locale]/common.json
. some of the current namespaces are: common, geneder, message, role, translation, etc..Under this new folder, replace the
en
folder contents with the newly created folder contents. With this you will make sure you have all of the current namespaces, and will provide context on what you are translating.In your newly created file, change usages of the word
english
to your new language e.gportuguese
Modify the
lang/i18n.js
file, to include the new locale in the app.Import both files in the beginning on the file doing the index you modified doing (using pt as example)
Code Block import [your_locale]portuguese from './[your_locale]/translation.json'; import [your_locale]_common from './[your_locale]/common.json'pt;
Include the new locale in the resources object, like so:
Code Block fr:{ translation: fr, common: fr_common }, french, //INCLUDE THE CODE BELOW [your_locale]:{ translation: [your_locale], common: [your_locale]_common }pt:portuguese
After that you can proceed to translate the files that were created and making a PR on our repo as described in the next section
...