aboutsummaryrefslogtreecommitdiffstats
path: root/src/App.js
diff options
context:
space:
mode:
authorBen Woodward <ben@bdw.to>2021-08-08 20:58:51 -0700
committerGitHub <noreply@github.com>2021-08-08 20:58:51 -0700
commit1f753e8fb1c3d44b938a1ec541587cd6301f4181 (patch)
treec1c101ddab714b18e5d6c08cd0860d2ae1f84e04 /src/App.js
parent2f52ba13dcaeaa3336a542e6bd9847a5e1ad13c9 (diff)
Dynamic language select defaultValue (#182)
Replaces the hardcoded 'en-US' defaultValue of the language select with the value supplied by the i18n language detection. In my testing I found when setting my browser to "German" or "Dutch", the navigator.language returned is simply "de" and "nl" but the translation ids in the translations are "de-DE" and "nl-NL", respectively. This results in the select box defaulting to the first language (Arabic) because "de" and "nl" are not values in any of the options. This patch takes the i18n detected language and first checks if the id is a known translation. If not, 'en-US' is returned. If it is, the detected language is returned. Unfortunately I am not able to test this as both my Firefox and Chrome browsers are only setting the generic locale language ids. I can verify the fallback to english works. Additionally, editing the localStorage 'i18nextLng' key to 'de-DE' produces the expected translation. Related to #180
Diffstat (limited to 'src/App.js')
0 files changed, 0 insertions, 0 deletions