-
-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathupdate.sh
More file actions
36 lines (27 loc) · 1.01 KB
/
update.sh
File metadata and controls
36 lines (27 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
# Pull catalog message files from Transifex
[ -n "$GITHUB_ACTIONS" ] && set -x
set -e
# Allow language being passed as 1st argument, defaults to ja
LANGUAGE=${1:-ja}
ROOTDIR=$(realpath "$(dirname $0)/..")
cd "${ROOTDIR}"
if ! test -f cpython/Doc/conf.py; then
echo Unable to find proper CPython Doc folder
exit 1
fi
# Create POT Files
cd cpython/Doc
sphinx-build -E -b gettext -D gettext_compact=0 -d build/.doctrees . locales/pot
# Update CPython's .tx/config
cd locales
sphinx-intl create-txconfig
sphinx-intl update-txconfig-resources -p pot -d . --transifex-organization-name python-doc --transifex-project-name python-newest
install -Dm644 .tx/config "${ROOTDIR}/.tx/config"
# Pull translations into cpython/Doc/locales/LANGUAGE/LC_MESSAGES/
tx pull -l ${LANGUAGE} -t --use-git-timestamps
# Finally, move downloaded translation files to the language's repository
cd "${LANGUAGE}/LC_MESSAGES/"
for po in $(find . -type f -name '*.po' | sort | sed 's|^\./||'); do
install -Dm644 ${po} "${ROOTDIR}/${po}"
done