Matrix Docker Ansible eploy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.1 KiB

  1. #!/bin/bash
  2. # SPDX-FileCopyrightText: 2024 Slavi Pantaleev <slavi@devture.com>
  3. #
  4. # SPDX-License-Identifier: AGPL-3.0-or-later
  5. # This script updates the translation files (locales/<language>/**/*.po) for a given language.
  6. # It uses the translation templates (translation-templates/**/*.pot) to generate the translation files.
  7. set -euxo pipefail
  8. if [ $# -ne 1 ]; then
  9. echo "Usage: $0 <language>"
  10. exit 1
  11. fi
  12. LANGUAGE=$1
  13. base_path="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
  14. if [ ! -f ${base_path}/i18n/translation-templates/README.pot ]; then
  15. echo "Translation templates not found. Please run the `extract-translation-templates.sh` script first."
  16. exit 1
  17. fi
  18. # Create necessary directories to avoid race conditions caused by
  19. # Sphinx potentially trying to concurrently create them from separate threads below.
  20. mkdir -p ${base_path}/i18n/locales/${LANGUAGE}/LC_MESSAGES/docs
  21. # Update the translation files
  22. sphinx-intl update \
  23. --pot-dir ${base_path}/i18n/translation-templates \
  24. --locale-dir ${base_path}/i18n/locales \
  25. --language ${LANGUAGE}