Phase summary no longer resets PROGRESS_TOTAL to local done (which made bars like 34/34 then 38/47). Total is fixed at run start; only grows if short; progress_finish snaps once at the end of the whole run.
104 lines
3.6 KiB
Bash
104 lines
3.6 KiB
Bash
#!/usr/bin/env bash
|
|
# i18n.sh — language for taler-monitoring console + HTML chrome
|
|
#
|
|
# TALER_MON_LANG=en|fr (default en)
|
|
# Auto: domains *lefrancpaysan* → fr unless TALER_MON_LANG is set explicitly.
|
|
|
|
: "${TALER_MON_LANG:=}"
|
|
: "${TALER_MON_LANG_SET:=0}"
|
|
|
|
i18n_init() {
|
|
if [ -n "${TALER_MON_LANG:-}" ]; then
|
|
TALER_MON_LANG_SET=1
|
|
fi
|
|
if [ "${TALER_MON_LANG_SET}" != "1" ]; then
|
|
case "${TALER_DOMAIN:-}" in
|
|
*lefrancpaysan*|*francpaysan*)
|
|
TALER_MON_LANG=fr
|
|
;;
|
|
*)
|
|
TALER_MON_LANG=en
|
|
;;
|
|
esac
|
|
fi
|
|
case "${TALER_MON_LANG}" in
|
|
fr|FR|fra|french) TALER_MON_LANG=fr ;;
|
|
*) TALER_MON_LANG=en ;;
|
|
esac
|
|
export TALER_MON_LANG
|
|
}
|
|
|
|
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" ;;
|
|
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 :' ;;
|
|
"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//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"
|
|
;;
|
|
esac
|
|
}
|