Use translationextractor 1.1.0

Contribute to CURA-10208
This commit is contained in:
jspijker 2023-03-06 16:55:18 +01:00
parent c3b6cf8862
commit f2dd3154e4

View file

@ -27,7 +27,7 @@ class CuraConan(ConanFile):
# FIXME: Remove specific branch once merged to main # FIXME: Remove specific branch once merged to main
# Extending the conanfile with the UMBaseConanfile https://github.com/Ultimaker/conan-ultimaker-index/tree/CURA-9177_Fix_CI_CD/recipes/umbase # Extending the conanfile with the UMBaseConanfile https://github.com/Ultimaker/conan-ultimaker-index/tree/CURA-9177_Fix_CI_CD/recipes/umbase
python_requires = "umbase/[>=0.1.7]@ultimaker/stable" python_requires = "umbase/[>=0.1.7]@ultimaker/stable", "translationextractor/[>=1.1.0]@ultimaker/stable"
python_requires_extend = "umbase.UMBaseConanfile" python_requires_extend = "umbase.UMBaseConanfile"
options = { options = {
@ -327,19 +327,14 @@ class CuraConan(ConanFile):
icon_path = "'{}'".format(os.path.join(self.source_folder, "packaging", self.conan_data["pyinstaller"]["icon"][str(self.settings.os)])).replace("\\", "\\\\"), icon_path = "'{}'".format(os.path.join(self.source_folder, "packaging", self.conan_data["pyinstaller"]["icon"][str(self.settings.os)])).replace("\\", "\\\\"),
entitlements_file = entitlements_file if self.settings.os == "Macos" else "None") entitlements_file = entitlements_file if self.settings.os == "Macos" else "None")
# Update the po files # Update the po and pot files
if self.settings.os != "Windows" or self.conf.get("tools.microsoft.bash:path", check_type=str): if self.settings.os != "Windows" or self.conf.get("tools.microsoft.bash:path", check_type=str):
vb = VirtualBuildEnv(self) vb = VirtualBuildEnv(self)
vb.generate() vb.generate()
# FIXME: once m4, autoconf, automake are Conan V2 ready use self.win_bash and add gettext as base tool_requirement # FIXME: once m4, autoconf, automake are Conan V2 ready use self.win_bash and add gettext as base tool_requirement
cpp_info = self.dependencies["gettext"].cpp_info pot = self.python_requires["translationextractor"].module.ExtractTranslations(self, os.path.join(self.source_folder, "resources", "i18n"), "cura.pot")
for po_file in self.source_path.joinpath("resources", "i18n").glob("**/*.po"): pot.generate()
pot_file = self.source_path.joinpath("resources", "i18n", po_file.with_suffix('.pot').name)
mkdir(self, str(unix_path(self, pot_file.parent)))
self.run(
f"{cpp_info.bindirs[0]}/msgmerge --no-wrap --no-fuzzy-matching --sort-by-file -o {po_file} {po_file} {pot_file}",
env="conanbuild", ignore_errors=True)
def build(self): def build(self):
if self.options.devtools: if self.options.devtools: