Skip to content

Commit

Permalink
Fixed Workflows to support necessary locale
Browse files Browse the repository at this point in the history
1) Added all necessary locale languages to the Workflows (compile_card_db.yml and lint_and_test.yml)
2) Also OS dependent locale.setlocale switch in main.py
3) Had to rename "nl_du" to "nl_nl" to match a correct language code
  • Loading branch information
smrky1 committed Feb 11, 2024
1 parent aae45bb commit e8d494e
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 1 deletion.
13 changes: 13 additions & 0 deletions .github/workflows/compile_card_db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ jobs:
run: doit update_languages
- run: |
pip install .
- name: Install locales
run: |
apt-get update
apt-get -y install locales
locale-gen en_US
locale-gen de_DE
locale-gen fr_FR
locale-gen en_US
locale-gen es_ES
locale-gen it_IT
locale-gen nl_NL
locale-gen cs_CZ
locale -a
- name: test generation with compiled Languages
run: pytest -k "test_languages"
- uses: dorny/paths-filter@v2
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/lint_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@ jobs:
- run: |
pip install -r requirements.txt
pip install .
- name: Install locales
run: |
apt-get update
apt-get -y install locales
locale-gen en_US
locale-gen de_DE
locale-gen fr_FR
locale-gen en_US
locale-gen es_ES
locale-gen it_IT
locale-gen nl_NL
locale-gen cs_CZ
locale -a
- name: Lint
run: pre-commit run --all-files
- name: Test
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 4 additions & 1 deletion src/domdiv/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1500,7 +1500,10 @@ def __init__(self, order, lang, baseCards):
self.baseCards.append(baseCards[tag])

# Set the locale to the selected language. Necessary for correct sorting using accented characters
locale.setlocale(locale.LC_COLLATE, lang)
if os.name == "nt":
locale.setlocale(locale.LC_COLLATE, lang)
elif os.name == "posix":
locale.setlocale(locale.LC_COLLATE, (lang, ""))

# When sorting cards, want to always put "base" cards after all
# kingdom cards, and order the base cards in a particular order
Expand Down

0 comments on commit e8d494e

Please sign in to comment.