i18n-node icon indicating copy to clipboard operation
i18n-node copied to clipboard

Guess of locale should be case insensitive

Open eajimmy opened this issue 9 years ago • 2 comments

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)

eajimmy avatar Sep 08 '16 08:09 eajimmy

will need to review #128 #255

mashpie avatar Sep 08 '16 08:09 mashpie

@eajimmy Try passing option

i18n.configure(
{ preserveLegacyCase:false }
)

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

monkpow avatar Oct 04 '16 21:10 monkpow