ClickHouse/docs/tools/translate/update-po.sh

23 lines
653 B
Bash
Raw Normal View History

2020-03-30 08:25:29 +00:00
#!/usr/bin/env bash
# Usage: update-po.sh
set -ex
BASE_DIR=$(dirname $(readlink -f $0))
2020-04-15 13:56:49 +00:00
WEBSITE_DIR="${BASE_DIR}/../../../website"
2020-03-30 08:25:29 +00:00
LOCALE_DIR="${WEBSITE_DIR}/locale"
MESSAGES_POT="${LOCALE_DIR}/messages.pot"
BABEL_INI="${BASE_DIR}/babel-mapping.ini"
2020-04-15 13:56:49 +00:00
LANGS="en zh es fr ru ja tr fa"
2020-03-30 08:25:29 +00:00
source "${BASE_DIR}/venv/bin/activate"
cd "${WEBSITE_DIR}"
pybabel extract "." -o "${MESSAGES_POT}" -F "${BABEL_INI}"
for L in ${LANGS}
do
pybabel update -d locale -l "${L}" -i "${MESSAGES_POT}" || \
pybabel init -d locale -l "${L}" -i "${MESSAGES_POT}"
done
python3 "${BASE_DIR}/translate.py" po
for L in ${LANGS}
do
pybabel compile -d locale -l "${L}"
done