website/tools/i18n.sh
Roman Tsisyk c81436edc4 Fix formatting of .po and integrate npm run format
This patch unifies formatting between Weblate and
local tooling and reformats .po files. Markdowns
are also reformatted after re-generation.

Signed-off-by: Roman Tsisyk <roman@tsisyk.com>
2022-12-24 10:58:58 +02:00

37 lines
697 B
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")"
TOOLS="$(pwd)"
if ! which po4a; then
echo "ERROR: Missing po4a">&2
echo " brew install po4a">&2
echo " apt install po4a">&2
echo " dnf install po4a">&2
exit 1
fi
set -x
if [ ! -x venv/bin/python3 ]; then
python3 -m venv venv
fi
source venv/bin/activate
pip3 install -r requirements.txt
cd ..
npm ci
$TOOLS/extract-zola-translations.py
touch content/_index.md po/content.pot po/*.po # force re-generation
po4a .po4a.cfg
sed -e '/"PO-Revision-Date/d' -e '/"POT-Creation-Date/d' -i'~' po/content.*.po po/content.pot
rm -f po/content.*.po*~ po/content.pot~
$TOOLS/update-zola-translations.py
npm run format