jquery.i18n
jquery.i18n copied to clipboard
Fallbacks fail with uppercase locale tags
The fallbacks are all defined in lowercase, but a lot of browsers report the locale with uppercase region. For example, the browser is reporting zh-TW, which should fall back to zh-hant. However, because it doesn't match zh-tw in the fallbacks file, it uses en instead.
The standard as far as I know is that the tags should be case insensitive (https://tools.ietf.org/html/bcp47), so it should correctly fall back regardless of the input case.
For now, I'm just forcing the locale to lowercase, which resolves this issue, but it should probably be fixed in the library itself.
Agreed; zh-TW on my cordova app in chrome displays zh, which is better than falling back to en, but still shows that the upper-case problem is happening, since it should fall back to zh-hant. So I guess it recognizes the zh part but fails to parse the TW part since it's in uppercase.
(CC self)