diff options
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 | } |