Skip to content

Commit

Permalink
Setup: Apply trubar when installing
Browse files Browse the repository at this point in the history
  • Loading branch information
janezd committed Oct 4, 2024
1 parent cba930a commit 82ed547
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ requires = [
"setuptools>=51.0",
"sphinx",
"wheel",
"trubar>=0.3.3"
]

build-backend = "setuptools.build_meta"
Expand Down
17 changes: 17 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 82ed547

Please sign in to comment.