I am working on a project that is using i18next for localisation and translations.
Currently the translation directory is made up of a load of .json files for each language like so:
locales
- en.json
- de.json
- fr.json
- index.js
- i18n.js
Where each file is of the structure:
{
"translation": {
"navbar": {
"logo": "English Logo",
"localeSwitcher": "Language",
"currencySwitcher": "Currency"
},
"breadcrumbs": {
"home": "Homepage"
}
}
}
And each file is then imported in index.js:
import en from './en.json';
import de from './de.json';
import es from './es.json';
import pt from './pt.json';
import nl from './nl.json';
import fr from './fr.json';
import ru from './ru.json';
import zh from './zh.json';
const locales = {
en,
de,
pt,
es,
nl,
fr,
ru,
zh
};
export default locales;
I'd like to find a way to manage these translation files as each time I add a translation I have to manually add the same key in the right place in each file and I have no way of verifying that each translation file includes all the translations found in the master file, en.json.
I have done some searching and am unable to find any system for handling these files in a more intelligent manner than just manually updating each one. Does anyone have a suggestion of doing this in a more systematic and structured way?