Sort available languages by their translated names

This commit is contained in:
Ghassen Rjab 2017-06-18 17:21:46 +01:00
parent cdddf42847
commit a9dde296bf
2 changed files with 22 additions and 6 deletions

View file

@ -20,9 +20,17 @@ Template.userFormsLayout.onRendered(() => {
Template.userFormsLayout.helpers({ Template.userFormsLayout.helpers({
languages() { languages() {
return _.map(TAPi18n.getLanguages(), (lang, tag) => { return _.map(TAPi18n.getLanguages(), (lang, code) => {
const name = lang.name; return {
return { tag, name }; tag: code,
name: lang.name,
};
}).sort(function(a, b) {
if (a.name === b.name) {
return 0;
} else {
return a.name > b.name ? 1 : -1;
}
}); });
}, },

View file

@ -72,9 +72,17 @@ Template.changePasswordPopup.onRendered(function() {
Template.changeLanguagePopup.helpers({ Template.changeLanguagePopup.helpers({
languages() { languages() {
return _.map(TAPi18n.getLanguages(), (lang, tag) => { return _.map(TAPi18n.getLanguages(), (lang, code) => {
const name = lang.name; return {
return { tag, name }; tag: code,
name: lang.name,
};
}).sort(function(a, b) {
if (a.name === b.name) {
return 0;
} else {
return a.name > b.name ? 1 : -1;
}
}); });
}, },