diff options
Diffstat (limited to 'tools/translations')
-rwxr-xr-x | tools/translations/extract.py | 18 |
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" |