Skip to content

Commit 3815d12

Browse files
authored
Publish translation binary files with release (#735)
Upon release to PyPI or Test PyPI, the translation binary files (*.mo) should also be included so that the strings get translated depending on locale. Signed-off-by: Eric Brown <eric.brown@securesauce.dev>
1 parent 827e5e9 commit 3815d12

4 files changed

Lines changed: 10 additions & 2 deletions

File tree

.github/workflows/publish-to-pypi.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828

2929
- name: Build a binary wheel and a source tarball
3030
run: |
31+
sh -c 'for lang in de en_GB es fr it ja ko pt_BR ru zh_CN zh_TW; do msgfmt -o precli/locale/$lang/LC_MESSAGES/messages.mo precli/locale/$lang/LC_MESSAGES/messages.po; done'
3132
python setup.py sdist bdist_wheel
3233
3334
- name: Publish distribution to PyPI

.github/workflows/publish-to-test-pypi.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828

2929
- name: Build a binary wheel and a source tarball
3030
run: |
31+
sh -c 'for lang in de en_GB es fr it ja ko pt_BR ru zh_CN zh_TW; do msgfmt -o precli/locale/$lang/LC_MESSAGES/messages.mo precli/locale/$lang/LC_MESSAGES/messages.po; done'
3132
python setup.py sdist bdist_wheel
3233
3334
- name: Publish distribution to Test PyPI

.github/workflows/upload-asset.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030

3131
- name: Build a binary wheel and a source tarball
3232
run: |
33+
sh -c 'for lang in de en_GB es fr it ja ko pt_BR ru zh_CN zh_TW; do msgfmt -o precli/locale/$lang/LC_MESSAGES/messages.mo precli/locale/$lang/LC_MESSAGES/messages.po; done'
3334
python setup.py sdist bdist_wheel
3435
3536
- name: Release

setup.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
# Copyright 2024 Secure Sauce LLC
1+
# Copyright 2025 Secure Sauce LLC
22
# SPDX-License-Identifier: BUSL-1.1
33
import setuptools
44

55

66
setuptools.setup(
7-
python_requires=">=3.9", setup_requires=["pbr>=2.0.0"], pbr=True
7+
python_requires=">=3.9",
8+
setup_requires=["pbr>=2.0.0"],
9+
pbr=True,
10+
package_data={
11+
"precli": ["locale/*/LC_MESSAGES/*.mo"],
12+
},
813
)

0 commit comments

Comments
 (0)