1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-03 18:53:28 +00:00
TiddlyWiki5/core/wiki/macros/lingo.tid
lin onetwo 78ace99685
Feat: translatable plugins and docs (#7821)
* feat: t macro and docs

* feat: support block mode so you can transclude whole tiddler

* refactor: use lingo and procedure

* refactor: use function instead of set variable

* docs: about  mode:"inline"

* Update LingoMacro.tid

* docs: more usage about inline

* refactor: update translate macro to reuse lingo macro

* Delete translateMacro.tid

* refactor: update translation of tiddlyweb

* docs: more tiddlyweb l10n

* feat: add comment, so when use <$text text=<<lingo>> by mistake, it shows

* i18n: add more l10n

* feat: add tree to plugin to reveal l10n structure

* i18n: add menubar translation for example

* i18n: more for menubal

* docs: Headings -> Heading

* refactor: remove the "tree" tid

* Revert "refactor: remove the "tree" tid"

This reverts commit fb70f0b146.
2024-06-08 14:58:21 +01:00

25 lines
974 B
Plaintext

title: $:/core/macros/lingo
tags: $:/tags/Global
<!-- Note that lingo-base should end with a trailing slash character -->
\procedure lingo-base()
$:/language/
\end lingo-base
\procedure lingo(title,override-lingo-base)
<!-- Lingo procedure -->
<!-- Get the parse mode used to invoke this procedure -->
<$parameters $parseMode="parseMode">
<!-- Compute the lingo-base-->
<$let active-lingo-base={{{ [<override-lingo-base>!match[]else<lingo-base>] }}}>
<!-- First try the old school <active-lingo-base><title> format -->
<$transclude $tiddler={{{ [<active-lingo-base>addsuffix<title>] }}} $mode=<<parseMode>>>
<!-- If that didn't work, try the new <lingo-base><langcode>/<title> format -->
<$let language-code={{{ [[$:/language]get[text]get[name]else[en-GB]] }}}>
<$transclude $tiddler={{{ [<active-lingo-base>addsuffix<language-code>addsuffix[/]addsuffix<title>] }}} $mode=<<parseMode>>/>
</$let>
</$transclude>
</$let>
</$parameters>
\end lingo