Open 1ec5 opened 5 years ago
A question to discuss:
Is it necessary for input the Chinese macrolanguage: zh-Hans
, return a JSON like:
{
locale: 'zh',
language: 'cmn',
script: Hans,
region: 'CN'
}
We should make the language code standard more clearly.
zh
and cmn
aren’t necessarily the same thing. So I think we do need to add fallback logic for bestMatchingLocale()
, but parseLocaleIntoCodes()
should continue to return the same values it did before.
This package should include logic that falls back from any Chinese language code, such as Mandarin (
cmn
) or Cantonese (yue
), to the Chinese macrolanguage code (zh
). In addition, a fallback from the Chinese macrolanguage to any available Chinese language code (cmn
,yue
,wuu
, etc.) would also be desirable before the last-resort fallback tonull
. This would work pretty similarly to the Norwegian fallbacks (#6)./cc @danpaz @ghoshkaj @chriswu42 @m-stephen @lloydsheng