summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2021-02-10 13:30:42 +0100
committerAndras Timar <andras.timar@collabora.com>2021-02-18 09:16:35 +0100
commitac0b14ea8184786b23ae286dfcdf1e5038da0f7f (patch)
tree6eb8bcbf153d912e68a1037a79861dc0557fafee /scripts
parentcommon: add tag string to extract backtrace logs (diff)
downloadonline-ac0b14ea8184786b23ae286dfcdf1e5038da0f7f.tar.gz
online-ac0b14ea8184786b23ae286dfcdf1e5038da0f7f.zip
update unocommands script: don't replace characters
use original names as it is required for pulling translations Change-Id: I0b679d0802afcfacc7db8cb56a08254749811bc1 Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/unocommands.py16
1 files changed, 4 insertions, 12 deletions
diff --git a/scripts/unocommands.py b/scripts/unocommands.py
index 44a1494313..66bf1ea2c3 100755
--- a/scripts/unocommands.py
+++ b/scripts/unocommands.py
@@ -38,12 +38,6 @@ Update the translations of unocommands.js before releasing:
print(message.format(program=sys.argv[0]))
exit(1)
-# Replace characters which are not allowed as keys in JS
-def cleanSpecialCharacters(command):
- clean = re.sub('\.', '_', command)
- clean = re.sub('-', '_', clean)
- return clean
-
def commandsFromLine(line):
"""Extract uno commands name from lines like " 'Command1', 'Command2',"""
commands = []
@@ -308,7 +302,7 @@ def writeUnocommandsJS(
var unoCommandsArray = {\n''')
for key in sorted(descriptions.keys()):
- f.write('\t' + cleanSpecialCharacters(key) + ':{')
+ f.write('\t\'' + key + '\':{')
for type in sorted(descriptions[key].keys()):
f.write(type + ':{')
for menuType in sorted(descriptions[key][type].keys()):
@@ -321,8 +315,6 @@ var unoCommandsArray = {\n''')
window._UNO = function(string, component, isContext) {
\tvar command = string.substr(5);
-\tcommand = command.replace(/\./g, '_');
-\tcommand = command.replace(/\-/g, '_');
\tvar context = 'menu';
\tif (isContext === true) {
\t\tcontext = 'context';
@@ -369,7 +361,7 @@ def parseUnocommandsJS(onlineDir):
f = open(onlineDir + '/loleaflet/src/unocommands.js', 'r',
encoding='utf-8')
for line in f:
- m = re.match(r"\t([^:]*):.*", line)
+ m = re.match(r"\t\'([^:]*)\':.*", line)
if m:
command = m.group(1)
@@ -465,10 +457,10 @@ if __name__ == "__main__":
else:
written = writeUnocommandsJS(onlineDir, lofficeDir, menuCommands,
contextCommands, toolbarCommands)
- processedCommands = set([cleanSpecialCharacters(key) for key in written.keys()])
+ processedCommands = set(written.keys())
# check that we have translations for everything
- requiredCommands = set([cleanSpecialCharacters(key) for key in (menuCommands | contextCommands | toolbarCommands)])
+ requiredCommands = (menuCommands | contextCommands | toolbarCommands)
dif = requiredCommands - processedCommands
if len(dif) > 0: