Tools: Allow to treat one single module with updatets script

This commit is contained in:
Yorik van Havre
2022-02-17 13:35:47 +01:00
parent 18ab2c80fb
commit e24da8dd94

View File

@@ -50,7 +50,7 @@ Version:
0.4
"""
import os, re
import os, re, sys
directories = [
{"tsname":"FreeCAD", "workingdir":"./src/Gui", "tsdir":"Language"},
@@ -163,7 +163,7 @@ def update_translation(entry):
execline.append (f"{LCONVERT} -i {tsBasename}py.ts {tsBasename}.ts -o {tsBasename}.ts {log_redirect}")
execline.append (f"rm {tsBasename}py.ts")
execline.append (f"rm dummy_cpp_file_for_lupdate.cpp")
print(f"Executing special commands in {entry['workingdir']}:")
print(f"Executing commands in {entry['workingdir']}:")
for line in execline:
print (line)
os.system(line)
@@ -177,7 +177,7 @@ def update_translation(entry):
os.chdir(cur)
def main():
def main(mod=None):
find_tools()
path = os.path.realpath(__file__)
@@ -186,11 +186,21 @@ def main():
os.chdir("..")
os.chdir("..")
print("\n\n\n BEGINNING TRANSLATION EXTRACTION \n\n")
for i in directories:
update_translation(i)
if mod:
for i in directories:
if i["tsname"] == mod:
print("WARNING - Updating",mod,"ONLY")
update_translation(i)
break
else:
for i in directories:
update_translation(i)
print("\nIf updatets.py was run successfully, the next step is to run ./src/Tools/updatecrowdin.py")
print("stderr output from lupdate can be found in tsupdate_stderr.log")
print("stdout output from lupdate can be found in tsupdate_stdout.log")
if __name__ == "__main__":
main()
if len(sys.argv[1:]) > 0:
main(sys.argv[1])
else:
main()