Use full regional locale in Dashboard #13363
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For a while now, we've been unable to fully internationalize all regional variants of our languages in Dashboard; for a (minor but easy to see) example, look at the Privacy Policy link at the bottom of the page https://studio.code.org/; note that in Brazilian Portuguese the text of the link is capitalized, but it is not so in Portuguese Portuguese. However, if you toggle between the two languages on the page, you'll notice that we always show the Brazilian version.
This is because we are for some reason lowercasing all locales in dashboard even though we store the actual data in the format
"en-US"
, with the regional part capitalized. This means that when you switch the dialect to Portugal Portuguese, we tell dashboard to switch the locale to"pt-PT"
and dashboard instead switches the locale to"pt-pt"
. Then when we ask it to look up a translation, it goes and looks for"pt-pt"
and can't find it because we only have"pt-PT"
, so it just defaults back to the base language"pt"
, for which the default region is"BR"
(or"br"
).The simple solution is to just stop lowercasing the locale.