[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-3-0' - loleaflet/dist

Andras Timar andras.timar at collabora.com
Tue Jan 2 14:04:44 UTC 2018


 loleaflet/dist/toolbar/toolbar.js |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 26f1889dc11d357bc980bd60ed83dd8a5f016479
Author: Andras Timar <andras.timar at collabora.com>
Date:   Wed Dec 27 22:17:22 2017 +0100

    localize StateTableCell status bar string (Sum, Average, Count, etc.)
    
    Change-Id: Ie4d6197115f8f8290f1d6f8608acf2e3e3642c79
    Reviewed-on: https://gerrit.libreoffice.org/47109
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js
index 35fc4f35..aae417c2 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -707,6 +707,20 @@ var userJoinedPopupMessage = '<div>' + _('%user has joined') + '</div>';
 var userLeftPopupMessage = '<div>' + _('%user has left') + '</div>';
 var userPopupTimeout = null;
 
+function localizeStateTableCell (text) {
+	var stateArray = text.split(';');
+	var stateArrayLength = stateArray.length;
+	var localizedText = '';
+	for (var i = 0; i < stateArrayLength; i++) {
+		var labelValuePair = stateArray[i].split(':');
+		localizedText += _(labelValuePair[0].trim()) + ':' + labelValuePair[1];
+		if (stateArrayLength > 1 && i < stateArrayLength - 1) {
+			localizedText += '; ';
+		}
+	}
+	return localizedText;
+}
+
 function toLocalePattern (pattern, regex, text, sub1, sub2) {
 	var matches = new RegExp(regex, 'g').exec(text);
 	if (matches) {
@@ -1275,7 +1289,7 @@ map.on('commandstatechanged', function (e) {
 		updateToolbarItem(statusbar, 'StatusSelectionMode', $('#StatusSelectionMode').html(state ? L.Styles.selectionMode[state].toLocaleString() : '    &nbsp').parent().html());
 	}
 	else if (commandName == '.uno:StateTableCell') {
-		updateToolbarItem(statusbar, 'StateTableCell', $('#StateTableCell').html(state ? state : '    &nbsp').parent().html());
+		updateToolbarItem(statusbar, 'StateTableCell', $('#StateTableCell').html(state ? localizeStateTableCell(state) : '    &nbsp').parent().html());
 	}
 	else if (commandName === '.uno:StatusBarFunc') {
 		if (state) {


More information about the Libreoffice-commits mailing list