Closed jasperfirecai2 closed 3 years ago
You can use the fallback feature of i18next: https://www.i18next.com/principles/fallback#fallback-language
...and/or use a different load option: https://www.i18next.com/overview/configuration-options
...or simply change the served path on server side
except the fallback only applies after the failed fetch.. with config
{
backend: {
loadPath: './locales/{{lng}}/{{ns}}.json'
},
fallbackLng: 'en'
}
You may need to change the load option to "languageOnly": https://www.i18next.com/overview/configuration-options
could've sworn I tried that before.. that works now. thanks
https://github.com/i18next/i18next-http-backend/blob/82498bd0b4dbb687a5fada5f9ce91492e1759927/i18nextHttpBackend.js#L118
It's nice that a function or promise can be passed to manage the languages and the path generation on load, but in the end all it can return is a path that will be interpolated. I would like to be able to use a function, or a path interpolation, where i can for example remove -us at the end of en-us. Since i only have a
/en
folder but browser language is set to en-us, and thus it tries to fetch a file that i know won't exist