diff --git a/app/locale.js b/app/locale.js index b0d7b2a2b5..93d14d808f 100644 --- a/app/locale.js +++ b/app/locale.js @@ -1,6 +1,7 @@ const path = require('path'); const fs = require('fs'); const app = require('electron').app; +const _ = require('lodash'); function normalizeLocaleName(locale) { if (/^en-/.test(locale)) { @@ -25,6 +26,8 @@ function getLocaleMessages(locale) { } function load() { + var english = getLocaleMessages('en'); + // Load locale - if we can't load messages for the current locale, we // default to 'en' // @@ -35,12 +38,15 @@ function load() { try { messages = getLocaleMessages(localeName); + + // We start with english, then overwrite that with anything present in locale + messages = _.merge(english, messages); } catch (e) { console.log('Problem loading messages for locale ', localeName, e.stack); console.log('Falling back to en locale'); localeName = 'en'; - messages = getLocaleMessages(localeName); + messages = english; } return { diff --git a/js/spell_check.js b/js/spell_check.js index b3db6a2177..cd22baae36 100644 --- a/js/spell_check.js +++ b/js/spell_check.js @@ -57,6 +57,8 @@ } } + // We load locale this way and not via app.getLocale() because this call returns + // 'es_ES' and not just 'es.' And hunspell requires the fully-qualified locale. var locale = osLocale.sync().replace('-', '_'); // The LANG environment variable is how node spellchecker finds its default language: