Skip to content

Commit 50f0cfb

Browse files
committed
Add update.sh
1 parent 3ca2a8f commit 50f0cfb

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

scripts/update.sh

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/sh
2+
# Pull catalog message files from Transifex
3+
4+
[ -n "$GITHUB_ACTIONS" ] && set -x
5+
set -e
6+
7+
# Allow language being passed as 1st argument, defaults to pt_BR
8+
LANGUAGE=${1:-pt_BR}
9+
10+
ROOTDIR=$(dirname $0)/..
11+
12+
cd ${ROOTDIR}
13+
14+
if ! test -f cpython/Doc/conf.py; then
15+
echo Unable to find proper CPython Doc folder
16+
exit 1
17+
fi
18+
19+
# Create POT Files
20+
cd cpython/Doc
21+
sphinx-build -E -b gettext -D gettext_compact=0 -d build/.doctrees . locales/pot
22+
23+
# Update CPython's .tx/config
24+
cd locales
25+
sphinx-intl create-txconfig
26+
sphinx-intl update-txconfig-resources -p pot -d . --transifex-project-name python-newest
27+
28+
# Update the translation project's .tx/config
29+
cd ../../.. # back to $ROOTDIR
30+
mkdir -p .tx
31+
sed cpython/Doc/locales/.tx/config \
32+
-e '/^source_file/d' \
33+
-e 's|<lang>/LC_MESSAGES/||' \
34+
-e "s|^file_filter|trans.${LANGUAGE}|" \
35+
> .tx/config
36+
37+
tx pull -l ${LANGUAGE} --use-git-timestamps --parallel

0 commit comments

Comments
 (0)