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
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.
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
orbrowserLang
, as it will default to 'en'. However, if it does containcultureLang
orbrowserLang
, the selected value inappLang
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 benl
. As a result,this.AVALIABLE_OPTIONS.languages[browserLang]
will be stored inappLang
, which is "Nederlands". The app will then try to look forNederlands.json
, while the file is callednl.json
instead.This PR makes sure that we use the key again, so we are able to find the correct translation file.