From 65676ea8331f60d882e3baec99c101382e9fad57 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Tue, 15 Aug 2023 14:55:26 +0200 Subject: [PATCH] various translations --- handlers/10_translations.sh | 5 +++- l10n/de.sh | 39 ++++++++++++++++++++++++-- macros/changes | 12 +++++--- macros/errormessage | 5 +++- macros/revisions | 8 ++++-- macros/wikiform | 1 + themes/default.sh | 55 +++++++++++++++++++------------------ 7 files changed, 88 insertions(+), 37 deletions(-) diff --git a/handlers/10_translations.sh b/handlers/10_translations.sh index e93b465..642d9c3 100755 --- a/handlers/10_translations.sh +++ b/handlers/10_translations.sh @@ -28,7 +28,9 @@ case ${PATH_INFO} in PATH_INFO="${PATH_INFO%:?*/\[attachment\]}[attachment]" ;; */:?*/\[*\]) - :;; # Default handler, considered valid in most cases + LANGUAGE="${PATH_INFO#*/:}" + LANGUAGE="${LANGUAGE%%/*}" + ;; */:?*/:?*) # Accidental double language link, last one stays valid! REDIRECT "${_BASE}${PATH_INFO%/:?*/:?*}/:${PATH_INFO##*/:}" @@ -67,6 +69,7 @@ case ${PATH_INFO} in ;; esac +_(){ printf %s\\n "$*"; } [ -r "${_EXEC}/l10n/${LANGUAGE}.sh" ] && . "${_EXEC}/l10n/${LANGUAGE}.sh" return 1 diff --git a/l10n/de.sh b/l10n/de.sh index d2783ac..6e406f8 100644 --- a/l10n/de.sh +++ b/l10n/de.sh @@ -1,5 +1,40 @@ #!/bin/sh +_(){ +case $* in + 'Page names containing newline character are not allowed') printf 'Seitennamen mit Zeilenumbruch sind nicht erlaubt';; + 'Page names starting with "#" are not allowed') printf 'Seitennamen dürfen nicht mit "#" anfangen';; + 'Formdata invalid') printf 'Formulardaten ungültig';; + 'Page name required') printf 'Seitenname erforderlich';; + 'Page exists already') printf 'Seite existiert schon';; + "You don't have permission to write to this page") printf 'Keine Berechtigung auf diese Seite zu schreiben';; + 'Unable to lock page for editing') printf 'Kann Seite nicht zum bearbeiten sperren';; + 'TRANSLATION NOT FOUND') printf 'Übersetzung nicht gefunden';; + 'The presented URL schema cannot be handled') printf 'Das angegeben URL Schema kann nicht verarbeitet werden';; + 'missing') printf 'fehlt';; + 'outdated') printf 'veraltet';; + 'current') printf 'aktuell';; + 'View') printf 'Anzeigen';; + 'Edit') printf 'Bearbeiten';; + 'Attachments') printf 'Anhänge';; + 'Revisions') printf 'Revisionen';; + 'Rename') printf 'Umbenennen';; + 'Move') printf 'Verschieben';; + 'Delete') printf 'Löschen';; + 'Update') printf 'Aktualisieren';; + 'Cancel') printf 'Abbrechen';; + 'Editor') printf 'Editor';; + 'Syntax') printf 'Syntax';; + 'page name') printf 'Seitenname';; + 'Upload') printf 'Hochladen';; + 'Move To:') printf 'Verschieben nach:';; + '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)';; + *) printf %s\\n "$*";; +esac +} + user_register_email() { # TRANSLATION "$SENDMAIL" -t -f "$MAILFROM" <<-EOF From: ${MAILFROM} @@ -138,7 +173,7 @@ w_user_login_logon(){ # TRANSLATION [form #user_login .login method=POST [input name=uname placeholder="Benutzername oder Email-Adresse" autocomplete=off] [input type=password name=pw placeholder="Passwort"] - [submit "action" "user_login" Einloggen] + [submit "action" "user_login" Anmelden] ] EOF } @@ -146,7 +181,7 @@ w_user_login_logoff(){ # TRANSLATION cat <<-EOF [form #user_login .logout method=POST [p Logged in as [span . $(HTML ${USER_NAME})]] - [submit "action" "user_logout" Ausloggen] + [submit "action" "user_logout" Abmelden] ] EOF } diff --git a/macros/changes b/macros/changes index 562fa8f..8714976 100755 --- a/macros/changes +++ b/macros/changes @@ -4,6 +4,9 @@ . "$_EXEC/tools.sh" . "$_EXEC/acl.sh" +_(){ printf %s\\n "$*"; } +[ "${LANGUAGE}" -a -r "${_EXEC}/l10n/${LANGUAGE}.sh" ] && . "${_EXEC}/l10n/${LANGUAGE}.sh" + LANGUAGES='' glob="/" depth=-1 while [ $# -gt 0 ]; do case $1 in --system) glob_system_pages=true; shift 1;; @@ -25,7 +28,8 @@ page_glob "$glob" "$depth" |while read page; do read ostamp odate <<-EOF $([ "$REV_PAGES" = true ] \ && git -C "$_DATA" log --pretty="format:%at %ai" -- "pages${page_abs}#page.md" \ - || stat -c "%Y %y" -- "$_DATA/pages${page_abs}#page.md" + || stat -c "%Y %y" -- "$_DATA/pages${page_abs}#page.md" 2>&- \ + || printf "0 %s\n" "$(_ "(never edited)")" ) EOF row="$(HTML "$page")${odate%%[+.]*}" @@ -40,14 +44,14 @@ page_glob "$glob" "$depth" |while read page; do ) EOF if [ $lstamp -lt $ostamp ] 2>&-; then - row="${row}outdated${ldate%%[+.]*}" + row="${row}$(_ outdated)${ldate%%[+.]*}" [ "$rowstate" = "${rowstate%*outdated*}" ] && rowstate="${rowstate}${rowstate:+ }outdated" else - row="${row}current${ldate%%[+.]*}" + row="${row}$(_ current)${ldate%%[+.]*}" [ "$rowstate" = "${rowstate%*current*}" ] && rowstate="${rowstate}${rowstate:+ }current" fi else - row="${row}missing" + row="${row}$(_ missing)" [ "$rowstate" = "${rowstate%*missing*}" ] && rowstate="${rowstate}${rowstate:+ }missing" fi done diff --git a/macros/errormessage b/macros/errormessage index ff1e06e..b42e426 100755 --- a/macros/errormessage +++ b/macros/errormessage @@ -2,6 +2,9 @@ . "$_EXEC/cgilite/cgilite.sh" +_(){ printf %s\\n "$*"; } +[ "${LANGUAGE}" -a -r "${_EXEC}/l10n/${LANGUAGE}.sh" ] && . "${_EXEC}/l10n/${LANGUAGE}.sh" + if [ "$1" -o "$ERROR_MSG" ]; then - printf '

%s

' "$(HTML "${1:-${ERROR_MSG}}")" + printf '

%s

' "$(HTML "$(_ ${1:-${ERROR_MSG}})")" fi diff --git a/macros/revisions b/macros/revisions index 75440d6..5d7b589 100755 --- a/macros/revisions +++ b/macros/revisions @@ -4,6 +4,9 @@ . "$_EXEC/tools.sh" . "$_EXEC/acl.sh" +_(){ printf %s\\n "$*"; } +[ "${LANGUAGE}" -a -r "${_EXEC}/l10n/${LANGUAGE}.sh" ] && . "${_EXEC}/l10n/${LANGUAGE}.sh" + LIST=true DIFF= while [ $# -gt 0 ]; do case $1 in --list) @@ -37,7 +40,8 @@ fi printf '
\n' if [ "$REV_PAGES" != true ]; then - printf '
GIT is not available to handle revisioning.
' + printf '
%s
' "$(_ GIT is not available to handle revisioning.)" + exit 1 fi if [ "$LIST" = true ]; then @@ -57,7 +61,7 @@ fi if [ "$DIFF" = true -a "$LANGUAGE_DEFAULT" -a "$page_default" != "$page_abs" ]; then commit="$(git -C "$_DATA" log --pretty=format:%H -- "pages${page_abs}#page.md" |head -n1)" - printf '

Latest changes to original language page

' + printf '

%s

' "$(_ 'Latest changes to the original language page')" git -C "$_DATA" diff -U3 "$commit" -- "pages${page_default}#page.md" |tail -n+5 \ | while read -r diff; do case $diff in @@\ *\ @@*) diff --git a/macros/wikiform b/macros/wikiform index 9a736da..4fe285e 100755 --- a/macros/wikiform +++ b/macros/wikiform @@ -5,6 +5,7 @@ action="$1" . "$_EXEC/cgilite/cgilite.sh" . "$_EXEC/cgilite/users.sh" +_(){ printf %s\\n "$*"; } [ "${LANGUAGE}" -a -r "${_EXEC}/l10n/${LANGUAGE}.sh" ] && . "${_EXEC}/l10n/${LANGUAGE}.sh" case $action in diff --git a/themes/default.sh b/themes/default.sh index 6c761a7..de35787 100755 --- a/themes/default.sh +++ b/themes/default.sh @@ -25,16 +25,17 @@ theme_pagemenu(){ local page="$1" if acl_write "$page"; then - printf ' - ' + cat <<-EOF + + EOF fi } @@ -74,9 +75,9 @@ theme_editor(){ [ "$template" ] && acl_read "$template" || template="$page" theme_page - "Editor: $title" <<-EOF - - - + + + $([ "$LANGUAGE_DEFAULT" -a "$LANGUAGE_DEFAULT" != "$LANGUAGE" ] && printf ' ' "$LANGUAGE_DEFAULT" @@ -85,8 +86,8 @@ theme_editor(){ - - + +
$(wiki "/[wiki]/editorhelp/")
@@ -123,19 +124,19 @@ theme_attachments(){ if acl_write "$page"; then theme_page - "Attachments: $title" <<-EOF
-

Upload

+

$(_ Upload)

- +
-

Attachments

+

$(_ Attachments)

- - - - + + + +
    $(for file in "$_EXEC/pages/$page/#attachments"/* "$_DATA/pages/$page/#attachments"/*; do @@ -157,11 +158,11 @@ theme_attachments(){ "$(size_human "$size")" "$(date -d @"$date" +"%F %T")" done)
- - - - - + + + + +
EOF -- 2.39.2