mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-22 06:03:57 -06:00
Give translations their own option
Only available on bash/zsh environments Contributes to CURA-10561 - CURA-11117
This commit is contained in:
parent
4b7cefa891
commit
872ce27d8a
1 changed files with 23 additions and 21 deletions
18
conanfile.py
18
conanfile.py
|
@ -34,7 +34,8 @@ class CuraConan(ConanFile):
|
||||||
"cloud_api_version": "ANY",
|
"cloud_api_version": "ANY",
|
||||||
"display_name": "ANY", # TODO: should this be an option??
|
"display_name": "ANY", # TODO: should this be an option??
|
||||||
"cura_debug_mode": [True, False], # FIXME: Use profiles
|
"cura_debug_mode": [True, False], # FIXME: Use profiles
|
||||||
"internal": [True, False]
|
"internal": [True, False],
|
||||||
|
"enable_i18n": [True, False],
|
||||||
}
|
}
|
||||||
default_options = {
|
default_options = {
|
||||||
"enterprise": "False",
|
"enterprise": "False",
|
||||||
|
@ -44,6 +45,7 @@ class CuraConan(ConanFile):
|
||||||
"display_name": "UltiMaker Cura",
|
"display_name": "UltiMaker Cura",
|
||||||
"cura_debug_mode": False, # Not yet implemented
|
"cura_debug_mode": False, # Not yet implemented
|
||||||
"internal": False,
|
"internal": False,
|
||||||
|
"enable_i18n": False,
|
||||||
}
|
}
|
||||||
|
|
||||||
def set_version(self):
|
def set_version(self):
|
||||||
|
@ -271,6 +273,10 @@ class CuraConan(ConanFile):
|
||||||
copy(self, "requirements-ultimaker.txt", self.recipe_folder, self.export_sources_folder)
|
copy(self, "requirements-ultimaker.txt", self.recipe_folder, self.export_sources_folder)
|
||||||
copy(self, "cura_app.py", self.recipe_folder, self.export_sources_folder)
|
copy(self, "cura_app.py", 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):
|
def configure(self):
|
||||||
self.options["pyarcus"].shared = True
|
self.options["pyarcus"].shared = True
|
||||||
self.options["pysavitar"].shared = True
|
self.options["pysavitar"].shared = True
|
||||||
|
@ -307,9 +313,7 @@ class CuraConan(ConanFile):
|
||||||
self.requires("fdm_materials/(latest)@ultimaker/testing")
|
self.requires("fdm_materials/(latest)@ultimaker/testing")
|
||||||
|
|
||||||
def build_requirements(self):
|
def build_requirements(self):
|
||||||
if self.options.devtools:
|
if self.options.get_safe("enable_i18n", False):
|
||||||
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)
|
self.tool_requires("gettext/0.21@ultimaker/testing", force_host_context = True)
|
||||||
|
|
||||||
def layout(self):
|
def layout(self):
|
||||||
|
@ -377,8 +381,8 @@ 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")
|
||||||
|
|
||||||
|
if self.options.get_safe("enable_i18n", False):
|
||||||
# Update the po and pot files
|
# Update the po and pot files
|
||||||
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()
|
||||||
|
|
||||||
|
@ -388,9 +392,7 @@ class CuraConan(ConanFile):
|
||||||
pot.generate()
|
pot.generate()
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
if self.options.devtools:
|
if self.options.get_safe("enable_i18n", False):
|
||||||
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"):
|
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 = 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)
|
mo_file = mo_file.parent.joinpath("LC_MESSAGES", mo_file.name)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue