release 1.20.0: domains.conf locale l10n + optional German UI
Add locale column (fr-CH for FP, de-CH elsewhere; ch-FR/ch-DE aliases). Introduce UI lang=de (tags + sticky) without using de as any stock default.
This commit is contained in:
parent
51b552d214
commit
c7cecfc6d5
8 changed files with 408 additions and 163 deletions
233
i18n.sh
233
i18n.sh
|
|
@ -1,19 +1,24 @@
|
|||
#!/usr/bin/env bash
|
||||
# i18n.sh — language for taler-monitoring console + HTML chrome
|
||||
# i18n.sh — UI language + regional locale for taler-monitoring console + HTML
|
||||
#
|
||||
# TALER_MON_LANG=en|fr
|
||||
# TALER_MON_LANG_SET=1 → language is explicit (--lang only); do not override.
|
||||
# Auto (SET≠1), in order:
|
||||
# 1) TALER_DOMAIN_LANG from domains.conf profile (preferred — source of truth)
|
||||
# 2) fallback hostname heuristic *lefrancpaysan*/*francpaysan* → fr
|
||||
# 3) else keep workstation env TALER_MON_LANG or en
|
||||
# UI language (mon badges / sticky chrome):
|
||||
# TALER_MON_LANG=en|fr|de
|
||||
# TALER_MON_LANG_SET=1 → explicit (--lang); do not override.
|
||||
# Auto (SET≠1): TALER_DOMAIN_LANG from domains.conf `lang` column.
|
||||
# de is supported but never a stock profile default (no domains.conf row uses lang=de).
|
||||
#
|
||||
# domains.conf column `lang` (see suite domains.conf) is the global definition.
|
||||
# Bare TALER_MON_LANG=en in ~/.config must not override a profile lang=fr.
|
||||
# Regional locale (l10n defaults, BCP 47 — not the same as UI lang):
|
||||
# TALER_MON_LOCALE / TALER_DOMAIN_LOCALE e.g. fr-CH, de-CH
|
||||
# From domains.conf `locale` column (fr-CH for FP, de-CH for others).
|
||||
# Aliases ch-FR / ch-DE accepted and normalized to fr-CH / de-CH.
|
||||
#
|
||||
# domains.conf is the source of truth for both lang and locale.
|
||||
|
||||
: "${TALER_MON_LANG:=}"
|
||||
: "${TALER_MON_LANG_SET:=0}"
|
||||
: "${TALER_DOMAIN_LANG:=}"
|
||||
: "${TALER_DOMAIN_LOCALE:=}"
|
||||
: "${TALER_MON_LOCALE:=}"
|
||||
|
||||
i18n_init() {
|
||||
# Only TALER_MON_LANG_SET=1 is "explicit". Do not promote non-empty TALER_MON_LANG
|
||||
|
|
@ -24,7 +29,6 @@ i18n_init() {
|
|||
else
|
||||
case "${TALER_DOMAIN:-}" in
|
||||
*lefrancpaysan*|*francpaysan*)
|
||||
# fallback if domain not (yet) in domains.conf
|
||||
TALER_MON_LANG=fr
|
||||
;;
|
||||
*)
|
||||
|
|
@ -37,89 +41,162 @@ i18n_init() {
|
|||
fi
|
||||
case "${TALER_MON_LANG}" in
|
||||
fr|FR|fra|french) TALER_MON_LANG=fr ;;
|
||||
de|DE|deu|ger|german|deutsch) TALER_MON_LANG=de ;;
|
||||
*) TALER_MON_LANG=en ;;
|
||||
esac
|
||||
|
||||
# Regional locale from profile (or FP/other fallback)
|
||||
if [ -n "${TALER_DOMAIN_LOCALE:-}" ]; then
|
||||
TALER_MON_LOCALE="$TALER_DOMAIN_LOCALE"
|
||||
elif [ -z "${TALER_MON_LOCALE:-}" ]; then
|
||||
case "${TALER_DOMAIN:-}" in
|
||||
*lefrancpaysan*|*francpaysan*) TALER_MON_LOCALE=fr-CH ;;
|
||||
*) TALER_MON_LOCALE=de-CH ;;
|
||||
esac
|
||||
fi
|
||||
# normalize aliases
|
||||
case "$(printf '%s' "$TALER_MON_LOCALE" | tr '[:upper:]' '[:lower:]' | tr '_' '-')" in
|
||||
fr-ch|ch-fr) TALER_MON_LOCALE=fr-CH ;;
|
||||
de-ch|ch-de) TALER_MON_LOCALE=de-CH ;;
|
||||
en-ch|ch-en) TALER_MON_LOCALE=en-CH ;;
|
||||
esac
|
||||
|
||||
export TALER_MON_LANG
|
||||
export TALER_MON_LANG_SET
|
||||
export TALER_DOMAIN_LANG
|
||||
export TALER_DOMAIN_LOCALE
|
||||
export TALER_MON_LOCALE
|
||||
}
|
||||
|
||||
i18n_tag() {
|
||||
local t="$1"
|
||||
if [ "${TALER_MON_LANG:-en}" != "fr" ]; then
|
||||
printf '%s' "$t"
|
||||
return 0
|
||||
fi
|
||||
case "$t" in
|
||||
OK) printf 'OK' ;;
|
||||
ERROR) printf 'ERREUR' ;;
|
||||
WARN) printf 'AVERT' ;;
|
||||
INFO) printf 'INFO' ;;
|
||||
BLOCKER) printf 'BLOCAGE' ;;
|
||||
BLOCK) printf 'BLOC' ;;
|
||||
SUMMARY) printf 'RESUME' ;;
|
||||
PROG|PROGRESS) printf 'PROG' ;;
|
||||
*) printf '%s' "$t" ;;
|
||||
case "${TALER_MON_LANG:-en}" in
|
||||
fr)
|
||||
case "$t" in
|
||||
OK) printf 'OK' ;;
|
||||
ERROR) printf 'ERREUR' ;;
|
||||
WARN) printf 'AVERT' ;;
|
||||
INFO) printf 'INFO' ;;
|
||||
BLOCKER) printf 'BLOCAGE' ;;
|
||||
BLOCK) printf 'BLOC' ;;
|
||||
SUMMARY) printf 'RESUME' ;;
|
||||
PROG|PROGRESS) printf 'PROG' ;;
|
||||
*) printf '%s' "$t" ;;
|
||||
esac
|
||||
;;
|
||||
de)
|
||||
case "$t" in
|
||||
OK) printf 'OK' ;;
|
||||
ERROR) printf 'FEHLER' ;;
|
||||
WARN) printf 'WARNUNG' ;;
|
||||
INFO) printf 'INFO' ;;
|
||||
BLOCKER) printf 'BLOCKER' ;;
|
||||
BLOCK) printf 'BLOCK' ;;
|
||||
SUMMARY) printf 'ZUSAMMENFASSUNG' ;;
|
||||
PROG|PROGRESS) printf 'PROG' ;;
|
||||
*) printf '%s' "$t" ;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
printf '%s' "$t"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
i18n_text() {
|
||||
local s="$*"
|
||||
if [ "${TALER_MON_LANG:-en}" != "fr" ] || [ -z "$s" ]; then
|
||||
printf '%s' "$s"
|
||||
return 0
|
||||
fi
|
||||
case "$s" in
|
||||
"numbered checks this run:") printf 'controles numerotes de cette execution :' ;;
|
||||
"numbered checks:") printf 'controles numerotes :' ;;
|
||||
"(global done/total)") printf '(fait/total global)' ;;
|
||||
"global checks:") printf 'controles globaux :' ;;
|
||||
"failed — see list above"|"failed - see list above") printf 'echec — voir la liste ci-dessus' ;;
|
||||
"BLOCKERS · pay/withdraw cannot finish") printf 'BLOCAGES · paiement/retrait impossible' ;;
|
||||
"BLOCKERS (pay/withdraw cannot finish)") printf 'BLOCAGES (paiement/retrait impossible)' ;;
|
||||
"ERRORS · failed checks") printf 'ERREURS · controles en echec' ;;
|
||||
"ERRORS (failed checks)") printf 'ERREURS (controles en echec)' ;;
|
||||
"pay/withdraw cannot finish") printf 'paiement/retrait impossible a terminer' ;;
|
||||
"SUMMARY") printf 'RESUME' ;;
|
||||
"totals:") printf 'totaux :' ;;
|
||||
"all clear") printf 'tout est clair' ;;
|
||||
"warnings only (no hard fail)") printf 'avertissements seulement (pas d'\''echec dur)' ;;
|
||||
"monitoring") printf 'surveillance' ;;
|
||||
"surface") printf 'surface' ;;
|
||||
"aptdeploy") printf 'aptdeploy' ;;
|
||||
"container") printf 'conteneur' ;;
|
||||
"disk") printf 'disque' ;;
|
||||
"package") printf 'paquet' ;;
|
||||
"version") printf 'version' ;;
|
||||
"reachability") printf 'accessibilite' ;;
|
||||
"server-header") printf 'en-tete Server' ;;
|
||||
"inventory") printf 'inventaire' ;;
|
||||
"flags") printf 'options' ;;
|
||||
"target domain") printf 'domaine cible' ;;
|
||||
"currency") printf 'devise' ;;
|
||||
"phases") printf 'phases' ;;
|
||||
"access") printf 'acces' ;;
|
||||
[ -z "$s" ] && { printf '%s' "$s"; return 0; }
|
||||
case "${TALER_MON_LANG:-en}" in
|
||||
fr)
|
||||
case "$s" in
|
||||
"numbered checks this run:") printf 'controles numerotes de cette execution :' ;;
|
||||
"numbered checks:") printf 'controles numerotes :' ;;
|
||||
"(global done/total)") printf '(fait/total global)' ;;
|
||||
"global checks:") printf 'controles globaux :' ;;
|
||||
"failed — see list above"|"failed - see list above") printf 'echec — voir la liste ci-dessus' ;;
|
||||
"BLOCKERS · pay/withdraw cannot finish") printf 'BLOCAGES · paiement/retrait impossible' ;;
|
||||
"BLOCKERS (pay/withdraw cannot finish)") printf 'BLOCAGES (paiement/retrait impossible)' ;;
|
||||
"ERRORS · failed checks") printf 'ERREURS · controles en echec' ;;
|
||||
"ERRORS (failed checks)") printf 'ERREURS (controles en echec)' ;;
|
||||
"pay/withdraw cannot finish") printf 'paiement/retrait impossible a terminer' ;;
|
||||
"SUMMARY") printf 'RESUME' ;;
|
||||
"totals:") printf 'totaux :' ;;
|
||||
"all clear") printf 'tout est clair' ;;
|
||||
"warnings only (no hard fail)") printf 'avertissements seulement (pas d'\''echec dur)' ;;
|
||||
"monitoring") printf 'surveillance' ;;
|
||||
"surface") printf 'surface' ;;
|
||||
"aptdeploy") printf 'aptdeploy' ;;
|
||||
"container") printf 'conteneur' ;;
|
||||
"disk") printf 'disque' ;;
|
||||
"package") printf 'paquet' ;;
|
||||
"version") printf 'version' ;;
|
||||
"reachability") printf 'accessibilite' ;;
|
||||
"server-header") printf 'en-tete Server' ;;
|
||||
"inventory") printf 'inventaire' ;;
|
||||
"flags") printf 'options' ;;
|
||||
"target domain") printf 'domaine cible' ;;
|
||||
"currency") printf 'devise' ;;
|
||||
"phases") printf 'phases' ;;
|
||||
"access") printf 'acces' ;;
|
||||
*)
|
||||
local out="$s"
|
||||
out=${out//shared library missing/bibliotheque partagee manquante}
|
||||
out=${out//not active/non actif}
|
||||
out=${out//does not resolve/ne resout pas}
|
||||
out=${out//from Server header/depuis en-tete Server}
|
||||
out=${out//public HTTPS/HTTPS public}
|
||||
out=${out//no SSH/sans SSH}
|
||||
out=${out//failed — see list above/echec — voir la liste ci-dessus}
|
||||
printf '%s' "$out"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
de)
|
||||
case "$s" in
|
||||
"numbered checks this run:") printf 'Nummerierte Pruefungen dieser Ausfuehrung :' ;;
|
||||
"numbered checks:") printf 'Nummerierte Pruefungen :' ;;
|
||||
"(global done/total)") printf '(fertig/gesamt global)' ;;
|
||||
"global checks:") printf 'Globale Pruefungen :' ;;
|
||||
"failed — see list above"|"failed - see list above") printf 'fehlgeschlagen — siehe Liste oben' ;;
|
||||
"BLOCKERS · pay/withdraw cannot finish") printf 'BLOCKER · Zahlung/Abhebung nicht moeglich' ;;
|
||||
"BLOCKERS (pay/withdraw cannot finish)") printf 'BLOCKER (Zahlung/Abhebung nicht moeglich)' ;;
|
||||
"ERRORS · failed checks") printf 'FEHLER · fehlgeschlagene Pruefungen' ;;
|
||||
"ERRORS (failed checks)") printf 'FEHLER (fehlgeschlagene Pruefungen)' ;;
|
||||
"pay/withdraw cannot finish") printf 'Zahlung/Abhebung kann nicht beendet werden' ;;
|
||||
"SUMMARY") printf 'ZUSAMMENFASSUNG' ;;
|
||||
"totals:") printf 'Summen :' ;;
|
||||
"all clear") printf 'alles in Ordnung' ;;
|
||||
"warnings only (no hard fail)") printf 'nur Warnungen (kein harter Fehler)' ;;
|
||||
"monitoring") printf 'Ueberwachung' ;;
|
||||
"surface") printf 'Surface' ;;
|
||||
"aptdeploy") printf 'aptdeploy' ;;
|
||||
"container") printf 'Container' ;;
|
||||
"disk") printf 'Disk' ;;
|
||||
"package") printf 'Paket' ;;
|
||||
"version") printf 'Version' ;;
|
||||
"reachability") printf 'Erreichbarkeit' ;;
|
||||
"server-header") printf 'Server-Header' ;;
|
||||
"inventory") printf 'Inventar' ;;
|
||||
"flags") printf 'Flags' ;;
|
||||
"target domain") printf 'Zieldomaene' ;;
|
||||
"currency") printf 'Waehrung' ;;
|
||||
"phases") printf 'Phasen' ;;
|
||||
"access") printf 'Zugang' ;;
|
||||
*)
|
||||
local outd="$s"
|
||||
outd=${outd//shared library missing/gemeinsame Bibliothek fehlt}
|
||||
outd=${outd//not active/nicht aktiv}
|
||||
outd=${outd//does not resolve/loest nicht auf}
|
||||
outd=${outd//from Server header/aus Server-Header}
|
||||
outd=${outd//public HTTPS/oeffentliches HTTPS}
|
||||
outd=${outd//no SSH/ohne SSH}
|
||||
outd=${outd//failed — see list above/fehlgeschlagen — siehe Liste oben}
|
||||
printf '%s' "$outd"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
local out="$s"
|
||||
out=${out//shared library missing/bibliotheque partagee manquante}
|
||||
out=${out//shared library error/erreur de bibliotheque partagee}
|
||||
out=${out//not active/non actif}
|
||||
out=${out//after_start/apres_demarrage}
|
||||
out=${out//catalogued but not reachable/catalogue mais inaccessible}
|
||||
out=${out//does not resolve/ne resout pas}
|
||||
out=${out//protocol confirmed/protocole confirme}
|
||||
out=${out//catalogued service OK/service catalogue OK}
|
||||
out=${out//from Server header/depuis en-tete Server}
|
||||
out=${out//OSV clean/OSV sans vulnerabilite}
|
||||
out=${out//actionable vuln/vuln. actionnable}
|
||||
out=${out//header version · not Debian pkg/version en-tete · pas paquet Debian}
|
||||
out=${out//RUN_TIMEOUT exceeded/RUN_TIMEOUT depasse}
|
||||
out=${out//public HTTPS/HTTPS public}
|
||||
out=${out//container status/etat du conteneur}
|
||||
out=${out//remote-only/uniquement distant}
|
||||
out=${out//no SSH/sans SSH}
|
||||
out=${out//failed — see list above/echec — voir la liste ci-dessus}
|
||||
printf '%s' "$out"
|
||||
printf '%s' "$s"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue