diff options
author | 2018-12-07 20:25:42 +0100 | |
---|---|---|
committer | 2018-12-07 20:25:42 +0100 | |
commit | baf7d60af40e9cc3ce5403c5e109331098d5e1d6 (patch) | |
tree | 1973e6304b04088dc6ff9324b7e73fb52c400c9e /src/helpers | |
parent | Update package-lock.json (diff) | |
download | ferdium-app-baf7d60af40e9cc3ce5403c5e109331098d5e1d6.tar.gz ferdium-app-baf7d60af40e9cc3ce5403c5e109331098d5e1d6.tar.zst ferdium-app-baf7d60af40e9cc3ce5403c5e109331098d5e1d6.zip |
feat(Service): Add option to change spellchecking language by service
Diffstat (limited to 'src/helpers')
-rw-r--r-- | src/helpers/i18n-helpers.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/helpers/i18n-helpers.js b/src/helpers/i18n-helpers.js index 00a2061c1..026a220e0 100644 --- a/src/helpers/i18n-helpers.js +++ b/src/helpers/i18n-helpers.js | |||
@@ -25,3 +25,29 @@ export function getLocale({ locale, locales, defaultLocale, fallbackLocale }) { | |||
25 | 25 | ||
26 | return localeStr; | 26 | return localeStr; |
27 | } | 27 | } |
28 | |||
29 | export function getSelectOptions({ locales, resetToDefaultText = '' }) { | ||
30 | let options = []; | ||
31 | |||
32 | if (resetToDefaultText) { | ||
33 | options = [ | ||
34 | { | ||
35 | value: '', | ||
36 | label: resetToDefaultText, | ||
37 | }, { | ||
38 | value: '───', | ||
39 | label: '───', | ||
40 | disabled: true, | ||
41 | }, | ||
42 | ]; | ||
43 | } | ||
44 | |||
45 | Object.keys(locales).sort(Intl.Collator().compare).forEach((key) => { | ||
46 | options.push({ | ||
47 | value: key, | ||
48 | label: locales[key], | ||
49 | }); | ||
50 | }); | ||
51 | |||
52 | return options; | ||
53 | } | ||