Skip to content

Commit

Permalink
Add translations (multilingual)
Browse files Browse the repository at this point in the history
  • Loading branch information
janezd committed Nov 22, 2024
1 parent f921039 commit 804d3d3
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 1 deletion.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
recursive-include . *.toml *.ini *.md *.pypi .coveragerc LICENSE
recursive-include doc *.bat *.json *.md *.png *.py *.rst *.txt Makefile
recursive-include orangecontrib *.svg
recursive-include i18n *.jaml *.yaml
70 changes: 70 additions & 0 deletions i18n/si/msgs.jaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
networks/dataSimulation.py:
inputData.csv: false
;: false
%d: false
widgets/owrecommendation.py:
class `PersonDelegate`:
def `paint`:
\x00: false
def `sizeHint`:
\x00: false
class `ItemDelegate`:
def `paint`:
\x00: false
def `sizeHint`:
\x00: false
class `CartoonTableModel`:
def `data_for_person`:
'Similar: ': 'Podobni: '
', ': true
\x00: false
def `data_for_recommendation`:
\N{Hourglass}: false
\N{Empty Set}: false
', ': false
({recommenders}): false
{title}\x00{recommenders}: false
def `__on_future_done`:
Future[QImage]: false
class `OWRecommendation`:
Recommendation: Priporočila
Demo for simple network-based recommendation algorithm: Demo za preprost algoritem priporočil na podlagi omrežja podobnih uporabnikov
icons/recommendation.svg: false
class `Inputs`:
Network: Mreža
Items: Stvari
class `Error`:
Network does not contain user choices. Provide separate data.: Mreža ne vsebuje uporabniških izbir. Posredujte ločene podatke.
Network does not contain item names.: Mreža ne vsebuje imen stvari.
Data included in the network does not contain user names.: Podatki vključeni v mrežo ne vsebujejo uporabniških imen.
Some network nodes are missing from data columns: Nekatera vozlišča mreže manjkajo v stolpcih podatkov
Network nodes contain multiple string attributes.\n: Vozlišča mreže vsebujejo več besedilnih spremenljivk.\n
When network and data are both present, the network must have\n: Ko sta mreža in podatki prisotni, mora mreža imeti\n
a single string attribute whose values match the names of persons.: en sam besedilni atribut, katerega vrednosti se ujemajo z imeni oseb.
Network data must be a table or a 1-d array: Podatki mreže morajo biti tabela ali 1-d polje
def `__init__`:
person_column: false
'Person name column (in network data): ': 'Stolpec z imeni oseb (v podatkih mreže): '
item_column: false
'Item column: ': 'Stolpec z imeni stvari: '
def `_init_item_column_from_data`:
type: false
image: false
.png: false
.jpg: false
.jpeg: false
.gif: false
def `set_images`:
origin: false
.: false
http: false
file://: false
def `main`:
..: false
datasets: false
cartoons: false
cartoons.xlsx: false
poster: false
origin: false
cartoons.net: false
__main__: false
7 changes: 7 additions & 0 deletions i18n/trans.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
if [ "$#" -ne 1 ]
then
echo "Usage: trans <destination>"
else
dest=$1
trubar --conf trubar-config.yaml translate -s ../orangecontrib/pumice -d $dest/orangecontrib/pumice 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.imageanalytics", "biolab.si", "Orange")
del Translator
encoding: "utf-8"
28 changes: 28 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
import os
from setuptools import setup, find_packages
from setuptools.command.install import install

from setup import SETUP_REQUIRES

VERSION = "0.9.1"

INSTALL_REQUIRES = (
'Orange3>=3.36',
'orange3-network',
'orange3-imageanalytics',
"orange-canvas-core >=0.2.2",
"orange-widget-base >=4.23.0",
),

EXTRAS_REQUIRE = {
'doc': ['sphinx', 'recommonmark', 'sphinx_rtd_theme'],
'test': ['coverage'],
}

SETUP_REQUIRES = {
'trubar>=0.3.3',
}

LONG_DESCRIPTION = open(os.path.join(os.path.dirname(__file__), 'README.pypi')).read()

ENTRY_POINTS = {
Expand All @@ -23,6 +32,21 @@
'html-index = orangecontrib.prototypes.widgets:WIDGET_HELP_PATH'),
}

class InstallMultilingualCommand(install):
def run(self):
install.run(self)
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, "orangecontrib", "pumice"),
config_file=os.path.join(package_dir, "i18n", "trubar-config.yaml"))


setup(
name="Orange3-Pumice",
description="Educational widgets for project Pumice",
Expand All @@ -40,6 +64,10 @@
package_data={"orangecontrib.pumice.widgets": ["icons/*.svg"]},
entry_points=ENTRY_POINTS,
install_requires=INSTALL_REQUIRES,
setup_requires=SETUP_REQUIRES,
cmdclass={
'install': InstallMultilingualCommand,
},
extras_require=EXTRAS_REQUIRE,
namespace_packages=['orangecontrib'],
include_package_data=True,
Expand Down
4 changes: 3 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ deps =
{env:PYQT_PYPI_NAME:PyQt5}=={env:PYQT_PYPI_VERSION:5.15.*}
{env:WEBENGINE_PYPI_NAME:PyQtWebEngine}=={env:WEBENGINE_PYPI_VERSION:5.15.*}
oldest: scikit-learn~=1.0.1
oldest: orange3==3.31.1
oldest: orange3==3.36
oldest: pandas==1.4.0
oldest: orange-canvas-core==0.2.2
oldest: orange-widget-base==4.23.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

0 comments on commit 804d3d3

Please sign in to comment.