Skip to content

Commit fb2daf3

Browse files
authored
Merge pull request #199 from hugovk/generate-translation-binaries
2 parents 98fafaf + a759892 commit fb2daf3

27 files changed

Lines changed: 36 additions & 1 deletion

File tree

.github/workflows/test.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,26 @@ jobs:
4242
restore-keys: |
4343
${{ matrix.os }}-${{ matrix.python-version }}-v1-
4444
45+
- name: Install Linux dependencies
46+
if: startsWith(matrix.os, 'ubuntu')
47+
run: |
48+
sudo apt install gettext
49+
50+
- name: Install macOS dependencies
51+
if: startsWith(matrix.os, 'macos')
52+
run: |
53+
brew install gettext
54+
4555
- name: Install dependencies
4656
run: |
4757
python -m pip install -U pip
4858
python -m pip install -U wheel
4959
python -m pip install -U tox
5060
61+
- name: Generate translation binaries
62+
run: |
63+
scripts/generate-translation-binaries.sh
64+
5165
- name: Tox tests
5266
run: |
5367
tox -e py

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*.egg-info*
2+
*.mo
23
*.pot
34
*.py[co]
45
*.sw[po]

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
recursive-include src/humanize/locale *.mo

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ How to add new phrases to existing locale files:
199199
```console
200200
$ xgettext --from-code=UTF-8 -o humanize.pot -k'_' -k'N_' -k'P_:1c,2' -l python src/humanize/*.py # extract new phrases
201201
$ msgmerge -U src/humanize/locale/ru_RU/LC_MESSAGES/humanize.po humanize.pot # add them to locale files
202-
$ msgfmt --check -o src/humanize/locale/ru_RU/LC_MESSAGES/humanize{.mo,.po} # compile to binary .mo
203202
```
204203

205204
How to add a new locale:

RELEASING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ git clone https://github.com/jmoiron/humanize
1414
cd humanize
1515
```
1616

17+
* [ ] Generate translation binaries:
18+
19+
```bash
20+
scripts/generate-translation-binaries.sh
21+
```
22+
1723
* [ ] (Optional) Create a distribution and release on **TestPyPI**:
1824

1925
```bash
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
set -e
2+
3+
for d in src/humanize/locale/*/; do
4+
locale="$(basename $d)"
5+
echo "$locale"
6+
# compile to binary .mo
7+
msgfmt --check -o src/humanize/locale/$locale/LC_MESSAGES/humanize{.mo,.po}
8+
done
-2.63 KB
Binary file not shown.
-2.55 KB
Binary file not shown.
-2.63 KB
Binary file not shown.
-2.74 KB
Binary file not shown.

0 commit comments

Comments
 (0)