diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-02-09 12:44:18 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-02-12 13:15:46 +0100 |
commit | 591959285a651110d3057afd64d6ceff746a2b27 (patch) | |
tree | 57d388f0d4d6f21658c95fae2d16ae1b5ce9d3f1 /sources/pyside-tools | |
parent | 1483ff628f4fe657eddcb78d98c348ea132d0955 (diff) |
pyside6-project: Add a build rule for building .qm files from .ts files
[ChangeLog][PySide6] pyside6-project now also builds translation (.qm)
files.
Pick-to: 6.6 6.5
Change-Id: I9863ff3d031499ae7a74c04ec988ca2085a75cfa
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside-tools')
-rw-r--r-- | sources/pyside-tools/project.py | 7 | ||||
-rw-r--r-- | sources/pyside-tools/project/__init__.py | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/sources/pyside-tools/project.py b/sources/pyside-tools/project.py index bb468729a..ff6a4c5d5 100644 --- a/sources/pyside-tools/project.py +++ b/sources/pyside-tools/project.py @@ -27,6 +27,7 @@ from argparse import ArgumentParser, RawTextHelpFormatter from project import (QmlProjectData, check_qml_decorators, is_python_file, QMLDIR_FILE, MOD_CMD, METATYPES_JSON_SUFFIX, + TRANSLATION_SUFFIX, requires_rebuild, run_command, remove_path, ProjectData, resolve_project_file, new_project, ProjectType) @@ -43,6 +44,7 @@ new-quick Creates a new QtQuick project UIC_CMD = "pyside6-uic" RCC_CMD = "pyside6-rcc" +LRELEASE_CMD = "pyside6-lrelease" QMLTYPEREGISTRAR_CMD = "pyside6-qmltyperegistrar" QMLLINT_CMD = "pyside6-qmllint" DEPLOY_CMD = "pyside6-deploy" @@ -133,6 +135,11 @@ class Project: cmd.extend(self._qml_project_data.registrar_options()) return ([qmltypes_file, cpp_file], cmd) + if file.name.endswith(TRANSLATION_SUFFIX): + qm_file = f"{file.parent}/{file.stem}.qm" + cmd = [LRELEASE_CMD, os.fspath(file), "-qm", qm_file] + return ([Path(qm_file)], cmd) + return ([], None) def _regenerate_qmldir(self): diff --git a/sources/pyside-tools/project/__init__.py b/sources/pyside-tools/project/__init__.py index be99555b1..7d28b78cf 100644 --- a/sources/pyside-tools/project/__init__.py +++ b/sources/pyside-tools/project/__init__.py @@ -18,6 +18,7 @@ QML_IMPORT_MINOR_VERSION = "QML_IMPORT_MINOR_VERSION" QT_MODULES = "QT_MODULES" METATYPES_JSON_SUFFIX = "metatypes.json" +TRANSLATION_SUFFIX = ".ts" from .utils import (run_command, requires_rebuild, remove_path, package_dir, qtpaths, qt_metatype_json_dir, resolve_project_file) |