Skip to content

Commit

Permalink
setup.py: Add translation
Browse files Browse the repository at this point in the history
  • Loading branch information
janezd committed Jul 12, 2024
1 parent b15e80d commit 0a325ee
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
#!/usr/bin/env python3

import io
import os
import contextlib
import importlib.metadata
import subprocess
import warnings
import stat
from os import path, walk

from setuptools import setup, find_packages
from setuptools.command.install import install

with io.open('README.pypi', 'r', encoding='utf-8') as f:
ABOUT = f.read()
Expand Down Expand Up @@ -74,6 +79,22 @@ def include_documentation(local_dir, install_dir):
DATA_FILES.extend(doc_files)


class InstallMultilingualCommand(install):
def run(self):
install.run(self)
self.compile_to_multilingual()

@staticmethod
def compile_to_multilingual():
from trubar import translate

package_dir = os.path.dirname(os.path.abspath(__file__))
translate(
"msgs.jaml",
source_dir=os.path.join(package_dir, "orangecontrib", "imageanalytics"),
config_file=os.path.join(package_dir, "i18n", "trubar-config.yaml"))


if __name__ == '__main__':
include_documentation('doc/_build/html', 'help/orange3-imageanalytics')
setup(
Expand All @@ -91,6 +112,7 @@ def include_documentation(local_dir, install_dir):
package_data=PACKAGE_DATA,
keywords=KEYWORDS,
classifiers=CLASSIFIERS,
setup_requires=["trubar>=0.3.1"],
install_requires=[
"AnyQt",
"ndf >=0.1.4",
Expand All @@ -103,6 +125,9 @@ def include_documentation(local_dir, install_dir):
"requests_cache",
"scipy",
],
cmdclass={
'install': InstallMultilingualCommand,
},
extras_require={
'test': ['coverage', ],
'doc': ['sphinx', 'recommonmark', 'sphinx_rtd_theme', ],
Expand Down

0 comments on commit 0a325ee

Please sign in to comment.