Closed stormfar closed 1 year ago
Running
"i18next": "^21.9.2", "angular-i18next": "^14.0.5", "i18next-browser-languagedetector": "^7.0.1", "i18next-http-backend": "^2.0.1",
Following the readme, I have this in app modules,
const i18nextOptions = { whitelist: ['en', 'de'], fallbackLng: 'en', debug: true, returnEmptyString: false, ns: ['translations'], interpolation: { format: I18NextModule.interpolationFormat(defaultInterpolationFormat) }, backend: { loadPath: 'locales/{{lng}}.{{ns}}.json' }, };
then in src/locales, I have an en.translations.json and de.translations.json with this:
en.translations.json
de.translations.json
{ "test": "Test String" }
In my component.html, I have {{ 'test' | i18next }}, but when running my app, I just the key instead of the value, with this message in the console.
{{ 'test' | i18next }}
i18next::translator: missingKey en translations test test
Am I missing something?
I should note it works when I add translations via the resources i18next option.
resources
Figured it out. Needed to add "src/locales" to the assets list in angular.json. I guess this was more related to i18next-http-backend.
"src/locales"
assets
i18next-http-backend
Running
Following the readme, I have this in app modules,
then in src/locales, I have an
en.translations.json
andde.translations.json
with this:In my component.html, I have
{{ 'test' | i18next }}
, but when running my app, I just the key instead of the value, with this message in the console.Am I missing something?
I should note it works when I add translations via the
resources
i18next option.