Fix regional language variants not being properly accessed #152
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.
I noticed there was a problem when I visited the main project page in incognito, where the recommended instances were not matching those defined for my language (
pt-PT
). Turned out,recommended_instances.json
only hadpt
andpt_BR
.There was another issue, however. The browser reports languages with dashes, while the i18n registry had codes with underscores. I changed the values to comply with browsers, and it all works correctly now.
This is not the ideal fix. It would be better to have some sort of fallback system where it tries to find the best match for the language reported by the browser. So, for example, if I visited the website in
pt-PT
but it didn't have it, it would first try to match the more general language codept
, before trying to find another regional variant likept-BR
. Something for a later PR though.