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

23 lines
647 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))
WEBSITE_DIR="${BASE_DIR}/../../website"
LOCALE_DIR="${WEBSITE_DIR}/locale"
MESSAGES_POT="${LOCALE_DIR}/messages.pot"
BABEL_INI="${BASE_DIR}/babel-mapping.ini"
2020-03-30 12:48:55 +00:00
LANGS="en zh es fr ru ja 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