I’ve had a look at the code for jquery-localize¹ and I can confirm that it doesn’t handle language codes with more than two letters (i.e. it assumes ISO 639-1 codes).
However navigator.language may return 3-letter codes².
In its current implementation, jquery-localize would trim "ast" to "as", thus loading translations for Assamese instead of Asturian.
What we really need to do here is fix jquery-localize instead of working around the issue.
The issue with Chinese is different³: jquery-localize tries to load a generic language file (zh.json) first, and if it fails to do so it won’t load the culture-specific one (zh-CN.json). Again this should be fixed in jquery-localize.
Finally, it appears jquery-localize doesn’t handle language variant codes at all (e.g. ca-ES-valencia), even though we might have specific translations for those (launchpad would export <email address hidden>).
I’ve had a look at the code for jquery-localize¹ and I can confirm that it doesn’t handle language codes with more than two letters (i.e. it assumes ISO 639-1 codes).
However navigator.language may return 3-letter codes².
In its current implementation, jquery-localize would trim "ast" to "as", thus loading translations for Assamese instead of Asturian.
What we really need to do here is fix jquery-localize instead of working around the issue.
The issue with Chinese is different³: jquery-localize tries to load a generic language file (zh.json) first, and if it fails to do so it won’t load the culture-specific one (zh-CN.json). Again this should be fixed in jquery-localize.
Finally, it appears jquery-localize doesn’t handle language variant codes at all (e.g. ca-ES-valencia), even though we might have specific translations for those (launchpad would export <email address hidden>).
¹ https:/ /github. com/coderifous/ jquery- localize/ blob/master/ dist/jquery. localize. js /developer. mozilla. org/en- US/docs/ Web/API/ NavigatorLangua ge/language /github. com/coderifous/ jquery- localize/ issues/ 47
² https:/
³ https:/