Skip to content
This repository has been archived by the owner on Oct 13, 2024. It is now read-only.

Commit

Permalink
fix(locale): compile web ui translations and enable additional langua…
Browse files Browse the repository at this point in the history
…ges (#391)
  • Loading branch information
ReenigneArcher authored Mar 16, 2024
1 parent f08199a commit 9d6a497
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 11 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,17 @@ jobs:
python -m pip --no-python-version-warning --disable-pip-version-check install --upgrade pip setuptools
# install dev requirements
python -m pip install --upgrade -r requirements-dev.txt
python -m pip install --upgrade \
-r requirements-build.txt \
-r requirements-dev.txt
python -m pip install --upgrade --target=./Contents/Libraries/Shared -r \
requirements.txt --no-warn-script-location
python -m pip install --upgrade --target=./Contents/Libraries/Shared \
-r requirements.txt --no-warn-script-location
- name: Compile Locale Translations
working-directory: Themerr-plex.bundle
run: |
python ./scripts/_locale.py --compile
- name: Install npm packages
working-directory: Themerr-plex.bundle
Expand Down
6 changes: 4 additions & 2 deletions Contents/Code/webapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
default_locale='en',
default_timezone='UTC',
default_domain='themerr-plex',
configure_jinja=True
configure_jinja=True,
)

app.config['BABEL_TRANSLATION_DIRECTORIES'] = os.path.join(plugin_directory, 'Contents', 'Strings')
Expand Down Expand Up @@ -130,7 +130,9 @@ def get_locale():
>>> get_locale()
en
"""
return Prefs['enum_webapp_locale']
locale = Prefs['enum_webapp_locale']
Log.Debug('Getting locale: %s' % locale)
return locale


def start_server():
Expand Down
4 changes: 3 additions & 1 deletion Contents/DefaultPrefs.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@
"es",
"fr",
"it",
"ru"
"ru",
"sv",
"zh"
]
},
{
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ _PIP
RUN <<_BUILD
#!/bin/bash
set -e
python2 -m pip --no-python-version-warning --disable-pip-version-check install --no-cache-dir --upgrade \
-r requirements-build.txt
python2 -m pip --no-python-version-warning --disable-pip-version-check install --no-cache-dir --upgrade \
--target=./Contents/Libraries/Shared -r requirements.txt --no-warn-script-location
python2 ./scripts/_locale.py --compile
python2 ./scripts/build_plist.py
_BUILD

Expand Down
6 changes: 6 additions & 0 deletions docs/source/contributing/build.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ Development Requirements
python -m pip install -r requirements-dev.txt
Compile Translations
--------------------
.. code-block:: bash
python ./scripts/_locale.py --compile
Build Plist
-----------
.. code-block:: bash
Expand Down
1 change: 1 addition & 0 deletions requirements-build.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Babel==2.9.1
12 changes: 7 additions & 5 deletions scripts/_locale.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@

# target locales
target_locales = [
'de', # Deutsch
'de', # German
'en', # English
'en_GB', # English (United Kingdom)
'en_US', # English (United States)
'es', # español
'fr', # français
'it', # italiano
'ru', # русский
'es', # Spanish
'fr', # French
'it', # Italian
'ru', # Russian
'sv', # Swedish
'zh', # Chinese Simplified
]


Expand Down

0 comments on commit 9d6a497

Please sign in to comment.