Skip to content

Commit 5a0df79

Browse files
committed
Update script to work with the new TX command
Previous solution of patching .tx/config does not work with the new client, so the script had to be updated with new solution. Now, translations are pulled into a sub-directory of cpython, and then installed in the languages's repository. Also using 'realpath' tool in ROOTDIR to retrieve absolute path, which actually eases referencing the repository root directory.
1 parent 88bf92a commit 5a0df79

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

scripts/update.sh

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ set -e
77
# Allow language being passed as 1st argument, defaults to ja
88
LANGUAGE=${1:-ja}
99

10-
ROOTDIR=$(dirname $0)/..
10+
ROOTDIR=$(realpath "$(dirname $0)/..")
1111

12-
cd ${ROOTDIR}
12+
cd "${ROOTDIR}"
1313

1414
if ! test -f cpython/Doc/conf.py; then
1515
echo Unable to find proper CPython Doc folder
@@ -21,22 +21,19 @@ cd cpython/Doc
2121
sphinx-build -E -b gettext -D gettext_compact=0 -d build/.doctrees . locales/pot
2222

2323
# Update CPython's .tx/config
24-
cd locales
24+
cd locales
2525
sphinx-intl create-txconfig
26-
sphinx-intl update-txconfig-resources -p pot -d . --transifex-project-name python-newest
26+
sphinx-intl update-txconfig-resources -p pot -d . --transifex-organization-name python-doc --transifex-project-name python-newest
2727

28-
if [ "$CI" = true ]
29-
then
28+
if [ "$CI" = true ]; then
3029
tx push --source --no-interactive --skip
3130
fi
3231

33-
# Update the translation project's .tx/config
34-
cd ../../.. # back to $ROOTDIR
35-
mkdir -p .tx
36-
sed cpython/Doc/locales/.tx/config \
37-
-e '/^source_file/d' \
38-
-e 's|<lang>/LC_MESSAGES/||' \
39-
-e "s|^file_filter|trans.${LANGUAGE}|" \
40-
> .tx/config
32+
# Pull translations into cpython/Doc/locales/LANGUAGE/LC_MESSAGES/
33+
tx pull -l ${LANGUAGE} -t --use-git-timestamps -f
4134

42-
tx pull -l ${LANGUAGE} --use-git-timestamps --parallel
35+
# Finally, move downloaded translation files to the language's repository
36+
cd "${LANGUAGE}/LC_MESSAGES/"
37+
for po in $(find . -type f -name '*.po' | sort | sed 's|^\./||'); do
38+
install -Dm644 ${po} "${ROOTDIR}/${po}"
39+
done

0 commit comments

Comments
 (0)