fix function name & string compare function

This commit is contained in:
Hiroyasu Nishiyama 2019-05-28 08:55:00 +09:00
parent 7f35e2280e
commit 10da894124
1 changed files with 3 additions and 9 deletions

View File

@ -101,25 +101,19 @@ RED.userSettings = (function() {
RED.tray.show(trayOptions); RED.tray.show(trayOptions);
} }
function locale2Name(lc) { function localeToName(lc) {
var name = RED._("languages."+lc); var name = RED._("languages."+lc);
return {text: (name ? name : lc), val: lc}; return {text: (name ? name : lc), val: lc};
} }
function compText(a, b) { function compText(a, b) {
if (a.text > b.text) { return a.text.localeCompare(b.text);
return 1;
}
if (a.text < b.text) {
return -1;
}
return 0;
} }
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").map(locale2Name).sort(compText))) }}, {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",