From 82ed547a471dec3c53da277fbcaa0084c459e963 Mon Sep 17 00:00:00 2001 From: janezd Date: Fri, 4 Oct 2024 17:42:39 +0200 Subject: [PATCH] Setup: Apply trubar when installing --- pyproject.toml | 1 + setup.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 1d45cca96f5..f77c2f15103 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,6 +6,7 @@ requires = [ "setuptools>=51.0", "sphinx", "wheel", + "trubar>=0.3.3" ] build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index 6e65eafd118..83fe1f83cf8 100755 --- a/setup.py +++ b/setup.py @@ -4,6 +4,7 @@ import sys import subprocess from setuptools import setup, find_packages, Command +from setuptools.command.install import install from distutils.command import install_data, sdist from distutils.command.build_ext import build_ext @@ -473,9 +474,25 @@ def ext_modules(): return modules +class InstallMultilingualCommand(install): + def run(self): + super().run() + self.compile_to_multilingual() + + def compile_to_multilingual(self): + from trubar import translate + + package_dir = os.path.dirname(os.path.abspath(__file__)) + translate( + "msgs.jaml", + source_dir=os.path.join(self.install_lib, "Orange"), + config_file=os.path.join(package_dir, "i18n", "trubar-config.yaml")) + + def setup_package(): write_version_py() cmdclass = { + 'install': InstallMultilingualCommand, 'lint': LintCommand, 'coverage': CoverageCommand, 'config': config,