i18next / i18next-xhr-backend

[deprecated] can be replaced with i18next-http-backend
https://github.com/i18next/i18next-http-backend
MIT License
253 stars 75 forks source link

ERR_FILE_NOT_FOUND #293

Closed desmeit closed 5 years ago

desmeit commented 5 years ago
                                i18next.init({
                    debug: true,
                    lng: 'de-DE',
                    load: "currentOnly", //OR load: 'unspecific'
                    fallbackLng: 'de',
                    backend: {
                      loadPath: 'locales/{{lng}}/{{ns}}.json',
                                       }

I get access to my file locales/de/translation.json but I'm wondering why I get the following error in addition:

GET ... /locales/de-DE/translation.json net::ERR_FILE_NOT_FOUND

I have a fallback to "de", why does it still want to access the file 'de-DE'?

jamuhl commented 5 years ago

load: 'languageOnly' is what you want

https://www.i18next.com/overview/configuration-options#languages-namespaces-resources

lng is de-DE and setting load currentOnly will trigger load of de-DE plus fallback.

jamuhl commented 5 years ago

https://www.i18next.com/overview/configuration-options#languages-namespaces-resources

jamuhl commented 5 years ago

If you like this module don’t forget to star this repo. Make a tweet, share the word or have a look at our https://locize.com to support the devs of this project -> there are many ways to help this project :pray:

desmeit commented 5 years ago

Sorry, still one question. languageOnly is working but if there is no "de" File, I get the ERR_FILE_NOT_FOUND message. Is that normal or what I'm doing wrong?

jamuhl commented 5 years ago

if the file does not exist that warning is normal...and can be ignored.

jamuhl commented 5 years ago

if you want completely get rid off that use the whitelist option: https://www.i18next.com/overview/configuration-options#languages-namespaces-resources

desmeit commented 5 years ago

very good support. thanks