[Libreoffice-commits] online.git: 2 commits - loleaflet/src scripts/unocommands.py

Andras Timar andras.timar at collabora.com
Mon Jul 16 07:04:45 UTC 2018


 loleaflet/src/unocommands.js |   16 +++++++++++-----
 scripts/unocommands.py       |   12 +++++++++---
 2 files changed, 20 insertions(+), 8 deletions(-)

New commits:
commit 3719faf5e91678cda8f470a3975a29bdcfd8dc3f
Author: Andras Timar <andras.timar at collabora.com>
Date:   Mon Jul 16 09:03:40 2018 +0200

    loleaflet: remove latin access keys in parentheses (in case of CJK, Indian, etc. langs)
    
    Change-Id: I15763165535771511a4871882dd067fc689baaa3

diff --git a/loleaflet/src/unocommands.js b/loleaflet/src/unocommands.js
index bb2a12fef..3d877414e 100644
--- a/loleaflet/src/unocommands.js
+++ b/loleaflet/src/unocommands.js
@@ -87,7 +87,7 @@ var unoCommandsArray = {
 	IncrementLevel:{text:{menu:_('Promote One Level'),},},
 	IncrementSubLevels:{text:{menu:_('Promote One Level With Subpoints'),},},
 	InsertAnnotation:{global:{context:_('Insert Comment'),menu:_('Comme~nt'),},presentation:{menu:_('Comme~nt'),},spreadsheet:{context:_('Insert Co~mment'),menu:_('Comm~ent'),},},
-	InsertAuthorField:{presentation:{menu:_('~Author'),},text:{menu:_('First ~Author'),},},
+	InsertAuthorField:{presentation:{menu:_('~Author'),},text:{menu:_('~Author'),},},
 	InsertBreakMenu:{spreadsheet:{menu:_('Insert Page ~Break'),},},
 	InsertColumnBreak:{spreadsheet:{menu:_('~Column Break'),},text:{menu:_('Insert Column Break'),},},
 	InsertColumnsAfter:{presentation:{menu:_('Insert Column Right'),},spreadsheet:{context:_('Insert Columns ~Right'),menu:_('Columns ~Right'),},text:{menu:_('Columns R~ight'),},},
@@ -105,7 +105,7 @@ var unoCommandsArray = {
 	InsertMenu:{global:{menu:_('~Insert'),},},
 	InsertNeutralParagraph:{text:{menu:_('Insert Unnumbered Entry'),},},
 	InsertNonBreakingSpace:{global:{menu:_('~Non-breaking space'),},},
-	InsertObjectChart:{global:{menu:_('~Chart...')}},
+	InsertObjectChart:{global:{context:_('Insert Chart'),menu:_('~Chart...'),},},
 	InsertPageCountField:{text:{menu:_('Page ~Count'),},},
 	InsertPageFooter:{text:{menu:_('Foote~r'),},},
 	InsertPageHeader:{text:{menu:_('He~ader'),},},
@@ -229,14 +229,14 @@ var unoCommandsArray = {
 	TrackChanges:{text:{menu:_('~Record'),},},
 	TransformDialog:{global:{menu:_('Position and Si~ze...'),},},
 	Underline:{global:{menu:_('Underline'),},},
-	UnderlineDouble:{global:{menu:_('Double Underline'),},},
+	UnderlineDouble:{presentation:{menu:_('Double Underline '),},spreadsheet:{menu:_('Underline: Double'),},text:{menu:_('Double Underline '),},},
 	Undo:{global:{menu:_('~Undo'),},},
 	Ungroup:{global:{menu:_('~Ungroup...'),},},
 	UpSearch:{global:{menu:_('Find Previous'),},},
 	UpdateCurIndex:{text:{context:_('Update index'),menu:_('Current ~Index'),},},
 	Validation:{spreadsheet:{menu:_('~Validity...'),},},
 	ViewMenu:{global:{menu:_('~View'),},},
-	WordCountDialog:{text:{menu:_('~Word Count...'),},},
+	WordCountDialog:{text:{menu:_('~Word Count'),},},
 	WrapAnchorOnly:{text:{menu:_('~First Paragraph'),},},
 	WrapContour:{text:{menu:_('~Contour'),},},
 	WrapIdeal:{text:{menu:_('~Optimal Page Wrap'),},},
@@ -277,5 +277,11 @@ window._UNO = function(string, component, isContext) {
 		}
 	}
 
-	return text.replace('~', '');
+	// Remove access key markers from translated strings
+	// 1. access key in parenthesis in case of non-latin scripts
+	text = text.replace(/\(~[A-Za-z]\)/, '');
+	// 2. remove normal access key
+	text = text.replace('~', '');
+
+	return text;
 }
diff --git a/scripts/unocommands.py b/scripts/unocommands.py
index 8acb55355..88e7ea24c 100755
--- a/scripts/unocommands.py
+++ b/scripts/unocommands.py
@@ -243,7 +243,13 @@ window._UNO = function(string, component, isContext) {
 \t\t}
 \t}
 
-\treturn text.replace('~', '');
+\t// Remove access key markers from translated strings
+\t// 1. access key in parenthesis in case of non-latin scripts
+\ttext = text.replace(/\(~[A-Za-z]\)/, '');
+\t// 2. remove normal access key
+\ttext = text.replace('~', '');
+
+\treturn text;
 }\n''')
 
     return descriptions
commit d239a3b3736b63be03b49c2fa361c5571e91759f
Author: Andras Timar <andras.timar at collabora.com>
Date:   Thu Jul 12 23:39:45 2018 +0200

    adjust paths of toolbar.js and unocommands.js
    
    Change-Id: I0373f1a05d18a85d5e351fd11bf3b81c43367279

diff --git a/scripts/unocommands.py b/scripts/unocommands.py
index 808887da3..8acb55355 100755
--- a/scripts/unocommands.py
+++ b/scripts/unocommands.py
@@ -122,7 +122,7 @@ def extractToolbarCommands(path):
     commands = []
 
     # extract from the menu specifications
-    f = open(path + '/loleaflet/dist/toolbar/toolbar.js', 'r')
+    f = open(path + '/loleaflet/js/toolbar.js', 'r')
     for line in f:
         if line.find("_UNO(") >= 0:
             commands += commandFromMenuLine(line)
@@ -201,7 +201,7 @@ def writeUnocommandsJS(onlineDir, lofficeDir, menuCommands, contextCommands, too
             descriptions = collectCommandsFromXCU(os.path.join(dir, file), descriptions, toolbarCommands, 'Label', type)
 
     # output the unocommands.js
-    f = open(onlineDir + '/loleaflet/unocommands.js', 'w')
+    f = open(onlineDir + '/loleaflet/src/unocommands.js', 'w')
     f.write('''// Don't modify, generated using unocommands.py
 
 var unoCommandsArray = {\n''')


More information about the Libreoffice-commits mailing list