diff options
author | Markus Hatvan <markus_hatvan@aon.at> | 2021-09-14 19:58:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-14 19:58:52 +0200 |
commit | 95df3522a15631abc51a4295cae0ea401a8d4e1e (patch) | |
tree | e5eb0f368c947683f01458e912f21756fb0d99cb /src/helpers/i18n-helpers.ts | |
parent | docs: add sad270 as a contributor for bug, userTesting [skip ci] (#1941) (diff) | |
download | ferdium-app-95df3522a15631abc51a4295cae0ea401a8d4e1e.tar.gz ferdium-app-95df3522a15631abc51a4295cae0ea401a8d4e1e.tar.zst ferdium-app-95df3522a15631abc51a4295cae0ea401a8d4e1e.zip |
feat: add eslint-plugin-unicorn (#1936)
Diffstat (limited to 'src/helpers/i18n-helpers.ts')
-rw-r--r-- | src/helpers/i18n-helpers.ts | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/helpers/i18n-helpers.ts b/src/helpers/i18n-helpers.ts index c1f18f446..ec7dc8e98 100644 --- a/src/helpers/i18n-helpers.ts +++ b/src/helpers/i18n-helpers.ts | |||
@@ -4,13 +4,11 @@ export function getLocale({ | |||
4 | let localeStr = locale; | 4 | let localeStr = locale; |
5 | if (locales[locale] === undefined) { | 5 | if (locales[locale] === undefined) { |
6 | let localeFuzzy: string | undefined; | 6 | let localeFuzzy: string | undefined; |
7 | Object.keys(locales).forEach((localStr) => { | 7 | for (const localStr of Object.keys(locales)) { |
8 | if (locales && Object.hasOwnProperty.call(locales, localStr)) { | 8 | if (locales && Object.hasOwnProperty.call(locales, localStr) && locale.slice(0, 2) === localStr.slice(0, 2)) { |
9 | if (locale.substring(0, 2) === localStr.substring(0, 2)) { | ||
10 | localeFuzzy = localStr; | 9 | localeFuzzy = localStr; |
11 | } | 10 | } |
12 | } | 11 | } |
13 | }); | ||
14 | 12 | ||
15 | if (localeFuzzy !== undefined) { | 13 | if (localeFuzzy !== undefined) { |
16 | localeStr = localeFuzzy; | 14 | localeStr = localeFuzzy; |
@@ -61,12 +59,12 @@ export function getSelectOptions({ | |||
61 | if (sort) { | 59 | if (sort) { |
62 | keys = keys.sort(Intl.Collator().compare); | 60 | keys = keys.sort(Intl.Collator().compare); |
63 | } | 61 | } |
64 | keys.forEach((key) => { | 62 | for (const key of keys) { |
65 | options.push({ | 63 | options.push({ |
66 | value: key, | 64 | value: key, |
67 | label: locales[key], | 65 | label: locales[key], |
68 | }); | 66 | }); |
69 | }); | 67 | } |
70 | 68 | ||
71 | return options; | 69 | return options; |
72 | } | 70 | } |