release 1.19.0: domains.conf lang column drives UI i18n default
Per-stack en|fr lives in domains.conf; load_domain_profile sets TALER_DOMAIN_LANG. FP profiles use lang=fr; workstation LANG=en no longer overrides. HTML chrome resolves lang from the same conf.
This commit is contained in:
parent
8c99e13af1
commit
61f49f02db
7 changed files with 181 additions and 75 deletions
35
lib.sh
35
lib.sh
|
|
@ -166,13 +166,24 @@ set_taler_stack() {
|
|||
fi
|
||||
}
|
||||
|
||||
# Normalize domains.conf lang token → en|fr (empty if not a lang token).
|
||||
_domain_lang_token() {
|
||||
case "${1:-}" in
|
||||
en|EN|eng|english) printf 'en' ;;
|
||||
fr|FR|fra|french) printf 'fr' ;;
|
||||
*) printf '' ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Load first matching profile from domains.conf.
|
||||
# Fields (whitespace-separated; # comments; blank lines ignored):
|
||||
# name bank exchange merchant currency local[0|1] landing[0|1] [canonical_domain]
|
||||
# name bank exchange merchant currency local[0|1] landing[0|1] lang[en|fr] [canonical]
|
||||
# Legacy: 8th field may be canonical only (no lang) — lang defaults to en.
|
||||
# Sets TALER_DOMAIN_LANG from the profile (i18n source of truth when SET≠1).
|
||||
# Returns 0 if found, 1 if not.
|
||||
load_domain_profile() {
|
||||
local want="$1" conf="${TALER_DOMAINS_CONF:-}"
|
||||
local line name bank exchange merchant currency local_stack landing canon
|
||||
local line name bank exchange merchant currency local_stack landing canon profile_lang f8 f9
|
||||
[ -n "$want" ] || return 1
|
||||
[ -n "$conf" ] && [ -f "$conf" ] || return 1
|
||||
|
||||
|
|
@ -189,12 +200,30 @@ load_domain_profile() {
|
|||
currency="$5"
|
||||
local_stack="${6:-0}"
|
||||
landing="${7:-}"
|
||||
canon="${8:-$name}"
|
||||
f8="${8:-}"
|
||||
f9="${9:-}"
|
||||
canon="$name"
|
||||
profile_lang=""
|
||||
# Backward compat: old 7th field was canonical domain (contains a dot)
|
||||
if [ -n "$landing" ] && [[ "$landing" == *.* && "$landing" != "0" && "$landing" != "1" ]]; then
|
||||
canon="$landing"
|
||||
landing=""
|
||||
f8="${7:-}"
|
||||
f9="${8:-}"
|
||||
fi
|
||||
if [ -n "$f8" ]; then
|
||||
profile_lang=$(_domain_lang_token "$f8")
|
||||
if [ -n "$profile_lang" ]; then
|
||||
canon="${f9:-$name}"
|
||||
else
|
||||
# legacy: field 8 = canonical, optional field 9 = lang
|
||||
canon="$f8"
|
||||
profile_lang=$(_domain_lang_token "$f9")
|
||||
fi
|
||||
fi
|
||||
[ -z "$profile_lang" ] && profile_lang=en
|
||||
TALER_DOMAIN_LANG="$profile_lang"
|
||||
export TALER_DOMAIN_LANG
|
||||
set_taler_stack "$bank" "$exchange" "$merchant" "$currency" "$local_stack" "$landing" "$canon"
|
||||
return 0
|
||||
done <"$conf"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue