From: Paul Hänsch <paul@plutz.net> Date: Tue, 15 Aug 2023 12:55:26 +0000 (+0200) Subject: various translations X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=65676ea8331f60d882e3baec99c101382e9fad57;p=shellwiki various translations --- 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="<td><a href=\"$(HTML "$page")\">$(HTML "$page")</a><span class=\"date\">${odate%%[+.]*}</span></td>" @@ -40,14 +44,14 @@ page_glob "$glob" "$depth" |while read page; do ) EOF if [ $lstamp -lt $ostamp ] 2>&-; then - row="${row}<td class=\"outdated\"><a href=\"$(HTML "${page}:${l}")\">outdated</a><span class=\"date\">${ldate%%[+.]*}</span></td>" + row="${row}<td class=\"outdated\"><a href=\"$(HTML "${page}:${l}")\">$(_ outdated)</a><span class=\"date\">${ldate%%[+.]*}</span></td>" [ "$rowstate" = "${rowstate%*outdated*}" ] && rowstate="${rowstate}${rowstate:+ }outdated" else - row="${row}<td class=\"current\" ><a href=\"$(HTML "${page}:${l}")\">current</a ><span class=\"date\">${ldate%%[+.]*}</span></td>" + row="${row}<td class=\"current\" ><a href=\"$(HTML "${page}:${l}")\">$(_ current)</a ><span class=\"date\">${ldate%%[+.]*}</span></td>" [ "$rowstate" = "${rowstate%*current*}" ] && rowstate="${rowstate}${rowstate:+ }current" fi else - row="${row}<td class=\"missing\"><a href=\"$(HTML "${page}:${l}")\">missing</a></td>" + row="${row}<td class=\"missing\"><a href=\"$(HTML "${page}:${l}")\">$(_ missing)</a></td>" [ "$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 '<p class="error">%s</p>' "$(HTML "${1:-${ERROR_MSG}}")" + printf '<p class="error">%s</p>' "$(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 '<div class="macro revisions">\n' if [ "$REV_PAGES" != true ]; then - printf '<div class="error">GIT is not available to handle revisioning.</div>' + printf '<div class="error">%s</div>' "$(_ 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 '<section class="diff"><h2>Latest changes to original language page</h2>' + printf '<section class="diff"><h2>%s</h2>' "$(_ '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 ' - <ul class="pagemenu"> - <li><a href="./%%5Bview%%5D">View</a></li> - <li><a href="./%%5Bedit%%5D">Edit</a></li> - <li><a href="./%%5Battachment%%5D">Attachments</a></li> - <li><a href="./%%5Brevision%%5D">Revisions</a></li> - <li><a href="./%%5Brename%%5D">Rename</a></li> - <li><a href="./%%5Bmove%%5D">Move</a></li> - <li><a href="./%%5Bdelete%%5D">Delete</a></li> - </ul>' + cat <<-EOF + <ul class="pagemenu"> + <li><a href="./%5Bview%5D">$(_ View)</a></li> + <li><a href="./%5Bedit%5D">$(_ Edit)</a></li> + <li><a href="./%5Battachment%5D">$(_ Attachments)</a></li> + <li><a href="./%5Brevision%5D">$(_ Revisions)</a></li> + <li><a href="./%5Brename%5D">$(_ Rename)</a></li> + <li><a href="./%5Bmove%5D">$(_ Move)</a></li> + <li><a href="./%5Bdelete%5D">$(_ Delete)</a></li> + </ul> + EOF fi } @@ -74,9 +75,9 @@ theme_editor(){ [ "$template" ] && acl_read "$template" || template="$page" theme_page - "Editor: $title" <<-EOF - <input checked type=radio class=tab name=edithelp value=edtr id=editor><label for=editor>Editor</label> - <input type=radio class=tab name=edithelp value=help id=syntax><label for=syntax>Syntax</label> - <input type=radio class=tab name=edithelp value=att id=attach><label for=attach>Attachments</label> + <input checked type=radio class=tab name=edithelp value=edtr id=editor><label for=editor>$(_ Editor)</label> + <input type=radio class=tab name=edithelp value=help id=syntax><label for=syntax>$(_ Syntax)</label> + <input type=radio class=tab name=edithelp value=att id=attach><label for=attach>$(_ Attachments)</label> $([ "$LANGUAGE_DEFAULT" -a "$LANGUAGE_DEFAULT" != "$LANGUAGE" ] && printf ' <input type=radio class=tab name=edithelp value=att id=transl><label for=transl>%s</label> ' "$LANGUAGE_DEFAULT" @@ -85,8 +86,8 @@ theme_editor(){ <input type=hidden name=session_key value="${SESSION_KEY}"/> <textarea name=pagetext>$({ wiki_text "$page" \ || wiki_text "$template"; } |HTML)</textarea> - <button type=submit name=action value=update>Update</button> - <button type=submit name=action value=cancel>Cancel</button> + <button type=submit name=action value=update>$(_ Update)</button> + <button type=submit name=action value=cancel>$(_ Cancel)</button> </form> <div class="tab syntax">$(wiki "/[wiki]/editorhelp/")</div> <div class="tab attach"> @@ -123,19 +124,19 @@ theme_attachments(){ if acl_write "$page"; then theme_page - "Attachments: $title" <<-EOF <form class=upload method=POST enctype="multipart/form-data"> - <h2>Upload</h2> + <h2>$(_ Upload)</h2> <input type=hidden name=session_id value="$SESSION_ID"> <input type=file name=file multiple> - <button type=submit name=action value=upload>Upload</button> + <button type=submit name=action value=upload>$(_ Upload)</button> </form> <form method=POST> - <h2>Attachments</h2> + <h2>$(_ Attachments)</h2> <input type=hidden name=session_key value="$SESSION_KEY"> - <input checked type=radio class=tab name=attachaction value=view id=tview><label for=tview>View</label> - <input type=radio class=tab name=attachaction value=del id=tdel ><label for=tdel >Delete</label> - <input type=radio class=tab name=attachaction value=move id=tmove><label for=tmove>Move</label> - <input type=radio class=tab name=attachaction value=ren id=tren ><label for=tren >Rename</label> + <input checked type=radio class=tab name=attachaction value=view id=tview><label for=tview>$(_ View)</label> + <input type=radio class=tab name=attachaction value=del id=tdel ><label for=tdel >$(_ Delete)</label> + <input type=radio class=tab name=attachaction value=move id=tmove><label for=tmove>$(_ Move)</label> + <input type=radio class=tab name=attachaction value=ren id=tren ><label for=tren >$(_ Rename)</label> <div class="tab"> <ul class="attachment list"> $(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) </ul> - <button type=submit name=action value=delete>Delete</button> - <label for=moveto>Move To:</label> - <input id="moveto" name="moveto" value="$(HTML "$page")" placeholder="page name"> - <button type=submit name=action value=move >Move</button> - <button type=submit name=action value=rename>Rename</button> + <button type=submit name=action value=delete>$(_ Delete)</button> + <label for=moveto>$(_ Move To:)</label> + <input id="moveto" name="moveto" value="$(HTML "$page")" placeholder="$(_ page name)"> + <button type=submit name=action value=move >$(_ Move)</button> + <button type=submit name=action value=rename>$(_ Rename)</button> </div> </form> EOF