diff options
author | 2018-12-07 20:25:42 +0100 | |
---|---|---|
committer | 2018-12-07 20:25:42 +0100 | |
commit | baf7d60af40e9cc3ce5403c5e109331098d5e1d6 (patch) | |
tree | 1973e6304b04088dc6ff9324b7e73fb52c400c9e /src/containers | |
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/containers')
-rw-r--r-- | src/containers/settings/EditServiceScreen.js | 24 | ||||
-rw-r--r-- | src/containers/settings/EditSettingsScreen.js | 18 |
2 files changed, 29 insertions, 13 deletions
diff --git a/src/containers/settings/EditServiceScreen.js b/src/containers/settings/EditServiceScreen.js index 639e8b070..f4915f68b 100644 --- a/src/containers/settings/EditServiceScreen.js +++ b/src/containers/settings/EditServiceScreen.js | |||
@@ -14,9 +14,12 @@ import { gaPage } from '../../lib/analytics'; | |||
14 | import ServiceError from '../../components/settings/services/ServiceError'; | 14 | import ServiceError from '../../components/settings/services/ServiceError'; |
15 | import EditServiceForm from '../../components/settings/services/EditServiceForm'; | 15 | import EditServiceForm from '../../components/settings/services/EditServiceForm'; |
16 | import { required, url, oneRequired } from '../../helpers/validation-helpers'; | 16 | import { required, url, oneRequired } from '../../helpers/validation-helpers'; |
17 | import { getSelectOptions } from '../../helpers/i18n-helpers'; | ||
17 | 18 | ||
18 | import { config as proxyFeature } from '../../features/serviceProxy'; | 19 | import { config as proxyFeature } from '../../features/serviceProxy'; |
19 | 20 | ||
21 | import { SPELLCHECKER_LOCALES } from '../../i18n/languages'; | ||
22 | |||
20 | const messages = defineMessages({ | 23 | const messages = defineMessages({ |
21 | name: { | 24 | name: { |
22 | id: 'settings.service.form.name', | 25 | id: 'settings.service.form.name', |
@@ -74,6 +77,14 @@ const messages = defineMessages({ | |||
74 | id: 'settings.service.form.proxy.password', | 77 | id: 'settings.service.form.proxy.password', |
75 | defaultMessage: '!!!Password', | 78 | defaultMessage: '!!!Password', |
76 | }, | 79 | }, |
80 | spellcheckerLanguage: { | ||
81 | id: 'settings.service.form.spellcheckerLanguage', | ||
82 | defaultMessage: '!!!Spell checking Language', | ||
83 | }, | ||
84 | spellcheckerSystemDefault: { | ||
85 | id: 'settings.service.form.spellcheckerLanguage.default', | ||
86 | defaultMessage: '!!!Use System Default ({default})', | ||
87 | }, | ||
77 | }); | 88 | }); |
78 | 89 | ||
79 | export default @inject('stores', 'actions') @observer class EditServiceScreen extends Component { | 90 | export default @inject('stores', 'actions') @observer class EditServiceScreen extends Component { |
@@ -101,6 +112,11 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex | |||
101 | } | 112 | } |
102 | 113 | ||
103 | prepareForm(recipe, service, proxy) { | 114 | prepareForm(recipe, service, proxy) { |
115 | const spellcheckerLanguage = getSelectOptions({ | ||
116 | locales: SPELLCHECKER_LOCALES, | ||
117 | resetToDefaultText: this.context.intl.formatMessage(messages.spellcheckerSystemDefault, { default: SPELLCHECKER_LOCALES[this.props.stores.settings.app.spellcheckerLanguage] }), | ||
118 | }); | ||
119 | |||
104 | const { intl } = this.context; | 120 | const { intl } = this.context; |
105 | const config = { | 121 | const config = { |
106 | fields: { | 122 | fields: { |
@@ -138,7 +154,13 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex | |||
138 | isDarkModeEnabled: { | 154 | isDarkModeEnabled: { |
139 | label: intl.formatMessage(messages.enableDarkMode), | 155 | label: intl.formatMessage(messages.enableDarkMode), |
140 | value: service.isDarkModeEnabled, | 156 | value: service.isDarkModeEnabled, |
141 | default: this.props.stores.settings.all.app.darkMode, | 157 | default: this.props.stores.settings.app.darkMode, |
158 | }, | ||
159 | spellcheckerLanguage: { | ||
160 | label: intl.formatMessage(messages.spellcheckerLanguage), | ||
161 | value: service.spellcheckerLanguage, | ||
162 | options: spellcheckerLanguage, | ||
163 | disabled: !this.props.stores.settings.app.enableSpellchecking, | ||
142 | }, | 164 | }, |
143 | }, | 165 | }, |
144 | }; | 166 | }; |
diff --git a/src/containers/settings/EditSettingsScreen.js b/src/containers/settings/EditSettingsScreen.js index ea1d319d9..350bd9f8a 100644 --- a/src/containers/settings/EditSettingsScreen.js +++ b/src/containers/settings/EditSettingsScreen.js | |||
@@ -12,6 +12,8 @@ import { gaPage } from '../../lib/analytics'; | |||
12 | import { DEFAULT_APP_SETTINGS } from '../../config'; | 12 | import { DEFAULT_APP_SETTINGS } from '../../config'; |
13 | import { config as spellcheckerConfig } from '../../features/spellchecker'; | 13 | import { config as spellcheckerConfig } from '../../features/spellchecker'; |
14 | 14 | ||
15 | import { getSelectOptions } from '../../helpers/i18n-helpers'; | ||
16 | |||
15 | 17 | ||
16 | import EditSettingsForm from '../../components/settings/settings/EditSettingsForm'; | 18 | import EditSettingsForm from '../../components/settings/settings/EditSettingsForm'; |
17 | 19 | ||
@@ -116,20 +118,12 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e | |||
116 | const { app, settings, user } = this.props.stores; | 118 | const { app, settings, user } = this.props.stores; |
117 | const { intl } = this.context; | 119 | const { intl } = this.context; |
118 | 120 | ||
119 | const locales = []; | 121 | const locales = getSelectOptions({ |
120 | Object.keys(APP_LOCALES).sort(Intl.Collator().compare).forEach((key) => { | 122 | locales: APP_LOCALES, |
121 | locales.push({ | ||
122 | value: key, | ||
123 | label: APP_LOCALES[key], | ||
124 | }); | ||
125 | }); | 123 | }); |
126 | 124 | ||
127 | const spellcheckingLanguages = []; | 125 | const spellcheckingLanguages = getSelectOptions({ |
128 | Object.keys(SPELLCHECKER_LOCALES).sort(Intl.Collator().compare).forEach((key) => { | 126 | locales: SPELLCHECKER_LOCALES, |
129 | spellcheckingLanguages.push({ | ||
130 | value: key, | ||
131 | label: SPELLCHECKER_LOCALES[key], | ||
132 | }); | ||
133 | }); | 127 | }); |
134 | 128 | ||
135 | const config = { | 129 | const config = { |