aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/components/settings/navigation/SettingsNavigation.js1
-rw-r--r--src/components/settings/settings/EditSettingsForm.js33
-rw-r--r--src/config.js1
-rw-r--r--src/containers/settings/EditSettingsScreen.js38
-rw-r--r--src/i18n/languages.js45
-rw-r--r--src/i18n/locales/en-US.json3
-rw-r--r--src/i18n/translations.js4
-rw-r--r--src/stores/ServicesStore.js1
-rw-r--r--src/webview/plugin.js16
-rw-r--r--src/webview/spellchecker.js40
10 files changed, 149 insertions, 33 deletions
diff --git a/src/components/settings/navigation/SettingsNavigation.js b/src/components/settings/navigation/SettingsNavigation.js
index 3b21a7765..fea8d682d 100644
--- a/src/components/settings/navigation/SettingsNavigation.js
+++ b/src/components/settings/navigation/SettingsNavigation.js
@@ -74,7 +74,6 @@ export default class SettingsNavigation extends Component {
74 <Link 74 <Link
75 to="/auth/logout" 75 to="/auth/logout"
76 className="settings-navigation__link" 76 className="settings-navigation__link"
77 activeClassName="is-active"
78 > 77 >
79 {intl.formatMessage(messages.logout)} 78 {intl.formatMessage(messages.logout)}
80 </Link> 79 </Link>
diff --git a/src/components/settings/settings/EditSettingsForm.js b/src/components/settings/settings/EditSettingsForm.js
index e711ad402..601d57c81 100644
--- a/src/components/settings/settings/EditSettingsForm.js
+++ b/src/components/settings/settings/EditSettingsForm.js
@@ -30,9 +30,9 @@ const messages = defineMessages({
30 id: 'settings.app.headlineAppearance', 30 id: 'settings.app.headlineAppearance',
31 defaultMessage: '!!!Appearance', 31 defaultMessage: '!!!Appearance',
32 }, 32 },
33 headlineMessaging: { 33 headlineAdvanced: {
34 id: 'settings.app.headlineMessaging', 34 id: 'settings.app.headlineAdvanced',
35 defaultMessage: '!!!Messaging', 35 defaultMessage: '!!!Advanced',
36 }, 36 },
37 buttonSearchForUpdate: { 37 buttonSearchForUpdate: {
38 id: 'settings.app.buttonSearchForUpdate', 38 id: 'settings.app.buttonSearchForUpdate',
@@ -58,6 +58,10 @@ const messages = defineMessages({
58 id: 'settings.app.currentVersion', 58 id: 'settings.app.currentVersion',
59 defaultMessage: '!!!Current version:', 59 defaultMessage: '!!!Current version:',
60 }, 60 },
61 restartRequired: {
62 id: 'settings.app.restartRequired',
63 defaultMessage: '!!!Changes require restart',
64 },
61}); 65});
62 66
63@observer 67@observer
@@ -120,20 +124,31 @@ export default class EditSettingsForm extends Component {
120 onChange={e => this.submit(e)} 124 onChange={e => this.submit(e)}
121 id="form" 125 id="form"
122 > 126 >
123 <h2>{intl.formatMessage(messages.headlineGeneral)}</h2> 127 {/* General */}
128 <h2 id="general">{intl.formatMessage(messages.headlineGeneral)}</h2>
124 <Toggle field={form.$('autoLaunchOnStart')} /> 129 <Toggle field={form.$('autoLaunchOnStart')} />
125 <Toggle field={form.$('runInBackground')} /> 130 <Toggle field={form.$('runInBackground')} />
126 <Toggle field={form.$('enableSystemTray')} /> 131 <Toggle field={form.$('enableSystemTray')} />
127 {process.platform === 'win32' && ( 132 {process.platform === 'win32' && (
128 <Toggle field={form.$('minimizeToSystemTray')} /> 133 <Toggle field={form.$('minimizeToSystemTray')} />
129 )} 134 )}
130 <h2>{intl.formatMessage(messages.headlineAppearance)}</h2> 135
136 {/* Appearance */}
137 <h2 id="apperance">{intl.formatMessage(messages.headlineAppearance)}</h2>
131 <Toggle field={form.$('showDisabledServices')} /> 138 <Toggle field={form.$('showDisabledServices')} />
132 <h2>{intl.formatMessage(messages.headlineMessaging)}</h2> 139
133 <Toggle field={form.$('enableSpellchecking')} /> 140 {/* Language */}
134 <h2>{intl.formatMessage(messages.headlineLanguage)}</h2> 141 <h2 id="language">{intl.formatMessage(messages.headlineLanguage)}</h2>
135 <Select field={form.$('locale')} showLabel={false} /> 142 <Select field={form.$('locale')} showLabel={false} />
136 <h2>{intl.formatMessage(messages.headlineUpdates)}</h2> 143
144 {/* Advanced */}
145 <h2 id="advanced">{intl.formatMessage(messages.headlineAdvanced)}</h2>
146 <Toggle field={form.$('enableSpellchecking')} />
147 <p className="settings__help">{intl.formatMessage(messages.restartRequired)}</p>
148 {/* <Select field={form.$('spellcheckingLanguage')} /> */}
149
150 {/* Updates */}
151 <h2 id="updates">{intl.formatMessage(messages.headlineUpdates)}</h2>
137 {updateIsReadyToInstall ? ( 152 {updateIsReadyToInstall ? (
138 <Button 153 <Button
139 label={intl.formatMessage(messages.buttonInstallUpdate)} 154 label={intl.formatMessage(messages.buttonInstallUpdate)}
diff --git a/src/config.js b/src/config.js
index 60cc6fd7e..5ee5ee18e 100644
--- a/src/config.js
+++ b/src/config.js
@@ -12,6 +12,7 @@ export const DEFAULT_APP_SETTINGS = {
12 minimizeToSystemTray: false, 12 minimizeToSystemTray: false,
13 showDisabledServices: true, 13 showDisabledServices: true,
14 enableSpellchecking: true, 14 enableSpellchecking: true,
15 // spellcheckingLanguage: 'auto',
15 locale: 'en-US', 16 locale: 'en-US',
16 beta: false, 17 beta: false,
17 isAppMuted: false, 18 isAppMuted: false,
diff --git a/src/containers/settings/EditSettingsScreen.js b/src/containers/settings/EditSettingsScreen.js
index e146dc97c..62e255dab 100644
--- a/src/containers/settings/EditSettingsScreen.js
+++ b/src/containers/settings/EditSettingsScreen.js
@@ -7,7 +7,7 @@ import AppStore from '../../stores/AppStore';
7import SettingsStore from '../../stores/SettingsStore'; 7import SettingsStore from '../../stores/SettingsStore';
8import UserStore from '../../stores/UserStore'; 8import UserStore from '../../stores/UserStore';
9import Form from '../../lib/Form'; 9import Form from '../../lib/Form';
10import languages from '../../i18n/languages'; 10import { APP_LOCALES } from '../../i18n/languages';
11import { gaPage } from '../../lib/analytics'; 11import { gaPage } from '../../lib/analytics';
12import { DEFAULT_APP_SETTINGS } from '../../config'; 12import { DEFAULT_APP_SETTINGS } from '../../config';
13 13
@@ -47,6 +47,14 @@ const messages = defineMessages({
47 id: 'settings.app.form.enableSpellchecking', 47 id: 'settings.app.form.enableSpellchecking',
48 defaultMessage: '!!!Enable spell checking', 48 defaultMessage: '!!!Enable spell checking',
49 }, 49 },
50 spellcheckingLanguage: {
51 id: 'settings.app.form.spellcheckingLanguage',
52 defaultMessage: '!!!Language for spell checking',
53 },
54 // spellcheckingAutomaticDetection: {
55 // id: 'settings.app.form.spellcheckingAutomaticDetection',
56 // defaultMessage: '!!!Detect language automatically',
57 // },
50 beta: { 58 beta: {
51 id: 'settings.app.form.beta', 59 id: 'settings.app.form.beta',
52 defaultMessage: '!!!Include beta versions', 60 defaultMessage: '!!!Include beta versions',
@@ -78,6 +86,7 @@ export default class EditSettingsScreen extends Component {
78 minimizeToSystemTray: settingsData.minimizeToSystemTray, 86 minimizeToSystemTray: settingsData.minimizeToSystemTray,
79 showDisabledServices: settingsData.showDisabledServices, 87 showDisabledServices: settingsData.showDisabledServices,
80 enableSpellchecking: settingsData.enableSpellchecking, 88 enableSpellchecking: settingsData.enableSpellchecking,
89 // spellcheckingLanguage: settingsData.spellcheckingLanguage,
81 locale: settingsData.locale, 90 locale: settingsData.locale,
82 beta: settingsData.beta, 91 beta: settingsData.beta,
83 }, 92 },
@@ -94,14 +103,25 @@ export default class EditSettingsScreen extends Component {
94 const { app, settings, user } = this.props.stores; 103 const { app, settings, user } = this.props.stores;
95 const { intl } = this.context; 104 const { intl } = this.context;
96 105
97 const options = []; 106 const locales = [];
98 Object.keys(languages).forEach((key) => { 107 Object.keys(APP_LOCALES).forEach((key) => {
99 options.push({ 108 locales.push({
100 value: key, 109 value: key,
101 label: languages[key], 110 label: APP_LOCALES[key],
102 }); 111 });
103 }); 112 });
104 113
114 // const spellcheckerLocales = [{
115 // value: 'auto',
116 // label: intl.formatMessage(messages.spellcheckingAutomaticDetection),
117 // }];
118 // Object.keys(SPELLCHECKER_LOCALES).forEach((key) => {
119 // spellcheckerLocales.push({
120 // value: key,
121 // label: SPELLCHECKER_LOCALES[key],
122 // });
123 // });
124
105 const config = { 125 const config = {
106 fields: { 126 fields: {
107 autoLaunchOnStart: { 127 autoLaunchOnStart: {
@@ -139,10 +159,16 @@ export default class EditSettingsScreen extends Component {
139 value: settings.all.enableSpellchecking, 159 value: settings.all.enableSpellchecking,
140 default: DEFAULT_APP_SETTINGS.enableSpellchecking, 160 default: DEFAULT_APP_SETTINGS.enableSpellchecking,
141 }, 161 },
162 // spellcheckingLanguage: {
163 // label: intl.formatMessage(messages.spellcheckingLanguage),
164 // value: settings.all.spellcheckingLanguage,
165 // options: spellcheckerLocales,
166 // default: DEFAULT_APP_SETTINGS.spellcheckingLanguage,
167 // },
142 locale: { 168 locale: {
143 label: intl.formatMessage(messages.language), 169 label: intl.formatMessage(messages.language),
144 value: app.locale, 170 value: app.locale,
145 options, 171 options: locales,
146 default: DEFAULT_APP_SETTINGS.locale, 172 default: DEFAULT_APP_SETTINGS.locale,
147 }, 173 },
148 beta: { 174 beta: {
diff --git a/src/i18n/languages.js b/src/i18n/languages.js
index 72d7b26c1..77bb5deae 100644
--- a/src/i18n/languages.js
+++ b/src/i18n/languages.js
@@ -1,4 +1,4 @@
1module.exports = { 1export const APP_LOCALES = {
2 'en-US': 'English', 2 'en-US': 'English',
3 'pt-BR': 'Portuguese (Brazil)', 3 'pt-BR': 'Portuguese (Brazil)',
4 'el-GR': 'Ελληνικά (Greece)', 4 'el-GR': 'Ελληνικά (Greece)',
@@ -15,3 +15,46 @@ module.exports = {
15 'zh-Hant': 'Chinese (Traditional)', 15 'zh-Hant': 'Chinese (Traditional)',
16 'nb-NO': 'Norsk', 16 'nb-NO': 'Norsk',
17}; 17};
18
19export default APP_LOCALES;
20
21// export const SPELLCHECKER_LOCALES = {
22// af: 'Afrikaans',
23// sq: 'Albanian',
24// ar: 'Arabic',
25// bg: 'Bulgarian',
26// zh: 'Chinese',
27// hr: 'Croatian',
28// cs: 'Czech',
29// da: 'Danish',
30// nl: 'Dutch',
31// en: 'English',
32// 'en-AU': 'English (AU)',
33// 'en-CA': 'English (CA)',
34// 'en-GB': 'English (GB)',
35// fi: 'Finnish',
36// fr: 'French',
37// ka: 'Georgian',
38// de: 'German',
39// el: 'Greek, Modern',
40// hi: 'Hindi',
41// hu: 'Hungarian',
42// id: 'Indonesian',
43// it: 'Italian',
44// ja: 'Japanese',
45// jv: 'Javanese',
46// ko: 'Korean',
47// lt: 'Lithuanian',
48// lv: 'Latvian',
49// ms: 'Malay',
50// no: 'Norwegian',
51// pl: 'Polish',
52// pt: 'Portuguese',
53// ro: 'Romanian, Moldavian, Moldovan',
54// ru: 'Russian',
55// sk: 'Slovak',
56// es: 'Spanish',
57// sv: 'Swedish',
58// uk: 'Ukrainian',
59// vi: 'Vietnamese',
60// };
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json
index fd8ba0fef..e50386e79 100644
--- a/src/i18n/locales/en-US.json
+++ b/src/i18n/locales/en-US.json
@@ -132,6 +132,7 @@
132 "settings.app.headlineLanguage": "Language", 132 "settings.app.headlineLanguage": "Language",
133 "settings.app.headlineUpdates": "Updates", 133 "settings.app.headlineUpdates": "Updates",
134 "settings.app.headlineAppearance": "Appearance", 134 "settings.app.headlineAppearance": "Appearance",
135 "settings.app.headlineAdvanced": "Advanced",
135 "settings.app.buttonSearchForUpdate": "Check for updates", 136 "settings.app.buttonSearchForUpdate": "Check for updates",
136 "settings.app.buttonInstallUpdate": "Restart & install update", 137 "settings.app.buttonInstallUpdate": "Restart & install update",
137 "settings.app.updateStatusSearching": "Is searching for update", 138 "settings.app.updateStatusSearching": "Is searching for update",
@@ -143,9 +144,11 @@
143 "settings.app.form.minimizeToSystemTray": "Minimize Franz to system tray", 144 "settings.app.form.minimizeToSystemTray": "Minimize Franz to system tray",
144 "settings.app.form.runInBackground": "Keep Franz in background when closing the window", 145 "settings.app.form.runInBackground": "Keep Franz in background when closing the window",
145 "settings.app.form.language": "Language", 146 "settings.app.form.language": "Language",
147 "settings.app.form.enableSpellchecking": "Enable spell checking",
146 "settings.app.form.showDisabledServices": "Display disabled services tabs", 148 "settings.app.form.showDisabledServices": "Display disabled services tabs",
147 "settings.app.form.beta": "Include beta versions", 149 "settings.app.form.beta": "Include beta versions",
148 "settings.app.currentVersion": "Current version:", 150 "settings.app.currentVersion": "Current version:",
151 "settings.app.restartRequired": "Changes require restart",
149 "settings.user.form.firstname": "Firstname", 152 "settings.user.form.firstname": "Firstname",
150 "settings.user.form.lastname": "Lastname", 153 "settings.user.form.lastname": "Lastname",
151 "settings.user.form.email": "Email", 154 "settings.user.form.email": "Email",
diff --git a/src/i18n/translations.js b/src/i18n/translations.js
index 492a6cc4e..161a172ba 100644
--- a/src/i18n/translations.js
+++ b/src/i18n/translations.js
@@ -1,7 +1,7 @@
1import languages from './languages'; 1import { APP_LOCALES } from './languages';
2 2
3const translations = []; 3const translations = [];
4Object.keys(languages).forEach((key) => { 4Object.keys(APP_LOCALES).forEach((key) => {
5 try { 5 try {
6 const translation = require(`./locales/${key}.json`); // eslint-disable-line 6 const translation = require(`./locales/${key}.json`); // eslint-disable-line
7 translations[key] = translation; 7 translations[key] = translation;
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js
index 82da9c5f1..87d31c0c5 100644
--- a/src/stores/ServicesStore.js
+++ b/src/stores/ServicesStore.js
@@ -286,6 +286,7 @@ export default class ServicesStore extends Store {
286 if (channel === 'hello') { 286 if (channel === 'hello') {
287 this._initRecipePolling(service.id); 287 this._initRecipePolling(service.id);
288 this._initializeServiceRecipeInWebview(serviceId); 288 this._initializeServiceRecipeInWebview(serviceId);
289 this._shareSettingsWithServiceProcess();
289 } else if (channel === 'messages') { 290 } else if (channel === 'messages') {
290 this.actions.service.setUnreadMessageCount({ 291 this.actions.service.setUnreadMessageCount({
291 serviceId, 292 serviceId,
diff --git a/src/webview/plugin.js b/src/webview/plugin.js
index fec353f34..c877132b1 100644
--- a/src/webview/plugin.js
+++ b/src/webview/plugin.js
@@ -3,10 +3,12 @@ import path from 'path';
3 3
4import RecipeWebview from './lib/RecipeWebview'; 4import RecipeWebview from './lib/RecipeWebview';
5 5
6import './spellchecker.js'; 6import Spellchecker from './spellchecker.js';
7import './notifications.js'; 7import './notifications.js';
8import './ime.js'; 8import './ime.js';
9 9
10const spellchecker = new Spellchecker();
11
10ipcRenderer.on('initializeRecipe', (e, data) => { 12ipcRenderer.on('initializeRecipe', (e, data) => {
11 const modulePath = path.join(data.recipe.path, 'webview.js'); 13 const modulePath = path.join(data.recipe.path, 'webview.js');
12 // Delete module from cache 14 // Delete module from cache
@@ -20,7 +22,17 @@ ipcRenderer.on('initializeRecipe', (e, data) => {
20}); 22});
21 23
22ipcRenderer.on('settings-update', (e, data) => { 24ipcRenderer.on('settings-update', (e, data) => {
23 console.log(data); 25 if (data.enableSpellchecking) {
26 if (!spellchecker.isEnabled) {
27 spellchecker.enable();
28
29 // TODO: this does not work yet, needs more testing
30 // if (data.spellcheckingLanguage !== 'auto') {
31 // console.log('set spellchecking language to', data.spellcheckingLanguage);
32 // spellchecker.switchLanguage(data.spellcheckingLanguage);
33 // }
34 }
35 }
24}); 36});
25 37
26document.addEventListener('DOMContentLoaded', () => { 38document.addEventListener('DOMContentLoaded', () => {
diff --git a/src/webview/spellchecker.js b/src/webview/spellchecker.js
index ec8807874..5beb77e03 100644
--- a/src/webview/spellchecker.js
+++ b/src/webview/spellchecker.js
@@ -1,14 +1,30 @@
1import { SpellCheckHandler, ContextMenuListener, ContextMenuBuilder } from 'electron-spellchecker'; 1import { SpellCheckHandler, ContextMenuListener, ContextMenuBuilder } from 'electron-spellchecker';
2 2
3window.spellCheckHandler = new SpellCheckHandler(); 3import { isMac } from '../environment';
4setTimeout(() => { 4
5 window.spellCheckHandler.attachToInput(); 5export default class Spellchecker {
6}, 1000); 6 isEnabled = false;
7 7 spellchecker = null;
8// TODO: should we set the language to user settings? 8
9// window.spellCheckHandler.switchLanguage('en-US'); 9 enable() {
10 10 this.spellchecker = new SpellCheckHandler();
11const contextMenuBuilder = new ContextMenuBuilder(window.spellCheckHandler); 11 if (!isMac) {
12const contextMenuListener = new ContextMenuListener((info) => { // eslint-disable-line 12 this.spellchecker.attachToInput();
13 contextMenuBuilder.showPopupMenu(info); 13 this.spellchecker.switchLanguage(navigator.language);
14}); 14 }
15
16 const contextMenuBuilder = new ContextMenuBuilder(this.spellchecker);
17
18 new ContextMenuListener((info) => { // eslint-disable-line
19 contextMenuBuilder.showPopupMenu(info);
20 });
21 }
22
23 // TODO: this does not work yet, needs more testing
24 // switchLanguage(language) {
25 // if (language !== 'auto') {
26 // this.spellchecker.switchLanguage(language);
27 // }
28 // }
29}
30