Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

defaultLanguage not working #148

Open
hananina opened this issue Oct 18, 2020 · 5 comments
Open

defaultLanguage not working #148

hananina opened this issue Oct 18, 2020 · 5 comments

Comments

@hananina
Copy link

    
{
      resolve: `gatsby-plugin-intl`,
      options: {
        // language JSON resource path
        path: `${__dirname}/src/intl`,
        // supported language
        languages: [`en`, `ja`],
        // language file path
        defaultLanguage: `en`,
        // option to redirect to `/ko` when connecting `/`
        redirect: true,
      },

At first, Thank you for this convenient package! it's really helpful🙏
I have some problems setting the default language for my project.

I have set defaultLanguage: as en but when I visit the root address of my website, it still showing the Japanese version of it instead of showing the English version. is there any way to fix this problem?

@ssliman
Copy link

ssliman commented Nov 9, 2020

Try removing redirect: true inside the options

@ar7casper
Copy link

@xZliman

What if I want to keep the redirect?
According to the example in the docs, it does redirect.
I'm having the same problem, no matter what I do, it redirects to English and I can seem to change it.
I tried your suggestion with removing the redirect, but the outcome is not something I want.

@cdsaenz
Copy link

cdsaenz commented Feb 26, 2021

I got the same problem with 'en' and 'es' languages and defaultLanguage : 'es'. If redirect is true, it will start in /en, always, instead of /es as expected. Setting it to false, will show me the 'es' page, but it's not consistent with the language switcher (that goes to /es). Any workaround for this to work as in the docs? Thanks!

@KevinVR
Copy link

KevinVR commented Jul 16, 2021

I can confirm this issue is still happening.

Set redirect: true so that it will auto redirect to the default language.
Set a defaultLanguage other than 'en'

It still auto redirects to /en when going to /, even though the defaultLanguage is set up differently.

@KevinVR
Copy link

KevinVR commented Jul 16, 2021

Actually, I have found it! It's taking the browser's language as default over the default language. This is even better!

Might be good to update the docs to be a bit more clear on this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants