From aeb715a3561c29e5f3293b09f42ad6f15145451c Mon Sep 17 00:00:00 2001 From: sienori Date: Thu, 28 Dec 2017 02:46:58 +0900 Subject: [PATCH] Initialize default target language --- simple-translate/background.js | 17 ----------------- simple-translate/options/options.js | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/simple-translate/background.js b/simple-translate/background.js index eea7abf..4d5b388 100644 --- a/simple-translate/background.js +++ b/simple-translate/background.js @@ -24,23 +24,6 @@ function showMenu() { } else menuRemove(); } -function initialSetting() { - switch (browser.i18n.getUILanguage()) { //一部の言語はブラウザの設定に合わせる - case "ja": - case "zh-CN": - case "zh-TW": - case "ko": - case "ru": - targetLang = browser.i18n.getUILanguage(); - secondTargetLang = "en"; - break; - default: - targetLang = "en"; - secondTargetLang = "ja"; - break; - } -} - //メニューを表示 function menuCreate() { browser.contextMenus.create({ diff --git a/simple-translate/options/options.js b/simple-translate/options/options.js index aac574f..d26fd4a 100644 --- a/simple-translate/options/options.js +++ b/simple-translate/options/options.js @@ -23,6 +23,7 @@ function setLangList() { targetLang.innerHTML = langListHtml; secondTargetLang.innerHTML = langListHtml; + initialSetting(); } function alphabeticallySort(a, b) { @@ -33,6 +34,26 @@ function alphabeticallySort(a, b) { } } +function initialSetting() { + switch (browser.i18n.getUILanguage()) { //一部の言語はブラウザの設定に合わせる + case "ja": + case "zh-CN": + case "zh-TW": + case "ko": + case "ru": + case "de": + case "fr": + case "it": + targetLang.value = browser.i18n.getUILanguage(); + secondTargetLang.value = "en"; + break; + default: + targetLang.value = "en"; + secondTargetLang.value = "ja"; + break; + } +} + S.initOptionsPage().then(function () { const saveByChangeItems = document.getElementsByClassName("saveByChange"); for (let item of saveByChangeItems) {