Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH] Multilingual package #183

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

recursive-include doc *.bat *.json *.md *.png *.py *.rst Makefile
recursive-include orangecontrib *.csv *.json *.sh *.svg *.txt
recursive-include i18n *.jaml *.yaml
2 changes: 0 additions & 2 deletions i18n/si/trubar-config.yaml

This file was deleted.

9 changes: 4 additions & 5 deletions i18n/trans.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
if [ "$#" -ne 2 ]
if [ "$#" -ne 1 ]
then
echo "Usage: trans <language> <destination>"
echo "Usage: trans <destination>"
else
lang=$1
dest=$2
trubar --conf $lang/trubar-config.yaml translate -s ../orangecontrib/geo -d $dest/orangecontrib/geo $lang/msgs.jaml
dest=$1
trubar --conf trubar-config.yaml translate -s ../orangecontrib/geo -d $dest/orangecontrib/geo msgs.jaml
fi
13 changes: 13 additions & 0 deletions i18n/trubar-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
languages:
en:
name: English
original: true
si:
name: Slovenščina
international-name: Slovenian
auto-import: from orangecanvas.utils.localization.si import plsi, plsi_sz, z_besedo # pylint: disable=wrong-import-order
auto-import: |2
from orangecanvas.utils.localization import Translator # pylint: disable=wrong-import-order
_tr = Translator("orangecontrib.geo", "biolab.si", "Orange")
del Translator
encoding: "utf-8"
26 changes: 23 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from os import path
from setuptools import setup, find_packages

from setuptools.command.install import install

VERSION = "0.4.2"

Expand Down Expand Up @@ -36,6 +36,21 @@ def _discover_tests():
top_level_dir='.')


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

def compile_to_multilingual(self):
from trubar import translate

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


if __name__ == '__main__':
setup(
name='Orange3-Geo',
Expand All @@ -47,7 +62,7 @@ def _discover_tests():
packages=find_packages(),
include_package_data=True,
install_requires=[
'Orange3>=3.34.0',
'Orange3>=3.37.0',
'scikit-learn',
'pandas',
'scipy>=0.17',
Expand All @@ -56,7 +71,12 @@ def _discover_tests():
'simplejson',
'Pillow'
],

setup_requires=[
'trubar>=0.3.3',
],
cmdclass={
'install': InstallMultilingualCommand,
},
extras_require = {
'test': ['coverage'],
'doc': ['sphinx', 'recommonmark', 'sphinx_rtd_theme'],
Expand Down
8 changes: 4 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ deps =
{env:PYQT_PYPI_NAME:PyQt5}=={env:PYQT_PYPI_VERSION:5.15.*}
{env:WEBENGINE_PYPI_NAME:PyQtWebEngine}=={env:WEBENGINE_PYPI_VERSION:5.15.*}
oldest: numpy~=1.22.0 # some older version
oldest: orange3==3.34.0
oldest: orange-canvas-core==0.1.28
oldest: orange-widget-base==4.19.0
oldest: orange3==3.37.0
oldest: orange-canvas-core>=0.2.2,
oldest: orange-widget-base>=4.23.0,
oldest: pandas==1.4.0
oldest: scikit-learn~=1.0.1
oldest: scikit-learn~=1.3.0
latest: https://github.com/biolab/orange3/archive/refs/heads/master.zip#egg=orange3
latest: https://github.com/biolab/orange-canvas-core/archive/refs/heads/master.zip#egg=orange-canvas-core
latest: https://github.com/biolab/orange-widget-base/archive/refs/heads/master.zip#egg=orange-widget-base
Expand Down
Loading