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

Guess of locale should be case insensitive #264

Open
eajimmy opened this issue Sep 8, 2016 · 2 comments
Open

Guess of locale should be case insensitive #264

eajimmy opened this issue Sep 8, 2016 · 2 comments

Comments

@eajimmy
Copy link

eajimmy commented Sep 8, 2016

Hi,
thank you for this helpfull module!
I have a problem with the guess of the current locale: if I define locales in the "xx-XX" format (e.g. "en-GB") the guessLanguage function fails in guess the current locale when guessing from queryParam. I think it is due to the toLowerCase() operation performed on the locale, that prevent to find by key the locale in the locales array.

An odd workaround can be to set the fallbackLanguage option as an object like {"en-gb": "en-GB"}.

Is it possible to make the guessLanguage operation case insensitive?

Many thanks,
eajimmy

(BCC: @Xflofoxx)

@mashpie
Copy link
Owner

mashpie commented Sep 8, 2016

will need to review #128 #255

@monkpow
Copy link

monkpow commented Oct 4, 2016

@eajimmy Try passing option

i18n.configure(
{ preserveLegacyCase:false }
)

I believe this will give you the behavior you are looking for.

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

No branches or pull requests

3 participants