#!/usr/bin/env bash # i18n.sh — language for taler-monitoring console + HTML chrome # # TALER_MON_LANG=en|fr # TALER_MON_LANG_SET=1 → language is explicit (--lang or host-agent wrapper); do not override. # Auto (SET≠1): domain *lefrancpaysan* / *francpaysan* → fr, else keep env or en. # # Important: a bare TALER_MON_LANG=en in ~/.config/taler-monitoring/env must NOT lock # language for FP domains (that used to force English on stage.monnaie…). : "${TALER_MON_LANG:=}" : "${TALER_MON_LANG_SET:=0}" i18n_init() { # Only TALER_MON_LANG_SET=1 is "explicit". Do not promote non-empty TALER_MON_LANG # to SET=1 — env files often ship LANG=en for the default GOA workstation. if [ "${TALER_MON_LANG_SET:-0}" != "1" ]; then case "${TALER_DOMAIN:-}" in *lefrancpaysan*|*francpaysan*) TALER_MON_LANG=fr ;; *) # Non-FP: keep pre-set env value if any, else English if [ -z "${TALER_MON_LANG:-}" ]; then TALER_MON_LANG=en fi ;; esac fi case "${TALER_MON_LANG}" in fr|FR|fra|french) TALER_MON_LANG=fr ;; *) TALER_MON_LANG=en ;; esac export TALER_MON_LANG export TALER_MON_LANG_SET } 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 :' ;; "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//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 }