Expanded language support for regional variations
See original GitHub issueA recent pull request #354 adds support for Traditional Chinese (as spoken in HK and Taiwan). We already have Simplified Chinese translations. This exposes a shortcoming in our language handling: we currently only list the ISO 639-1 codes for languages, without distinguishing between regional variations.
So, e.g. we have the LanguageCode
enum which is widely used throughout the core, which only has “zh” for all variations of Chinese.
We could add support for common IETF language tags (which is have used in this PR), which would then allow us to support the zh-CN
and zh-TW
UI translations, as well as in places such as product translations etc.
The question then is “which full IETF tags to support?”
Add all possible IETF tags
Cases like Chinese are interesting because the actual writing system is distinct between Simplified and Traditional. Whereas an American can totally understand anything written in British English and vice-versa, does the same apply to Chinese speakers in Beijing and Taipei?
How about Madrid (es-ES) and Mexico City (es-MX)? I personally cannot answer these questions, since I am only very familiar with English (and to a lesser extent German).
Adding all variations seems like a bad idea, e.g. according to https://datahub.io/core/language-codes#resource-ietf-language-tags there are over 100 variations of English and over 40 variations of French. In practice, a single “English” version of anything would probably suffice (although I say this as an English speaker from England, so perhaps my perspective is too narrow). In any case, I’m pretty sure that listing 100 variations of English in UI menus is not a desirable solution.
Add tags on an ad-hoc basis
Another approach would be to default to the ISO 639-1 codes as we currently have, and only add regional variations as-and-when the need arises (e.g. a pull request like the one that triggered this issue comes in).
In this case, we’d then need to update the LanguageCode
enum as well as the language-translation-strings.ts
file to allow localization of these new variants.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
IMO you should change the enum from LanguageCode to LocaleCode . A locale is a combination of language + country and is usually of the xx-XX format. eg. en-US or en-GB.
This also serves as a mechanism to showcase different products in your store based on country. Happy to discuss more details on slack.
IMO, this is a good list of 125 languages to support. https://www.andiamo.co.uk/resources/iso-language-codes/
For Chinese, zh-CN and zh-TW are the 2 variants for simplified and traditional chinese.