Merge pull request #14340 from Ultimaker/CURA-9814_automate_extracting_strings

[CURA-9814] automate extracting strings
This commit is contained in:
Casper Lamboo 2023-02-01 15:08:15 +01:00 committed by GitHub
commit b9f09e1122
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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.0.0]@ultimaker/stable"
python_requires_extend = "umbase.UMBaseConanfile" python_requires_extend = "umbase.UMBaseConanfile"
options = { options = {
@ -326,12 +326,9 @@ class CuraConan(ConanFile):
# Update the po files # Update the po 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):
# 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 # Extract all the new strings and update the existing po files
for po_file in self.source_path.joinpath("resources", "i18n").glob("**/*.po"): extractTool = self.python_requires["translationextractor"].module.ExtractTranslations(self, self.source_path.joinpath("resources", "i18n"), "cura.pot")
pot_file = self.source_path.joinpath("resources", "i18n", po_file.with_suffix('.pot').name) extractTool.generate()
mkdir(self, str(unix_path(self, pot_file.parent)))
self.run(f"{cpp_info.bindirs[0]}/msgmerge --no-wrap --no-fuzzy-matching -width=140 -o {po_file} {po_file} {pot_file}",
env = "conanbuild", ignore_errors = True)
def imports(self): def imports(self):
self.copy("CuraEngine.exe", root_package = "curaengine", src = "@bindirs", dst = "", keep_path = False) self.copy("CuraEngine.exe", root_package = "curaengine", src = "@bindirs", dst = "", keep_path = False)