ikhudo / gatsby-i18n-plugin

MIT License
40 stars 13 forks source link

Error with fallback language #9

Open Ayo91 opened 5 years ago

Ayo91 commented 5 years ago

I have set this configuration for the plugin: plugins: [ { resolve: gatsby-plugin-i18next, options: {
fallbackLng: 'en', availableLngs: ['en','de','nl','fr','pl','ru','it'] }

If I change the language of my browser to spanish and reload the page (http://localhost:8000/), the fallback language is not triggered and I get an 404 error: Gatsby.js development 404 page There's not a page yet at /es/

It automatically set es language instead of check that is not available and show the fallback one.

kaelxeth commented 5 years ago

You don't have es in your availableLngs @Ayo91 , you have to define it

Ayo91 commented 5 years ago

You don't have es in your availableLngs @Ayo91 , you have to define it

I know that I don't have 'es' as a language in availableLngs. For this reason I expected the fallbackLng was triggered and showed me the "en" version.

Any idea?

thorsteinsson commented 5 years ago

Fallback language is for when a string is missing in your available languages and will only cover the languages you define as available.

Ayo91 commented 5 years ago

Fallback language is for when a string is missing in your available languages and will only cover the languages you define as available.

If a user with a specific browser language access to your application and you have not his language defined in your available languages, He will not see the webpage, He will see an error. Do you know how to solve this issue?

iradiel90 commented 5 years ago

I have the same issue. Someone can help?