Fix correct spellchecker locale not selected for non en-US locales
app.getLocale() should be called after app.on('init') event. spellCheckerLocale is removed from defaultPreferences.js
This commit is contained in:
@@ -15,7 +15,6 @@ const defaultPreferences = {
|
|||||||
},
|
},
|
||||||
showUnreadBadge: true,
|
showUnreadBadge: true,
|
||||||
useSpellChecker: true,
|
useSpellChecker: true,
|
||||||
spellCheckerLocale: 'en-US',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = defaultPreferences;
|
module.exports = defaultPreferences;
|
||||||
|
@@ -12,11 +12,8 @@ function merge(base, target) {
|
|||||||
const defaultPreferences = require('./config/defaultPreferences');
|
const defaultPreferences = require('./config/defaultPreferences');
|
||||||
const upgradePreferences = require('./config/upgradePreferences');
|
const upgradePreferences = require('./config/upgradePreferences');
|
||||||
|
|
||||||
function loadDefault(spellCheckerLocale) {
|
function loadDefault() {
|
||||||
const config = JSON.parse(JSON.stringify(defaultPreferences));
|
return JSON.parse(JSON.stringify(defaultPreferences));
|
||||||
return Object.assign({}, config, {
|
|
||||||
spellCheckerLocale: spellCheckerLocale || defaultPreferences.spellCheckerLocale || 'en-US',
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasBuildConfigDefaultTeams(config) {
|
function hasBuildConfigDefaultTeams(config) {
|
||||||
|
@@ -79,8 +79,7 @@ try {
|
|||||||
settings.writeFileSync(configFile, config);
|
settings.writeFileSync(configFile, config);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const spellCheckerLocale = SpellChecker.getSpellCheckerLocale(app.getLocale());
|
config = settings.loadDefault();
|
||||||
config = settings.loadDefault(null, spellCheckerLocale);
|
|
||||||
console.log('Failed to read or upgrade config.json', e);
|
console.log('Failed to read or upgrade config.json', e);
|
||||||
if (!config.teams.length && config.defaultTeam) {
|
if (!config.teams.length && config.defaultTeam) {
|
||||||
config.teams.push(config.defaultTeam);
|
config.teams.push(config.defaultTeam);
|
||||||
@@ -386,6 +385,12 @@ app.on('ready', () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!config.spellCheckerLocale) {
|
||||||
|
config.spellCheckerLocale = SpellChecker.getSpellCheckerLocale(app.getLocale());
|
||||||
|
const configFile = app.getPath('userData') + '/config.json';
|
||||||
|
settings.writeFileSync(configFile, config);
|
||||||
|
}
|
||||||
|
|
||||||
const appStateJson = path.join(app.getPath('userData'), 'app-state.json');
|
const appStateJson = path.join(app.getPath('userData'), 'app-state.json');
|
||||||
appState = new AppStateManager(appStateJson);
|
appState = new AppStateManager(appStateJson);
|
||||||
if (wasUpdated(appState.lastAppVersion)) {
|
if (wasUpdated(appState.lastAppVersion)) {
|
||||||
|
Reference in New Issue
Block a user