diff --git a/simple-translate/_locales/en/messages.json b/simple-translate/_locales/en/messages.json
index 2deba5b..077cb49 100644
--- a/simple-translate/_locales/en/messages.json
+++ b/simple-translate/_locales/en/messages.json
@@ -15,7 +15,7 @@
"message": "Target language"
},
"langList": {
- "message": ""
+ "message": "af:Afrikaans, sq:Albanian, am:Amharic, ar:Arabic, hy:Armenian, az:Azerbaijani, eu:Basque, be:Belarusian, bn:Bengali, bs:Bosnian, bg:Bulgarian, ca:Catalan, ceb:Cebuano, ny:Chewa, zh-CN:Chinese (PRC), zh-TW:Chinese (Taiwan), co:Corsican, hr:Croatian, cs:Czech, da:Danish, nl:Dutch, en:English, eo:Esperanto, et:Estonian, fi:Finnish, fr:French, fy:Frisian, gl:Galician, ka:Georgian, de:German, el:Greek, gu:Gujarati, ht:Haitian, ha:Hausa, haw:Hawaiian, he:Hebrew, hi:Hindi, hu:Hungarian, is:Icelandic, ig:Igbo, id:Indonesian, ga:Irish, it:Italian, ja:Japanese, jv:Javanese, kn:Kannada, kk:Kazakh, km:Khmer, ky:Kirghiz, ko:Korean, ku:Kurdish, lo:Laotian, la:Latin, lv:Latvian, lt:Lithuanian, lb:Luxembourgish, mk:Macedonian, mg:Malagasy, ms:Malay, ml:Malayalam, mt:Maltese, mi:Maori, mr:Marathi, mn:Mongolian, hmn:Monk, my:Myanmar, ne:Nepali, no:Norwegian, fa:Persian, pl:Polish, pt:Portuguese, pa:Punjabi, ps:Pushto, ro:Romanian, ru:Russian, sm:Samoan, gd:Scottish Gaelic, sr:Serbian, sn:Shona, sd:Sindhi, si:Sinhala, sk:Slovak, sl:Slovenian, so:Somali, sx:Sotho, es:Spanish, su:Sundanese, sw:Swahili, sv:Swedish, tl:Tagalog, tg:Tajiki, ta:Tamil, te:Telugu, th:Thai, tr:Turkish, uk:Ukrainian, ur:Urdu, uz:Uzbek, vi:Vietnamese, cy:Welsh, xh:Xosa, yi:Yiddish, yo:Yoruba, zu:Zulu"
},
"settingsLabel": {
"message": "Settings"
diff --git a/simple-translate/options/options.js b/simple-translate/options/options.js
index 23a6279..aac574f 100644
--- a/simple-translate/options/options.js
+++ b/simple-translate/options/options.js
@@ -5,8 +5,33 @@ const S = new settingsObj()
let targetLang = document.getElementById("targetLang");
let secondTargetLang = document.getElementById("secondTargetLang");
-targetLang.innerHTML = browser.i18n.getMessage("langList");
-secondTargetLang.innerHTML = browser.i18n.getMessage("langList");
+setLangList();
+
+function setLangList() {
+ let langList = browser.i18n.getMessage("langList");
+ langList = langList.split(", ");
+
+ for (let i in langList) {
+ langList[i] = langList[i].split(":");
+ }
+ langList = langList.sort(alphabeticallySort);
+
+ let langListHtml = "";
+ for (let i of langList) {
+ langListHtml += ``
+ }
+ targetLang.innerHTML = langListHtml;
+ secondTargetLang.innerHTML = langListHtml;
+
+}
+
+function alphabeticallySort(a, b) {
+ if (a[1].toString() > b[1].toString()) {
+ return 1;
+ } else {
+ return -1;
+ }
+}
S.initOptionsPage().then(function () {
const saveByChangeItems = document.getElementsByClassName("saveByChange");
diff --git a/simple-translate/popup/popup.js b/simple-translate/popup/popup.js
index e41a001..2bd7c40 100644
--- a/simple-translate/popup/popup.js
+++ b/simple-translate/popup/popup.js
@@ -19,7 +19,7 @@ let target = document.getElementById("target");
let langList = document.getElementById("langList");
let textarea = document.getElementById("textarea");
-langList.innerHTML = browser.i18n.getMessage("langList");
+//langList= browser.i18n.getMessage("langList");
const initialText = browser.i18n.getMessage("initialTextArea");
textarea.placeholder = initialText;
@@ -29,6 +29,33 @@ let defaultTargetLang;
let ifChangeSecondLang;
let sourceWord = "";
+setLangList();
+
+function setLangList() {
+ let langListStr = browser.i18n.getMessage("langList");
+ langListStr = langListStr.split(", ");
+
+ for (let i in langListStr) {
+ langListStr[i] = langListStr[i].split(":");
+ }
+ langListStr = langListStr.sort(alphabeticallySort);
+
+ let langListHtml = "";
+ for (let i of langListStr) {
+ langListHtml += ``
+ }
+
+ langList.innerHTML = langListHtml;
+}
+
+function alphabeticallySort(a, b) {
+ if (a[1].toString() > b[1].toString()) {
+ return 1;
+ } else {
+ return -1;
+ }
+}
+
/*
//Firefoxの仕様上popup.htmlでfocusが効かないため使えない
textarea.focus();