diff --git a/core/wiki/macros/lingo.tid b/core/wiki/macros/lingo.tid index 5a8c45677..829ee278d 100644 --- a/core/wiki/macros/lingo.tid +++ b/core/wiki/macros/lingo.tid @@ -9,14 +9,24 @@ $:/language/ {{$(lingo-base)$$title$}} \end -\procedure translate(key, lingoBaseFallback:"", mode:block) +\procedure translate(key, lingo-base-fallback, mode:block) -<$set name="lingoBaseWithFallback" value=<> emptyValue=<>> - <$set name="lang" filter="[[$:/language]get[text]get[name]else[en-GB]]" select="0"> - - <$set name="lingoTarget" filter="[suffix[/]then] ~[addsuffix[/]] +[addsuffixaddsuffix[/]addsuffix]" select="0"> - <$transclude $tiddler=<> $mode=<> /> - - - +\function target-lingo-base() +[!is[blank]else] +\end target-lingo-base + +\function add-lang-suffix(base) +[[$:/language]get[text]get[name]else[en-GB]] ++[addprefix] +\end add-lang-suffix + + +\function lingo-target() +[function[target-lingo-base]suffix[/]] +:then[function[target-lingo-base]] +~[function[target-lingo-base]addsuffix[/]] +:map[function[add-lang-suffix],addsuffix[/]addsuffix] +\end lingo-target + +<$transclude $tiddler=<> $mode=<> /> \end