i18next / i18next-http-backend

i18next-http-backend is a backend layer for i18next using in Node.js, in the browser and for Deno.
MIT License
447 stars 69 forks source link

fallback locale when fetching API endpoint failed or error #108

Closed phatify closed 1 year ago

phatify commented 1 year ago

🚀 Feature Proposal

Please add feature fallback locale when fetching API endpoint failed or error. For example I have a config like this:

...
loadPath: `${process.env.INTERNAL_API_URI}/api/locales/{{lng}}/{{ns}}`
...

When fetching data failed I want to set a fallback locale default from /public/en/common.

jamuhl commented 1 year ago

fallback is handled by i18next https://www.i18next.com/principles/fallback#language-fallback not the backend

phatify commented 1 year ago

fallback is handled by i18next https://www.i18next.com/principles/fallback#language-fallback not the backend

@jamuhl is there any solution on the backend?

jamuhl commented 1 year ago

did you read the link provided...there is no need to handle this in the backend as i18next core takes care of this for all backend implementations

phatify commented 1 year ago

Oh, forgive for my mistake! i18next-http-backend is just a plugin for i18next. Thanks a lot @jamuhl

phatify commented 1 year ago

@jamuhl Hi bro, can I usei18next-http-backend together with next-i18next. Does it compatible?

adrai commented 1 year ago

https://github.com/i18next/i18next-http-backend/tree/master/example/next