Add fr, es and zh_CN Weblate PO files

Using `./update.sh --add-langs`.
Further langs will be added directly via Weblate.
This commit is contained in:
Rémi Verschelde
2018-04-10 12:32:22 +02:00
parent f511fa42bf
commit 3426c71f39
4 changed files with 154458 additions and 0 deletions

View File

@@ -10,11 +10,15 @@ WEBLATE_DIR="weblate"
WEBLATE_TEMPLATE="$WEBLATE_DIR/docs.pot"
WEBLATE_POFILES=$(find $WEBLATE_DIR -type f -name "*.po")
# Used only for --add-langs - languages will mostly be added via Weblate directly
LANGS="es fr zh_CN"
# Options
update_sphinx_pot=false
update_sphinx_po=false
update_weblate_pot=false
update_weblate_po=false
add_langs=false
# Command line arguments
while [ $# -gt 0 ]; do
@@ -45,6 +49,10 @@ while [ $# -gt 0 ]; do
update_weblate_pot=true
update_weblate_po=true
;;
--add-langs|-l)
add_langs=true
make_sphinx_po_symlinks=true
;;
*)
echo "Invalid argument."
esac
@@ -82,6 +90,16 @@ if [ "$update_weblate_po" = true ]; then
done
fi
# Manual method to generate new Weblate PO files to bootstrap a lang
if [ "$add_langs" = true ]; then
for lang in $LANGS; do
if [ ! -f "$WEBLATE_DIR/$lang.po" ]; then
msginit --no-translator -i $WEBLATE_TEMPLATE -o "$WEBLATE_DIR/$lang.po";
fi
done
WEBLATE_POFILES=$(find $WEBLATE_DIR -type f -name "*.po")
fi
# Generate/Merge Sphinx PO files from Weblate PO file
if [ "$update_sphinx_po" = true ]; then
echo "=== Merging Sphinx PO files with their template and Weblate PO file ==="