diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2021-03-04 18:40:53 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-04 18:40:53 +0100 |
| commit | e84a86d4ac0caf29d6074728376ff0a594243fec (patch) | |
| tree | 888c79ed0094ba2916a1d329861a85515959913c /electron/src/lib | |
| parent | b39575a50191307b3b56eab6455626398eec6397 (diff) | |
Update for Inkscape 1.0 (#880)
* update for inkscape 1.0
* add about extension
* Build improvements for the inkscape1.0 branch (#985)
* zip: export real svg not stitch plan
* #411 and #726
* Tools for Font Creators (#1018)
* ignore very small holes in fills
* remove embroider (#1026)
* auto_fill: ignore shrink_or_grow if result is empty (#589)
* break apart: do not ignore small fills
Co-authored-by: Hagen Fritsch <rumpeltux-github@irgendwo.org>
Co-authored-by: Lex Neva <github.com@lexneva.name>
Diffstat (limited to 'electron/src/lib')
| -rw-r--r-- | electron/src/lib/i18n.js | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/electron/src/lib/i18n.js b/electron/src/lib/i18n.js index 886fd654..4f9395d7 100644 --- a/electron/src/lib/i18n.js +++ b/electron/src/lib/i18n.js @@ -1,9 +1,27 @@ -module.exports.selectLanguage = function () { - ['LANGUAGE', 'LC_ALL', 'LC_MESSAGES', 'LANG'].forEach(language => { +module.exports.selectLanguage = function (translations) { + // get a list of available translations + var availableTranslations = ['en_US']; + for(var k in translations) availableTranslations.push(k); + + var lang = undefined; + + // get system language / Inkscape language + ['LANG', 'LC_MESSAGES', 'LC_ALL', 'LANGUAGE'].forEach(language => { if (process.env[language]) { - return process.env[language].split(":")[0] + // split encoding information, we don't need it + var current_lang = process.env[language].split(".")[0]; + if (current_lang.length == 2) { + // current language has only two letters (e.g. en), + // compare with available languages and if present, set to a long locale name (e.g. en_US) + lang = availableTranslations.find(elem => elem.startsWith(current_lang)); + } else { + lang = current_lang; + } } }) - - return "en_US" + // set default language + if (lang === undefined) { + lang = "en_US" + } + return lang } |
