#!/bin/bash

# For now, we use itstool to translate the docbook files even if itstool no
# longer seems to be maintained. Future alternatives are:
#
# poxml: works like itstool, but is not part of the KDE SDK in flatpak. This
#   is why we include the translated docbook files in the source tree, such
#   that running poxml would not be required for the normal build process as
#   long as the translations haven't changed.
#
# gettext: supports Docbook in newer versions, but does not handle withinText
#   elements correctly (0.23)

cd $(dirname "$0")
for lang in `cat po/LINGUAS`; do
  msgfmt -o $lang.mo po/$lang.po
  itstool -m $lang.mo -o docbook/index_$lang.docbook docbook/index.docbook
done
