Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve preferredLanguages based language selection fallback #129

Open
simonmitchell opened this issue Feb 28, 2019 · 0 comments
Open

Improve preferredLanguages based language selection fallback #129

simonmitchell opened this issue Feb 28, 2019 · 0 comments

Comments

@simonmitchell
Copy link
Contributor

The logic for selecting a storm language in StormLanguageController eventually falls back to simply using the user's list of preferred languages for picking the language to show them. However at the moment this is a simple check which will only work with non-regional language codes such as es as apposed to en-US.

This means that if the languages available in Storm were usa_en and usa_es but the user had their phone set to es-SPA for example (Not sure if this even exists, it's just an example) this wouldn't be taken into account and the user would be shown the app in usa_en due to it being alphabetically first!

To fix this we need to compare on both the language and the locale, but first we need functions to standardise both the storm and iOS localisation codes to be ISO 639-2 (3 character language designator) + ISO 3166-1 alpha -3 (3 character region designator) so we can do the comparison.

Once we do that, languages with a full match (Both language and region) should be sorted first base on their position in Locale.preferredLanguages and then languages that just match the language designator!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant