From 3e75db0d58caeb8f0ec4e58c63cdae0c41e381f7 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Sat, 1 Jan 2022 15:20:43 -0600 Subject: [PATCH] Tools: Add workaround for lupdate missing source lupdate requires at least one C++ source file to be present in order to process the project file. In cases where a workbench is Python-only, this resulted in incorrect or missing extraction of strings in ui files. Those files should have been processed by lupdate, but were not. pyludate was not configured to process them. To work around this, the updatets.py script is modified to create a dummy *.cpp file before running qmake. --- src/Tools/updatets.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Tools/updatets.py b/src/Tools/updatets.py index 0c344e6f1f..97e14cff1f 100755 --- a/src/Tools/updatets.py +++ b/src/Tools/updatets.py @@ -153,6 +153,7 @@ def update_translation(entry): tsBasename = os.path.join(entry["tsdir"],entry["tsname"]) execline = [] + execline.append (f"touch dummy_cpp_file_for_lupdate.cpp") #lupdate requires at least one source file to process the UI files execline.append (f"{QMAKE} -project -o {project_filename}") execline.append (f"sed 's/.*<\/translation>/<\/translation>/g' {tsBasename}.ts > {tsBasename}.ts.temp") execline.append (f"touch {tsBasename}.ts") # In case it didn't get created above @@ -161,6 +162,7 @@ def update_translation(entry): execline.append (f"{PYLUPDATE} `find ./ -name \"*.py\"` -ts {tsBasename}py.ts {log_redirect}") 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']}:") for line in execline: print (line)