Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Fix issue with user locale not using correct key #70

Merged
merged 1 commit into from Feb 17, 2018
Merged

Fix issue with user locale not using correct key #70

merged 1 commit into from Feb 17, 2018

Conversation

ItsANameToo
Copy link
Member

@ItsANameToo ItsANameToo commented Feb 15, 2018

Translations were broken after commit 42aaec8, due to the following:

const appLang = this.AVALIABLE_OPTIONS.languages[cultureLang] || this.AVALIABLE_OPTIONS.languages[browserLang] || 'en';

This works in case the option list does not contain cultureLang or browserLang, as it will default to 'en'. However, if it does contain cultureLang or browserLang, the selected value in appLang will be incorrect as the value of the option is taken (while the key corresponds to the actual language file). To give a more concrete example:

Let's say that we have our mobile device set to Dutch. Culturelang will return nl-NL, which is not available in the list of options, and browserlang will be nl. As a result, this.AVALIABLE_OPTIONS.languages[browserLang] will be stored in appLang, which is "Nederlands". The app will then try to look for Nederlands.json, while the file is called nl.json instead.

This PR makes sure that we use the key again, so we are able to find the correct translation file.

@luciorubeens
Copy link
Contributor

Oh, good catch! 👍🏻

@luciorubeens luciorubeens merged commit 07cf1b0 into ArkEcosystem:master Feb 17, 2018
@ItsANameToo ItsANameToo deleted the fix-user-locale branch February 18, 2018 13:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants