i18n: Disable line numbers in location context

Can be toggled on with --with-line-nb.
This commit is contained in:
Rémi Verschelde 2016-05-21 18:57:48 +02:00
parent 1c8a447cb6
commit 8d300cc8a8
1 changed files with 16 additions and 2 deletions

View File

@ -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"