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

Client side hot reload doesn’t work with language codes containing a hyphen #19

Closed
dnbastos opened this issue Oct 2, 2020 · 5 comments

Comments

@dnbastos
Copy link

dnbastos commented Oct 2, 2020

Languages such as pt-BR fail to hot reload and I need to refresh the page to see the changes.
I have to change pt-BR to be pt to work.

Investigation

The problem starts here:
https://github.com/felixmosh/i18next-hmr/blob/master/lib/client-hmr.js#L35

const currentLang = i18n.services.languageUtils.getLanguagePartFromCode(i18n.language);

the method getLanguagePartFromCode('pt-BR') returns pt

@felixmosh
Copy link
Owner

Hi @dnbastos, thank you for reporting this issue 🙏🏼

I'm not familiar with lang-country combination, are you folders structured with the same combination?

@felixmosh
Copy link
Owner

Pls try v1.6.1, it should work, you were right, there was no need for this language extraction

@dnbastos
Copy link
Author

dnbastos commented Oct 2, 2020

Yes, here is my folder structure:

locales
├── en-US
│   ├── ...
└── pt-BR
    ├── ...

I`m using IETF Language Codes

@felixmosh
Copy link
Owner

felixmosh commented Oct 2, 2020

Is v1.6.1 solved it for you? :]

@dnbastos
Copy link
Author

dnbastos commented Oct 2, 2020

Everything is working! Thanks!

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

2 participants