Skip to content

Commit

Permalink
Merge pull request #307 from janezd/multilingual-setup
Browse files Browse the repository at this point in the history
[ENH] Setup: translated packages
  • Loading branch information
markotoplak authored Sep 20, 2024
2 parents d3d2588 + 1d92da3 commit 054b16a
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-docs-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
matrix:
include:
- os: ubuntu-20.04
python: "3.8"
python: "3.9"

steps:
- uses: actions/checkout@v4
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/run-tests-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,9 @@ jobs:
include:
# Linux
- os: ubuntu-20.04
python-version: 3.8
python-version: 3.9
test-env: "PyQt5~=5.12.0"

- os: ubuntu-20.04
python-version: 3.8
test-env: "PyQt5~=5.15.0"

- os: ubuntu-20.04
python-version: 3.9
test-env: "PyQt5~=5.14.0"
Expand Down Expand Up @@ -53,7 +49,7 @@ jobs:

# macOS
- os: macos-12
python-version: 3.8
python-version: 3.9
test-env: "PyQt5~=5.12.0"

- os: macos-12
Expand Down Expand Up @@ -82,7 +78,7 @@ jobs:

# Windows
- os: windows-2019
python-version: 3.8
python-version: 3.9
test-env: "PyQt5~=5.12.0"

- os: windows-2019
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.8"
python: "3.9"

python:
install:
Expand Down
4 changes: 2 additions & 2 deletions docs/requirements-rtd.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
--only-binary PyQt5,numpy

setuptools
sphinx~=4.2.0
sphinx~=7.4.7
sphinx-rtd-theme
PyQt5
AnyQt

# sphinx pins docutils version, but the installation in the RTD worker/config
# overrides it because docutils is also in our dependencies.
# https://docs.readthedocs.io/en/stable/faq.html#i-need-to-install-a-package-in-a-environment-with-pinned-versions
-e .
-e .
6 changes: 3 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = {'.rst': 'restructuredtext'}

# The encoding of source files.
#source_encoding = 'utf-8-sig'
Expand All @@ -73,7 +73,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = "en"

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
Expand Down Expand Up @@ -296,4 +296,4 @@


# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}
intersphinx_mapping = {'python': ('https://docs.python.org/3', None)}
69 changes: 68 additions & 1 deletion i18n/si/msgs.jaml
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ application/application.py:
-style: false
styleHints: false
setShowShortcutsInContextMenus: false
QMessageBox: false
def `argumentParser`:
-style: false
-colortheme: false
Expand Down Expand Up @@ -3653,7 +3654,7 @@ utils/localization/__init__.py:
i18n: false
.json: false
'Invalid language file ': false
English: null
English: false
def `language_changed`:
application/language: false
application/last-used-language: false
Expand All @@ -3673,3 +3674,69 @@ utils/localization/__init__.py:
def `c`:
<string>: false
eval: false
utils/localization/si.py:
def `plsi`:
'|': false
a: false
i: false
e: false
ov: false
def `plsi_sz`:
{n:_}: false
_: false
1: false
z: false
zszzzzsssssssssszzzzzz: false
s: false
0: false
zzzssssszz: false
def `z_besedo`:
nič: false
m: false
en: false
enega: false
enemu: false
enem: false
enim: false
f: false
ena: false
ene: false
eni: false
eno: false
n: false
dva: false
dveh: false
dvema: false
dve: false
tri: false
treh: false
trem: false
tremi: false
štiri: false
štirih: false
štirim: false
štirimi: false
pet: false
petih: false
petim: false
petimi: false
šest: false
šestih: false
šestim: false
šestimi: false
sedem: false
sedmih: false
sedmim: false
sedmimi: false
osem: false
osmih: false
osmim: false
osmimi: false
devet: false
devetih: false
devetim: false
devetimi: false
deset: false
desetih: false
desetim: false
desetimi: false
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools", "wheel", "trubar>=0.3.3"]
build-backend = "setuptools.build_meta"
25 changes: 24 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#! /usr/bin/env python
import os

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


NAME = "orange-canvas-core"
VERSION = "0.2.3.dev0"
Expand Down Expand Up @@ -60,7 +64,23 @@
"Documentation": "https://orange-canvas-core.readthedocs.io/en/latest/",
}

PYTHON_REQUIRES = ">=3.8"
PYTHON_REQUIRES = ">=3.9"


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, "orangecanvas"),
config_file=os.path.join(package_dir, "i18n", "trubar-config.yaml"))


if __name__ == "__main__":
setup(
Expand All @@ -76,6 +96,9 @@
packages=PACKAGES,
package_data=PACKAGE_DATA,
install_requires=INSTALL_REQUIRES,
cmdclass={
'install': InstallMultilingualCommand,
},
extras_require=EXTRAS_REQUIRE,
project_urls=PROJECT_URLS,
python_requires=PYTHON_REQUIRES,
Expand Down

0 comments on commit 054b16a

Please sign in to comment.