[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-2-1' - loleaflet/src
Henry Castro
hcastro at collabora.com
Tue Nov 7 10:21:07 UTC 2017
loleaflet/src/control/Control.Menubar.js | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
New commits:
commit e54f6d54af0b4c378395e42b651a6caafa4c62f4
Author: Henry Castro <hcastro at collabora.com>
Date: Mon Nov 6 17:25:19 2017 -0400
loleaflet: sort translated languages
Change-Id: I35a7fc447939796eb33e4a8fd2df3631ec6db1ae
Reviewed-on: https://gerrit.libreoffice.org/44378
Reviewed-by: pranavk <pranavk at collabora.co.uk>
Tested-by: pranavk <pranavk at collabora.co.uk>
diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index c31f6edb..956454d8 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -365,14 +365,25 @@ L.Control.Menubar = L.Control.extend({
_onInitMenu: function (e) {
if (e.commandName === '.uno:LanguageStatus' && L.Util.isArray(e.commandValues)) {
- var resetLang = _('Reset to Default Language');
+ var resetLang = _('Reset to Default Language'), translated, neutral;
+ var languages = [];
+
+ e.commandValues.forEach(function(language) {
+ languages.push({translated: _(language), neutral: language});
+ });
+ languages.sort(function(a, b) {
+ return a.translated < b.translated ? -1 : a.translated > b.translated ? 1 : 0;
+ });
+
$menuSelection = $('#menu-noneselection').parent();
$menuParagraph = $('#menu-noneparagraph').parent();
$menuDefault = $('#menu-nonelanguage').parent();
- for (var lang in e.commandValues) {
- $menuSelection.append(this._createLangMenuItem(_(e.commandValues[lang]), encodeURIComponent('Current_' + e.commandValues[lang])));
- $menuParagraph.append(this._createLangMenuItem(_(e.commandValues[lang]), encodeURIComponent('Paragraph_' + e.commandValues[lang])));
- $menuDefault.append(this._createLangMenuItem(_(e.commandValues[lang]), encodeURIComponent('Default_' + e.commandValues[lang])));
+ for (var lang in languages) {
+ translated = languages[lang].translated;
+ neutral = languages[lang].neutral;
+ $menuSelection.append(this._createLangMenuItem(translated, encodeURIComponent('Current_' + neutral)));
+ $menuParagraph.append(this._createLangMenuItem(translated, encodeURIComponent('Paragraph_' + neutral)));
+ $menuDefault.append(this._createLangMenuItem(translated, encodeURIComponent('Default_' + neutral)));
}
$menuSelection.append(this._createMenu([{type: 'separator'}]));
$menuParagraph.append(this._createMenu([{type: 'separator'}]));
More information about the Libreoffice-commits
mailing list