This PR adds support for traditional Chinese, making progress on getodk/central#680. It doesn't add the actual translations, which will come in a later PR.
This PR also closes getodk/central#684.
What has been done to verify that this works as intended?
New tests and trying it out some locally.
Why is this the best possible solution? Were any other approaches considered?
One thing that I'm unsure about is what should happen if the user's preferred locale (from navigator.languages) is simplified Chinese, which we don't currently support. Should Central show traditional Chinese in that case or just fall back to English? I set it up to show traditional Chinese, but that'd be easy to change if it doesn't make sense.
Some things will have to change if/when we add support for simplified Chinese, specifically in determining the user's preferred locale in userLocale(). I thought about adding that logic now, but since it's not necessary yet, I decided not to. It'd be easy enough to make those changes later.
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
One thing of note is that the new locale, zh-Hant, has multiple subtags: language (zh) and script (Hant). Previously, all locale tags were made up of a single subtag (language). Code had to be modified to account for the fact that the locale tag might not be a single subtag.
Before submitting this PR, please make sure you have:
[x] run npm run test and npm run lint and confirmed all checks still pass OR confirm CircleCI build passes
[x] verified that any code or assets from external sources are properly credited in comments or that everything is internally sourced
This PR adds support for traditional Chinese, making progress on getodk/central#680. It doesn't add the actual translations, which will come in a later PR.
This PR also closes getodk/central#684.
What has been done to verify that this works as intended?
New tests and trying it out some locally.
Why is this the best possible solution? Were any other approaches considered?
One thing that I'm unsure about is what should happen if the user's preferred locale (from
navigator.languages
) is simplified Chinese, which we don't currently support. Should Central show traditional Chinese in that case or just fall back to English? I set it up to show traditional Chinese, but that'd be easy to change if it doesn't make sense.Some things will have to change if/when we add support for simplified Chinese, specifically in determining the user's preferred locale in
userLocale()
. I thought about adding that logic now, but since it's not necessary yet, I decided not to. It'd be easy enough to make those changes later.How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
One thing of note is that the new locale,
zh-Hant
, has multiple subtags: language (zh
) and script (Hant
). Previously, all locale tags were made up of a single subtag (language). Code had to be modified to account for the fact that the locale tag might not be a single subtag.Before submitting this PR, please make sure you have:
npm run test
andnpm run lint
and confirmed all checks still pass OR confirm CircleCI build passes