From a26c541b845f86aa37b872d06ab3bf51e8206be8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Thu, 24 Aug 2023 16:39:22 +0200 Subject: [PATCH] additional translations and translatability --- handlers/20_title.sh | 4 +- handlers/40_edit_attachment.sh | 20 ++++---- handlers/60_move_rename_delete.sh | 82 ++++++++++++++++++++----------- l10n/de.sh | 59 ++++++++++++++++++++++ themes/default.sh | 4 +- 5 files changed, 127 insertions(+), 42 deletions(-) diff --git a/handlers/20_title.sh b/handlers/20_title.sh index a0079d2..a7c98a5 100755 --- a/handlers/20_title.sh +++ b/handlers/20_title.sh @@ -29,10 +29,10 @@ fi case $PATH_INFO in *"/[attachment]") - PAGE_TITLE="${PAGE_TITLE} (Attachments)" + PAGE_TITLE="${PAGE_TITLE} ($(_ Attachments))" ;; *"/[revision]") - PAGE_TITLE="${PAGE_TITLE} (Revisions)" + PAGE_TITLE="${PAGE_TITLE} ($(_ Revisions))" ;; esac diff --git a/handlers/40_edit_attachment.sh b/handlers/40_edit_attachment.sh index 97a4b9d..2696a4d 100755 --- a/handlers/40_edit_attachment.sh +++ b/handlers/40_edit_attachment.sh @@ -163,51 +163,51 @@ elif [ "$action" = rename ]; then if [ "$success" -a "$fail" ]; then printf "%s\r\n" "Status: 500 Internal Server Error" - theme_page - "Attachment rename" <<-EOF -

Some files could not be renamed

-

Successfully renamed:

+ theme_page - "$(_ "Attachment rename")" <<-EOF +

$(_ Some files could not be renamed)

+

$(_ Successfully renamed:)

-

Errors:

+

$(_ Errors:)

- OK + $(_ OK) EOF exit 0 elif [ "$fail" ]; then printf "%s\r\n" "Status: 500 Internal Server Error" - theme_page - "Attachment rename" <<-EOF -

Files could not be renamed

+ theme_page - "$(_ "Attachment rename")" <<-EOF +

$(_ "Files could not be renamed")

- OK + $(_ OK) EOF exit 0 elif [ "$success" ]; then printf 'Refresh: %i\r\n' 4 theme_page - "Attachment rename" <<-EOF -

Files were renamed

+

$(_ Files were renamed)

- OK + $(_ OK) EOF exit 0 diff --git a/handlers/60_move_rename_delete.sh b/handlers/60_move_rename_delete.sh index bbe994e..3879e9b 100755 --- a/handlers/60_move_rename_delete.sh +++ b/handlers/60_move_rename_delete.sh @@ -1,5 +1,14 @@ #!/bin/sh +l10n_immutablepage >/dev/null \ +|| l10n_immutablepage(){ #TRANSLATION + cat <<-EOF +

Immutable Page

+ This is a core page of the wiki system. Its name and position cannot be changed. + You may however update this page and you can use ACLs to hide it from various listings. + EOF +} + case "${PATH_INFO}" in */\[move\]|*/\[rename\]|*/\[delete\]) page="${PATH_INFO%\[*\]}" @@ -14,9 +23,7 @@ case "${PATH_INFO}" in theme_page - <<-EOF

-

Immutable Page

- This is a core page of the wiki system. Its name and position cannot be changed. - You may however update this page and you can use ACLs to hide it from various listings. + $(l10n_immutablepage)

EOF @@ -26,16 +33,9 @@ case "${PATH_INFO}" in *) return 1;; esac -if [ "$REQUEST_METHOD" = POST ]; then - action="$(POST action)" - newname="$(POST newname |grep -m1 -xE '[^#/]*')" - newlocation="$(POST newlocation |grep -m1 -xE '/[^#]*')" -else case "${PATH_INFO}" in - */\[move\]) - location="${page%/}" location="${location%/*}/" - theme_page - <<-EOF -
- +l10n_movepage >/dev/null \ +|| l10n_movepage(){ # TRANSLATION + cat <<-EOF

Move Page

$(HTML "${page}")

@@ -47,15 +47,11 @@ else case "${PATH_INFO}" in -
EOF - return 0 - ;; - */\[rename\]) - name="${page%/}" name="${name##*/}" - theme_page - <<-EOF -
- +} +l10n_renamepage >/dev/null \ +|| l10n_renamepage(){ # TRANSLATION + cat <<-EOF

Rename Page

$(HTML "${page}")

@@ -67,14 +63,11 @@ else case "${PATH_INFO}" in -
EOF - return 0 - ;; - */\[delete\]) - theme_page - <<-EOF -
- +} +l10n_deletepage >/dev/null \ +|| l10n_deletepage(){ # TRANSLATION + cat <<-EOF

Delete Page

$(HTML "${page}")

This page and its attachments will be deleted

@@ -85,6 +78,39 @@ else case "${PATH_INFO}" in + EOF +} + +if [ "$REQUEST_METHOD" = POST ]; then + action="$(POST action)" + newname="$(POST newname |grep -m1 -xE '[^#/]*')" + newlocation="$(POST newlocation |grep -m1 -xE '/[^#]*')" +else case "${PATH_INFO}" in + */\[move\]) + location="${page%/}" location="${location%/*}/" + theme_page - <<-EOF + + + $(l10n_movepage) +
+ EOF + return 0 + ;; + */\[rename\]) + name="${page%/}" name="${name##*/}" + theme_page - <<-EOF +
+ + $(l10n_renamepage) +
+ EOF + return 0 + ;; + */\[delete\]) + theme_page - <<-EOF +
+ + $(l10n_deletepage)
EOF return 0 diff --git a/l10n/de.sh b/l10n/de.sh index eea6e25..9cd715b 100644 --- a/l10n/de.sh +++ b/l10n/de.sh @@ -31,6 +31,13 @@ case $* in 'Latest changes to the original language page') printf 'Letzte Änderungen der originalsprachlichen Seite';; 'GIT is not available to handle revisioning.') printf 'GIT steht nicht zur Verfügung um Revisionierung zu handhaben';; '(never edited)') printf '(nie bearbeitet)';; + "Attachment rename") printf "Anhänge umbenennen";; + "Errors:") printf "Fehler:";; + "Files could not be renamed") printf "Dateien konnten nicht umbenannt werden";; + "Files were renamed") printf "Dateien wurden umbenannt";; + "OK") printf "OK";; + "Some files could not be renamed") printf "Einige Dateien konnten nicht umbenannt werden";; + "Successfully renamed:") printf "Erfolgreich umbenannt:";; *) printf %s\\n "$*";; esac } @@ -187,3 +194,55 @@ w_user_login_logoff(){ # TRANSLATION ] EOF } + +l10n_immutablepage(){ #TRANSLATION + cat <<-EOF +

Unveränderliche Seite

+ Dies ist eine Kernseite des Wikisystems. Name und Ort können nicht verändert werden. + Sie können jedoch den Inhalt der Seite ändern und Sie können ACLs nutzen um die Seite zu verstecken. + EOF +} +l10n_movepage(){ # TRANSLATION + cat <<-EOF +

Seite verschieben

+

$(HTML "${page}")

+ + + + + EOF +} +l10n_renamepage(){ # TRANSLATION + cat <<-EOF +

Seite Umbenennen

+

$(HTML "${page}")

+ + + + + EOF +} +l10n_deletepage(){ # TRANSLATION + cat <<-EOF +

Seite Löschen

+

$(HTML "${page}")

+

Diese Seite und all ihre Anhänge werden gelöscht.

+ + + + EOF +} diff --git a/themes/default.sh b/themes/default.sh index de35787..3c5a87f 100755 --- a/themes/default.sh +++ b/themes/default.sh @@ -122,7 +122,7 @@ theme_attachments(){ title="${page%/}"; title="${title##*/}" if acl_write "$page"; then - theme_page - "Attachments: $title" <<-EOF + theme_page - "$(_ Attachments): $title" <<-EOF

$(_ Upload)

@@ -167,7 +167,7 @@ theme_attachments(){
EOF else - theme_page - "Attachments: $title" <<-EOF + theme_page - "$(_ Attachments): $title" <<-EOF