impr: translation file extraction script

This commit is contained in:
283375 2023-10-23 14:39:11 +08:00
parent 51e15c68e0
commit 21ca1018db
Signed by: 283375
SSH Key Fingerprint: SHA256:UcX0qg6ZOSDOeieKPGokA5h7soykG61nz2uxuQgVLSk

View File

@ -1,5 +1,5 @@
import argparse import argparse
import os import subprocess
import sys import sys
from pathlib import Path from pathlib import Path
@ -32,23 +32,31 @@ assert startup.exists()
no_obsolete = args.no_obsolete no_obsolete = args.no_obsolete
commands = [ commands = [
( [
"pyside6-lupdate" "pyside6-lupdate",
" -extensions py,ui" "-extensions",
f" {designer.absolute()} {extends.absolute()} {implements.absolute()} {startup.absolute()}" "py,ui",
f" -ts {str((output_dir_path / 'zh_CN.ts').absolute())}" str(designer.absolute()),
), # zh_CN str(extends.absolute()),
( str(implements.absolute()),
"pyside6-lupdate" str(startup.absolute()),
" -extensions py,ui" "-ts",
f" {designer.absolute()} {extends.absolute()} {implements.absolute()} {startup.absolute()}" str((output_dir_path / "zh_CN.ts").absolute()),
f" -ts {str((output_dir_path / 'en_US.ts').absolute())}" ], # zh_CN
), # en_US [
"pyside6-lupdate",
"-extensions",
"py,ui",
str(designer.absolute()),
str(extends.absolute()),
str(implements.absolute()),
str(startup.absolute()),
"-ts",
str((output_dir_path / "en_US.ts").absolute()),
], # en_US
] ]
if no_obsolete: if no_obsolete:
commands = [f"{command} -no-obsolete" for command in commands] commands = [command.extend(["-no-obsolete"]) for command in commands]
for command in commands: for command in commands:
print(f"Executing '{command}'") subprocess.run(command)
output = os.popen(command).read()
print(output)