From e0114fcccf52319c008f47bc5cadc99ce9971c53 Mon Sep 17 00:00:00 2001 From: MariMakes <40423138+MariMakes@users.noreply.github.com> Date: Thu, 16 Nov 2023 13:29:02 +0100 Subject: [PATCH 1/8] Update Leben to Legen Should fix https://github.com/Ultimaker/Cura/issues/17317 --- resources/i18n/de_DE/uranium.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/i18n/de_DE/uranium.po b/resources/i18n/de_DE/uranium.po index cded91091..d0c2deacc 100644 --- a/resources/i18n/de_DE/uranium.po +++ b/resources/i18n/de_DE/uranium.po @@ -158,7 +158,7 @@ msgstr "Flach" msgctxt "@label" msgid "Laying object flat on buildplate..." -msgstr "Objekt flach auf die Druckplatte leben..." +msgstr "Objekt flach auf die Druckplatte legen..." msgctxt "@action:button" msgid "Learn more" From 6e9ecaf48b66393d7b0b0ff423069ecc4b919f6d Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Fri, 24 Nov 2023 10:18:10 +0100 Subject: [PATCH 2/8] Use conf to get i18n options This will give us more finegrained control if we want the pot files extracted or build the mo files Contributes to CURA-11300 --- conanfile.py | 50 ++++++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/conanfile.py b/conanfile.py index 42d3ace69..5a8d39a5f 100644 --- a/conanfile.py +++ b/conanfile.py @@ -26,16 +26,22 @@ class UraniumConan(ConanFile): python_requires_extend = "umbase.UMBaseConanfile" options = { - "devtools": [True, False] + "devtools": [True, False], + "enable_i18n": [True, False], } default_options = { "devtools": False, + "enable_i18n": False, } def set_version(self): if not self.version: self.version = "5.6.0-beta.1" + @property + def _i18n_options(self): + return self.conf.get("user.i18n:options", default = {"extract": True, "build": True}, check_type = dict) + @property def _base_dir(self): if self.install_folder is None: @@ -85,6 +91,10 @@ def export_sources(self): copy(self, "requirements.txt", self.recipe_folder, self.export_sources_folder) copy(self, "requirements-dev.txt", self.recipe_folder, self.export_sources_folder) + def config_options(self): + if self.settings.os == "Windows" and not self.conf.get("tools.microsoft.bash:path", check_type = str): + del self.options.enable_i18n + def configure(self): self.options["pyarcus"].shared = True self.options["cpython"].shared = True @@ -99,35 +109,31 @@ def requirements(self): self.requires("cpython/3.10.4") def build_requirements(self): - if self.options.devtools: - 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 - self.tool_requires("gettext/0.21@ultimaker/testing", force_host_context = True) + if self.options.get_safe("enable_i18n", False): + self.tool_requires("gettext/0.21@ultimaker/testing", force_host_context = True) def generate(self): vr = VirtualRunEnv(self) vr.generate() - if self.options.devtools: - if self.settings.os != "Windows" or self.conf.get("tools.microsoft.bash:path", check_type=str): - vb = VirtualBuildEnv(self) - vb.generate() + if self.options.get_safe("enable_i18n", False) and self._i18n_options["extract"]: + vb = VirtualBuildEnv(self) + vb.generate() - # 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, cpp_info.bindirs[0]) - pot.generate() + # 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, cpp_info.bindirs[0]) + pot.generate() def build(self): - if self.options.devtools: - 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 - for po_file in self.source_path.joinpath("resources", "i18n").glob("**/*.po"): - mo_file = Path(self.build_folder, po_file.with_suffix('.mo').relative_to(self.source_path)) - mo_file = mo_file.parent.joinpath("LC_MESSAGES", mo_file.name) - mkdir(self, str(unix_path(self, Path(mo_file).parent))) - cpp_info = self.dependencies["gettext"].cpp_info - self.run(f"{cpp_info.bindirs[0]}/msgfmt {po_file} -o {mo_file} -f", env="conanbuild", ignore_errors=True) + if self.options.get_safe("enable_i18n", False) and self._i18n_options["build"]: + # FIXME: once m4, autoconf, automake are Conan V2 ready use self.win_bash and add gettext as base tool_requirement + for po_file in self.source_path.joinpath("resources", "i18n").glob("**/*.po"): + mo_file = Path(self.build_folder, po_file.with_suffix('.mo').relative_to(self.source_path)) + mo_file = mo_file.parent.joinpath("LC_MESSAGES", mo_file.name) + mkdir(self, str(unix_path(self, Path(mo_file).parent))) + cpp_info = self.dependencies["gettext"].cpp_info + self.run(f"{cpp_info.bindirs[0]}/msgfmt {po_file} -o {mo_file} -f", env="conanbuild", ignore_errors=True) def layout(self): self.folders.source = "." From cfafed39ba8c73fb5a938ffc146cd2674c65868c Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Fri, 24 Nov 2023 12:59:45 +0100 Subject: [PATCH 3/8] Use updated translation tools These also take bundled plugin settings into account Contribute to CURA-11300 --- conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conanfile.py b/conanfile.py index 5a8d39a5f..f0e3ea423 100644 --- a/conanfile.py +++ b/conanfile.py @@ -22,7 +22,7 @@ class UraniumConan(ConanFile): exports = "LICENSE*" settings = "os", "compiler", "build_type", "arch" - python_requires = "umbase/[>=0.1.7]@ultimaker/stable", "translationextractor/[>=2.1.2]@ultimaker/stable" + python_requires = "umbase/[>=0.1.7]@ultimaker/stable", "translationextractor/[>=2.2.0]@ultimaker/stable" python_requires_extend = "umbase.UMBaseConanfile" options = { From 632de113078217cabe2ed3f310f3eb05b35165c0 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Mon, 27 Nov 2023 13:49:45 +0100 Subject: [PATCH 4/8] Fix german translation fixes #17317 CURA-11350 --- resources/i18n/de_DE/uranium.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/i18n/de_DE/uranium.po b/resources/i18n/de_DE/uranium.po index cded91091..d0c2deacc 100644 --- a/resources/i18n/de_DE/uranium.po +++ b/resources/i18n/de_DE/uranium.po @@ -158,7 +158,7 @@ msgstr "Flach" msgctxt "@label" msgid "Laying object flat on buildplate..." -msgstr "Objekt flach auf die Druckplatte leben..." +msgstr "Objekt flach auf die Druckplatte legen..." msgctxt "@action:button" msgid "Learn more" From 779ec0dc9b11d6f7cbba2166593aa9968cdc65b4 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Tue, 28 Nov 2023 17:30:14 +0100 Subject: [PATCH 5/8] Use CCI gettext Contributes to CURA-10831 --- conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conanfile.py b/conanfile.py index f0e3ea423..e8a59310f 100644 --- a/conanfile.py +++ b/conanfile.py @@ -110,7 +110,7 @@ def requirements(self): def build_requirements(self): if self.options.get_safe("enable_i18n", False): - self.tool_requires("gettext/0.21@ultimaker/testing", force_host_context = True) + self.tool_requires("gettext/0.21", force_host_context = True) def generate(self): vr = VirtualRunEnv(self) From 0a44370d491e58b1007f7ab8109a9b08ccee37e2 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Thu, 30 Nov 2023 13:42:48 +0100 Subject: [PATCH 6/8] Don't open file on open file event CURA-11288 --- UM/FileHandler/ReadFileJob.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/UM/FileHandler/ReadFileJob.py b/UM/FileHandler/ReadFileJob.py index 24bbb8dcd..ac137d3bb 100644 --- a/UM/FileHandler/ReadFileJob.py +++ b/UM/FileHandler/ReadFileJob.py @@ -37,12 +37,16 @@ def run(self) -> None: return None reader = self._handler.getReaderForFile(self._filename) if not reader: - result_message = Message(i18n_catalog.i18nc("@info:status Don't translate the XML tag !", - "Cannot open files of the type of {0}", - self._filename), - lifetime = 0, - title = i18n_catalog.i18nc("@info:title", "Invalid File"), - message_type = Message.MessageType.ERROR) + result_message = Message( + i18n_catalog.i18nc( + "@info:status Don't translate the XML tag !", + "Cannot open files of the type of {0}", + self._filename + ), + lifetime=0, + title=i18n_catalog.i18nc("@info:title", "Invalid File"), + message_type=Message.MessageType.ERROR, + ) result_message.show() return From b4b8a9a2d09142dc9c6e8357f4c1b59caab0cdcc Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Thu, 30 Nov 2023 17:20:36 +0100 Subject: [PATCH 7/8] Bump version --- conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conanfile.py b/conanfile.py index e8a59310f..f2732615e 100644 --- a/conanfile.py +++ b/conanfile.py @@ -36,7 +36,7 @@ class UraniumConan(ConanFile): def set_version(self): if not self.version: - self.version = "5.6.0-beta.1" + self.version = "5.7.0-alpha" @property def _i18n_options(self): From 5059eb86cf99dac0cac7d7ce9a3869832c865c9f Mon Sep 17 00:00:00 2001 From: jellespijker Date: Fri, 1 Dec 2023 16:18:43 +0100 Subject: [PATCH 8/8] Use process-pull-request workflow Contribute to CURA-10831 --- .github/workflows/process-pull-request.yml | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/.github/workflows/process-pull-request.yml b/.github/workflows/process-pull-request.yml index 56fb015b9..f34e26f13 100644 --- a/.github/workflows/process-pull-request.yml +++ b/.github/workflows/process-pull-request.yml @@ -1,15 +1,11 @@ name: process-pull-request on: - pull_request_target: - types: [opened, reopened, edited, synchronize, review_requested, ready_for_review, assigned] + pull_request_target: + types: [ opened, reopened, edited, review_requested, ready_for_review, assigned ] +# FIXME: Use `main` instead of `CURA-10831` once merged jobs: - add_label: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-ecosystem/action-add-labels@v1 - if: ${{ github.event.pull_request.head.repo.full_name != github.repository }} - with: - labels: 'PR: Community Contribution :crown:' + add_label: + uses: ultimaker/cura-workflows/.github/workflows/process-pull-request.yml@CURA-10831 + secrets: inherit \ No newline at end of file