mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2024-12-28 11:58:31 +01:00
d4f8d0918a
Related to https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/3841 Most of the preparation for this was done by Suguru Hirahara (https://github.com/luixxiul). I've merely reorganized/polished the scripts and instructions in the `i18n/` directory. While translations can happen even now, more work is necessary to - make the translation flow better (integrating Weblate), etc. - restore the Github Actions workflows that Suguru Hirahara had already developed to adapt them to our new workflow
57 lines
1.8 KiB
Bash
Executable File
57 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# This script builds the translated result (translated project) for a given language in the `translated/<language>/` directory.
|
|
|
|
set -euxo pipefail
|
|
|
|
if [ $# -ne 1 ]; then
|
|
echo "Usage: $0 <language>"
|
|
exit 1
|
|
fi
|
|
|
|
LANGUAGE=$1
|
|
|
|
base_path="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
|
|
if [ ! -f ${base_path}/i18n/locales/${LANGUAGE}/LC_MESSAGES/README.po ]; then
|
|
echo "Locales for ${LANGUAGE} not found. Please run the `sync-translation-templates-to-locales.sh` script first."
|
|
exit 1
|
|
fi
|
|
|
|
# Prepare a clean build directory
|
|
if [ -d ${base_path}/i18n/translated-result-build-${LANGUAGE} ]; then
|
|
rm -rf ${base_path}/i18n/translated-result-build-${LANGUAGE}
|
|
fi
|
|
mkdir -p ${base_path}/i18n/translated-result-build-${LANGUAGE}
|
|
|
|
# Build the translated documentation
|
|
sphinx-build \
|
|
-b markdown \
|
|
-D language="${LANGUAGE}" \
|
|
${base_path}/ \
|
|
${base_path}/i18n/translated-result-build-${LANGUAGE}
|
|
|
|
# Clean up .mo files produced during the build.
|
|
# We don't commit them to the repository anyway, so they can be left alone,
|
|
# but we'd rather keep things clean anyway.
|
|
find ${base_path}/i18n/locales/${LANGUAGE} -type f -name '*.mo' -delete
|
|
|
|
# Clean up the build directory
|
|
rm -rf ${base_path}/i18n/translated-result-build-${LANGUAGE}/.doctrees
|
|
|
|
# Copy assets
|
|
cp -r ${base_path}/docs/assets ${base_path}/i18n/translated-result-build-${LANGUAGE}/docs/assets/
|
|
|
|
# Remove the old result directory for this language
|
|
if [ -d ${base_path}/i18n/translated/${LANGUAGE} ]; then
|
|
rm -rf ${base_path}/i18n/translated/${LANGUAGE}
|
|
fi
|
|
|
|
# Make sure the `translated/` directory exists
|
|
if [ ! -d ${base_path}/i18n/translated ]; then
|
|
mkdir -p ${base_path}/i18n/translated
|
|
fi
|
|
|
|
# Relocate the built result to translated/<language>
|
|
mv ${base_path}/i18n/translated-result-build-${LANGUAGE} ${base_path}/i18n/translated/${LANGUAGE}
|