You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We utilize the dynamic resource addition of i18next to dynamically add user defined translations in every module.
Currently, each module is creating their own i18next instance. We need to add the following lines
const{ languages }=require("./package.json").config;languages.forEach((lng)=>{try{constoverridenTranslations=require(`@overriden_translations/${lng}/LC_MESSAGES/translations.json`);i18next.addResourceBundle(lng,"translation",overridenTranslations);}catch(e){console.log("No overridden translations found for language",lng);}});
in each module that instantiates such an instance. The @overriden_translations is an alias that is defined in cookiecutter-invenio-rdm and points to the same location as the backend translations. If you want to override react translations you will need to create a translations.json file with all the keys for that specific language. The workflow would look like the following:
Proposed solution
We utilize the dynamic resource addition of i18next to dynamically add user defined translations in every module.
Currently, each module is creating their own i18next instance. We need to add the following lines
in each module that instantiates such an instance. The
@overriden_translations
is an alias that is defined in cookiecutter-invenio-rdm and points to the same location as the backend translations. If you want to override react translations you will need to create atranslations.json
file with all the keys for that specific language. The workflow would look like the following:Next steps
i18next.js
file and the code changespackage.json
.Open PRs
The text was updated successfully, but these errors were encountered: