*** Wartungsfenster jeden ersten Mittwoch vormittag im Monat ***

Skip to content
Snippets Groups Projects
Commit bfefb951 authored by Moser, Maximilian's avatar Moser, Maximilian
Browse files

Update translation infrastructure like in Invenio-Config-TUW

* enhance `babel.sh` script
* remove broken config items from `babel.ini`
* add translations entrypoint
parent 08d71529
Branches
Tags
1 merge request!170Add clarifying statement about curation workflow, and update translation infastructure
...@@ -12,6 +12,7 @@ Changes ...@@ -12,6 +12,7 @@ Changes
Version <next> Version <next>
- Update notification email text - Update notification email text
- Update translation infrastructure
Version 2025.1.1 (released 2025-02-04) Version 2025.1.1 (released 2025-02-04)
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Copyright (C) 2020 - 2021 TU Wien. # Copyright (C) 2020 - 2025 TU Wien.
# #
# Invenio-Theme-TUW is free software; you can redistribute it and/or modify # Invenio-Theme-TUW is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details. # it under the terms of the MIT License; see LICENSE file for more details.
...@@ -14,7 +14,6 @@ encoding = utf-8 ...@@ -14,7 +14,6 @@ encoding = utf-8
[jinja2: **/templates/**.html] [jinja2: **/templates/**.html]
encoding = utf-8 encoding = utf-8
extensions = jinja2.ext.autoescape, jinja2.ext.with_
# Extraction from JavaScript files # Extraction from JavaScript files
......
#!/bin/bash #!/bin/bash
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Copyright (C) 2024 TU Wien. # Copyright (C) 2024-2025 TU Wien.
# #
# Invenio-Theme-TUW is free software; you can redistribute it and/or modify # Invenio-Theme-TUW is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details. # it under the terms of the MIT License; see LICENSE file for more details.
function usage() {
echo "usage: ${0} <COMMAND> [args...]"
echo
echo "available commands: compile, extract, init, update"
}
if [[ $# -lt 1 ]]; then if [[ $# -lt 1 ]]; then
echo >&2 "error: expected at least one argument" usage >&2
exit 1
fi fi
case "${1}" in command="${1}"
shift
case "${command}" in
init) init)
pybabel init \ pybabel init \
--input-file "invenio_theme_tuw/translations/messages.pot" \ --input-file "invenio_theme_tuw/translations/messages.pot" \
--output-dir "invenio_theme_tuw/translations/" --output-dir "invenio_theme_tuw/translations/" \
"${@}"
;; ;;
compile) compile)
pybabel compile \ pybabel compile \
--directory "invenio_theme_tuw/translations/" --directory "invenio_theme_tuw/translations/" \
"${@}"
;; ;;
extract) extract)
pybabel extract \ pybabel extract \
...@@ -26,15 +37,20 @@ case "${1}" in ...@@ -26,15 +37,20 @@ case "${1}" in
--msgid-bugs-address "tudata@tuwien.ac.at" \ --msgid-bugs-address "tudata@tuwien.ac.at" \
--mapping-file "babel.ini" \ --mapping-file "babel.ini" \
--output-file "invenio_theme_tuw/translations/messages.pot" \ --output-file "invenio_theme_tuw/translations/messages.pot" \
--add-comments "NOTE" --add-comments "NOTE" \
invenio_theme_tuw \
"${@}"
;; ;;
update) update)
pybabel update \ pybabel update \
--input-file "invenio_theme_tuw/translations/messages.pot" \ --input-file "invenio_theme_tuw/translations/messages.pot" \
--output-dir "invenio_theme_tuw/translations/" --output-dir "invenio_theme_tuw/translations/" \
"${@}"
;; ;;
*) *)
echo >&2 "unknown command: ${1}" echo >&2 "error: unknown command: ${command}"
echo >&2
usage >&2
exit 1 exit 1
;; ;;
esac esac
...@@ -79,6 +79,9 @@ invenio_theme_tuw_theme = "invenio_theme_tuw.webpack:theme" ...@@ -79,6 +79,9 @@ invenio_theme_tuw_theme = "invenio_theme_tuw.webpack:theme"
[project.entry-points."invenio_config.module"] [project.entry-points."invenio_config.module"]
invenio_theme_tuw = "invenio_theme_tuw.config" invenio_theme_tuw = "invenio_theme_tuw.config"
[project.entry-points."invenio_i18n.translations"]
messages = "invenio_theme_tuw"
# configuration for tools # configuration for tools
[tool.isort] [tool.isort]
profile = "black" profile = "black"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment