summaryrefslogtreecommitdiff
path: root/tools/translations
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2016-05-21 18:57:48 +0200
committerRémi Verschelde <rverschelde@gmail.com>2016-05-21 18:59:27 +0200
commit8d300cc8a85e2f9e8fc710f524b6817c27fc30bb (patch)
treeec669adc8af9b2302272329ebed557d5cdc90388 /tools/translations
parent1c8a447cb652ee332b2add03c9ad1cc571965a36 (diff)
i18n: Disable line numbers in location context
Can be toggled on with --with-line-nb.
Diffstat (limited to 'tools/translations')
-rwxr-xr-xtools/translations/extract.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/tools/translations/extract.py b/tools/translations/extract.py
index 395f2c528a..0ae856344a 100755
--- a/tools/translations/extract.py
+++ b/tools/translations/extract.py
@@ -2,13 +2,25 @@
import fnmatch
import os
-import re
import shutil
import subprocess
+import sys
+
+
+line_nb = False
+
+for arg in sys.argv[1:]:
+ if (arg == "--with-line-nb"):
+ print("Enabling line numbers in the context locations.")
+ line_nb = True
+ else:
+ os.sys.exit("Non supported argument '" + arg + "'. Aborting.")
+
if (not os.path.exists("tools")):
os.sys.exit("ERROR: This script should be started from the root of the git repo.")
+
matches = []
for root, dirnames, filenames in os.walk('.'):
for filename in fnmatch.filter(filenames, '*.cpp'):
@@ -47,7 +59,9 @@ for fname in matches:
msg += l[pos]
pos += 1
- location = os.path.relpath(fname).replace('\\','/') + ":" + str(lc)
+ location = os.path.relpath(fname).replace('\\','/')
+ if (line_nb):
+ location += ":" + str(lc)
if (not msg in unique_str):
main_po += "\n#: " + location + "\n"