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) {