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.
 
 

39 lines
1.6 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 extracts translation templates (original English strings) into the `translation-templates/` directory.
  6. # These templates are later used to generate locale files for each language in the `locales/` directory.
  7. #
  8. # By default `sphinx-build` extracts the templates into a `build/gettext` directory, while we'd like to have them in the `translation-templates/` directory.
  9. # To avoid the `POT-Creation-Date` information in templates being updated every time we extract them,
  10. # we restore the `translation-templates/` directory to the `build/gettext` directory before running the script.
  11. set -euxo pipefail
  12. base_path="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
  13. # Restore the `translation-templates/` directory to the `build/gettext` directory
  14. if [ -d ${base_path}/i18n/build ]; then
  15. rm -rf ${base_path}/i18n/build
  16. fi
  17. mkdir -p ${base_path}/i18n/build
  18. cp -r ${base_path}/i18n/translation-templates ${base_path}/i18n/build/gettext
  19. # Extract translation templates from the documentation into the `build/gettext` directory
  20. sphinx-build -M gettext ${base_path} ${base_path}/i18n/build
  21. # Clean up the build directory
  22. rm -rf ${base_path}/i18n/build/gettext/.doctrees
  23. # Update the `translation-templates/` directory with the new templates
  24. if [ -d ${base_path}/i18n/translation-templates ]; then
  25. rm -rf ${base_path}/i18n/translation-templates
  26. fi
  27. mv ${base_path}/i18n/build/gettext ${base_path}/i18n/translation-templates
  28. # Get rid of the `build` directory
  29. rmdir ${base_path}/i18n/build