diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/Settings.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/components/Settings.js b/src/components/Settings.js index 1e07cb1..f12fe35 100644 --- a/src/components/Settings.js +++ b/src/components/Settings.js | |||
| @@ -13,6 +13,14 @@ export const Settings = (props) => { | |||
| 13 | { label: 'WEP', value: 'WEP' }, | 13 | { label: 'WEP', value: 'WEP' }, |
| 14 | ]; | 14 | ]; |
| 15 | 15 | ||
| 16 | const langSelectDefaultValue = () => { | ||
| 17 | const t = Translations.filter((t) => t.id === i18n.language); | ||
| 18 | if (t.length !== 1) { | ||
| 19 | return 'en-US'; | ||
| 20 | } | ||
| 21 | return t[0].id; | ||
| 22 | }; | ||
| 23 | |||
| 16 | useEffect(() => { | 24 | useEffect(() => { |
| 17 | if (props.firstLoad.current && window.innerWidth < 500) { | 25 | if (props.firstLoad.current && window.innerWidth < 500) { |
| 18 | props.onFirstLoad(); | 26 | props.onFirstLoad(); |
| @@ -26,9 +34,8 @@ export const Settings = (props) => { | |||
| 26 | width={300} | 34 | width={300} |
| 27 | inputHeight={38} | 35 | inputHeight={38} |
| 28 | label={t('select')} | 36 | label={t('select')} |
| 29 | selected={i18n.language} | ||
| 30 | onChange={(e) => props.onLanguageChange(e.target.value)} | 37 | onChange={(e) => props.onLanguageChange(e.target.value)} |
| 31 | defaultValue="en-US" | 38 | defaultValue={langSelectDefaultValue()} |
| 32 | > | 39 | > |
| 33 | {Translations.map((t) => ( | 40 | {Translations.map((t) => ( |
| 34 | <option key={t.id} value={t.id}> | 41 | <option key={t.id} value={t.id}> |
