Skip to content

Commit ffe77bf

Browse files
committed
Switch to Go Transifex CLI
1 parent 3107d7b commit ffe77bf

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

Diff for: .github/scripts/manage_translation.py

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python
22
#
3-
# This python file contains utility scripts to manage Python docs Polish translation.
3+
# This python file contains utility scripts to manage Python docs Ukrainian translation.
44
# It has to be run inside the python-docs-uk git root directory.
55
#
66
# Inspired by django-docs-translations script by claudep.
@@ -20,14 +20,18 @@
2020
import sys
2121

2222
LANGUAGE = 'uk'
23-
23+
RESOURCE_NAME_MAP = {'glossary_': 'glossary'}
24+
TX_ORGANISATION = 'python-doc'
25+
TX_PROJECT = 'python-newest'
26+
GH_ORGANISATION = 'python'
27+
GH_PROJECT = 'python-docs-uk'
2428

2529
def fetch():
2630
"""
2731
Fetch translations from Transifex, remove source lines.
2832
"""
2933
if call("tx --version", shell=True) != 0:
30-
sys.stderr.write("The Transifex client app is required (pip install transifex-client).\n")
34+
sys.stderr.write("The Transifex client app is required (https://developers.transifex.com/docs/cli).\n")
3135
exit(1)
3236
lang = LANGUAGE
3337
pull_returncode = call(f'tx pull -l {lang} --minimum-perc=1 --force --skip', shell=True)
@@ -41,11 +45,6 @@ def fetch():
4145
call(f'msgcat --no-location -o {po_path} {po_path}', shell=True)
4246

4347

44-
RESOURCE_NAME_MAP = {'glossary_': 'glossary'}
45-
TX_ORGANISATION = 'python-doc'
46-
TX_PROJECT = 'python-newest'
47-
GH_ORGANISATION = 'python'
48-
4948
def recreate_tx_config():
5049
"""
5150
Regenerate Transifex client config for all resources.
@@ -144,13 +143,13 @@ def average(averages, weights):
144143
f'''\
145144
Український переклад документації Python
146145
========================================
147-
![build](https://github.com/{GH_ORGANISATION}/python-docs-uk/workflows/.github/workflows/update-and-build.yml/badge.svg)
146+
![build](https://github.com/{GH_ORGANISATION}/{GH_PROJECT}/workflows/.github/workflows/update-and-build.yml/badge.svg)
148147
![{language_switcher_status:.2f}% прогрес перекладу](https://img.shields.io/badge/прогрес_перекладу-{language_switcher_status:.2f}%25-0.svg)
149148
![хід перекладу всієї документації](https://img.shields.io/badge/dynamic/json.svg?label=всього&query=$.{LANGUAGE}&url=http://gce.zhsj.me/python/newest)
150149
![{number_of_translators} перекладачів](https://img.shields.io/badge/перекладачів-{number_of_translators}-0.svg)
151150
152151
Якщо ви знайшли помилку або маєте пропозицію,
153-
[додати issue](https://github.com/{GH_ORGANISATION}/python-docs-uk/issues) у цьому проекті або запропонуйте зміни:
152+
[додати issue](https://github.com/{GH_ORGANISATION}/{GH_PROJECT}/issues) у цьому проекті або запропонуйте зміни:
154153
155154
* Зареєструйтесь на платформі [Transifex](https://www.transifex.com/)
156155
* Перейдіть на сторінку [документації Python](https://www.transifex.com/{TX_ORGANISATION}/{TX_PROJECT}/).

Diff for: .github/workflows/update-and-build.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,17 @@ jobs:
1616
access_token: ${{ secrets.GITHUB_TOKEN }}
1717
- uses: actions/setup-python@master
1818
with:
19-
python-version: '3.9'
19+
python-version: 3
2020
- run: sudo apt-get install -y gettext
21-
- run: pip install 'transifex-client>=0.14' requests
21+
- run: curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash
22+
working-directory: /usr/local/bin
23+
- run: pip install requests
2224
- uses: actions/checkout@master
2325
with:
2426
ref: ${{ matrix.version }}
2527
- run: .github/scripts/manage_translation.py recreate_tx_config
2628
env:
2729
TX_TOKEN: ${{ secrets.TX_TOKEN }}
28-
- run: echo -e '[https://www.transifex.com]\napi_hostname = https://api.transifex.com\nhostname = https://www.transifex.com\nusername = api' > $HOME/.transifexrc
2930
- run: .github/scripts/manage_translation.py fetch
3031
env:
3132
TX_TOKEN: ${{ secrets.TX_TOKEN }}

Diff for: .gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.idea/
2-
32
venv/
3+
tx
4+
LICENSE

0 commit comments

Comments
 (0)