Initialize default target language

This commit is contained in:
sienori 2017-12-28 02:46:58 +09:00
parent 9aa510f901
commit aeb715a356
2 changed files with 21 additions and 17 deletions

View file

@ -24,23 +24,6 @@ function showMenu() {
} else menuRemove(); } 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() { function menuCreate() {
browser.contextMenus.create({ browser.contextMenus.create({

View file

@ -23,6 +23,7 @@ function setLangList() {
targetLang.innerHTML = langListHtml; targetLang.innerHTML = langListHtml;
secondTargetLang.innerHTML = langListHtml; secondTargetLang.innerHTML = langListHtml;
initialSetting();
} }
function alphabeticallySort(a, b) { 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 () { S.initOptionsPage().then(function () {
const saveByChangeItems = document.getElementsByClassName("saveByChange"); const saveByChangeItems = document.getElementsByClassName("saveByChange");
for (let item of saveByChangeItems) { for (let item of saveByChangeItems) {