1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

update editor language selection UI for i18n

This commit is contained in:
Hiroyasu Nishiyama 2019-05-27 11:28:36 +09:00
parent c514d988df
commit 7f35e2280e
3 changed files with 33 additions and 2 deletions

View File

@ -929,5 +929,12 @@
"description": "Description",
"appearance": "Appearance",
"env": "Environment Variables"
},
"languages" : {
"de": "German",
"en-US": "English",
"ja": "Japanese",
"ko": "Korean",
"zh-CN": "Chinese(Simplified)"
}
}

View File

@ -42,7 +42,9 @@
"defaultDir": "標準",
"ltr": "左から右",
"rtl": "右から左",
"auto": "文脈"
"auto": "文脈",
"language": "表示言語",
"browserDefault": "ブラウザのデフォルト"
},
"sidebar": {
"show": "サイドバーを表示"
@ -914,5 +916,12 @@
"description": "説明",
"appearance": "外観",
"env": "環境変数"
},
"languages" : {
"de": "ドイツ語",
"en-US": "英語",
"ja": "日本語",
"ko": "韓国語",
"zh-CN": "中国語(簡体)"
}
}

View File

@ -101,10 +101,25 @@ RED.userSettings = (function() {
RED.tray.show(trayOptions);
}
function locale2Name(lc) {
var name = RED._("languages."+lc);
return {text: (name ? name : lc), val: lc};
}
function compText(a, b) {
if (a.text > b.text) {
return 1;
}
if (a.text < b.text) {
return -1;
}
return 0;
}
var viewSettings = [
{
options: [
{setting:"editor-language",local: true, label:"menu.label.view.language",options:function(done){ done([{val:'',text:RED._('menu.label.view.browserDefault')}].concat(RED.settings.theme("languages"))) }},
{setting:"editor-language",local: true, label:"menu.label.view.language",options:function(done){ done([{val:'',text:RED._('menu.label.view.browserDefault')}].concat(RED.settings.theme("languages").map(locale2Name).sort(compText))) }},
]
},{
title: "menu.label.view.grid",