Skip to content

Commit

Permalink
Merge branch 'main' into CURA-10831
Browse files Browse the repository at this point in the history
# Conflicts:
#	conanfile.py
  • Loading branch information
jellespijker committed Dec 1, 2023
2 parents 827bfaa + 5059eb8 commit 7e5f97a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 24 deletions.
16 changes: 6 additions & 10 deletions .github/workflows/process-pull-request.yml
Original file line number Diff line number Diff line change
@@ -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
16 changes: 10 additions & 6 deletions UM/FileHandler/ReadFileJob.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <filename>!",
"Cannot open files of the type of <filename>{0}</filename>",
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 <filename>!",
"Cannot open files of the type of <filename>{0}</filename>",
self._filename
),
lifetime=0,
title=i18n_catalog.i18nc("@info:title", "Invalid File"),
message_type=Message.MessageType.ERROR,
)
result_message.show()
return

Expand Down
18 changes: 11 additions & 7 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

required_conan_version = ">=1.58.0 <2.0.0"


class UraniumConan(ConanFile):
name = "uranium"
license = "LGPL-3.0"
Expand All @@ -36,6 +37,10 @@ def set_version(self):
if not self.version:
self.version = self.conan_data["version"]

@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:
Expand Down Expand Up @@ -89,7 +94,7 @@ def export_sources(self):
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):
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):
Expand All @@ -104,28 +109,27 @@ def validate(self):
def requirements(self):
for req in self.conan_data["requirements"]:
self.requires(req)
self.requires("cpython/3.10.4")
self.requires("cpython/3.10.4@ultimaker/stable")

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)
vr.generate()

if self.options.get_safe("enable_i18n", False):
# Update the po and pot files
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
# 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.get_safe("enable_i18n", False):
if self.options.get_safe("enable_i18n", False) and self._i18n_options["build"]:
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)
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/de_DE/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 7e5f97a

Please sign in to comment.