]> git.plutz.net Git - lobster/commitdiff
prevent double escaping in translatable teltype
authorPaul Hänsch <paul@plutz.net>
Sat, 15 May 2021 10:19:07 +0000 (12:19 +0200)
committerPaul Hänsch <paul@plutz.net>
Sat, 15 May 2021 10:19:07 +0000 (12:19 +0200)
cards/widgets.sh

index ab317fb8afd586b4a2cd5e31947ebeee57b676ef..8b5b986623c6100a2e42e2f2437318a4f9680df3 100755 (executable)
@@ -111,9 +111,10 @@ card_item(){
         [ $cnt -gt 0 ] && printf '[h3 %s]' "$(l10n TEL)"
         seq 1 $cnt |while read c; do
           teltype="$(pdi_attrib "$card" TEL $c TYPE)"
+          ttl10="$(l10n "TYPE=$teltype")"  # See below: HTML-Escape teltype if there is no translation (translations are always pre escaped)
           [ "$teltype" ] \
           && printf '[span .item .TEL [span .type . %s:] %s]' \
-                    "$(l10n "TYPE=$teltype" |HTML)" \
+                    "$([ "$ttl10" = "TYPE=$teltype" ] && { printf %s "$ttl10" |HTML; } || printf %s "$ttl10")" \
                     "$(pdi_value "$card" TEL $c |pdi_unescape |HTML)" \
           || printf '[span .item .TEL . %s]' \
                     "$(pdi_value "$card" TEL $c |pdi_unescape |HTML)"