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

Merge pull request #2175 from node-red-hitachi/update-language-selector

update editor language selection UI for i18n
This commit is contained in:
Nick O'Leary 2019-05-28 13:26:38 +01:00 committed by GitHub
commit 3b3a2d62f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 2 deletions

View File

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

View File

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

View File

@ -101,10 +101,19 @@ RED.userSettings = (function() {
RED.tray.show(trayOptions); RED.tray.show(trayOptions);
} }
function localeToName(lc) {
var name = RED._("languages."+lc);
return {text: (name ? name : lc), val: lc};
}
function compText(a, b) {
return a.text.localeCompare(b.text);
}
var viewSettings = [ var viewSettings = [
{ {
options: [ 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(localeToName).sort(compText))) }},
] ]
},{ },{
title: "menu.label.view.grid", title: "menu.label.view.grid",