1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-02 08:06:17 +00:00
TiddlyWiki5/editions/tw5.com/tiddlers/macros/examples/lingo Macro (file structure).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

74 lines
1.8 KiB
Plaintext

created: 20231028120432257
modified: 20240206122408606
tags: [[lingo Macro]] [[Macro Examples]]
title: lingo Macro (file structure)
!! Example file structure for [[TiddlyWiki on Node.js]]
!!! Suggested file structure
When developing a plugin, you may want to organize your language files like this on the file system as [[MultiTiddlerFiles]]:
```tree
├── language
│ ├── en-GB
│ │ ├── Translations.multids
│ │ └── SomeLongText.tid
│ └── zh-Hans
│ ├── Translations.multids
│ └── SomeLongText.tid
├── other files
└── plugin.info
```
See [[$:/plugins/tiddlywiki/menubar/tree]] for an example.
!!! Define Multiple Translations in One Tiddler
And the content of `language/en-GB/Translations.multids` may looks like this:
```multids
title: $:/plugins/yourName/pluginName/language/en-GB/
OpenInteractiveCard: Open Interactive Card
OpenStaticCard: Open Static Card
```
Later you can use it like:
```tid
title: someTiddler
caption: <<lingo OpenStaticCard "$:/plugins/yourName/pluginName/language/">>
\define lingo-base() $:/plugins/yourName/pluginName/language/
\whitespace trim
<<lingo OpenInteractiveCard>>
```
!!! Define Long Text in a regular Tiddler
You can also use a regular tiddler for long text, like `SomeLongText.tid` in the example above, to store a multi-paragraph long text:
```tid
title: $:/plugins/yourName/pluginName/language/en-GB/SomeLongText
!!! SubTitle
This is a long text.
```
Later you can use it like:
```tid
title: someTiddler
\define lingo-base() $:/plugins/yourName/pluginName/language/
!! <<lingo "OpenInteractiveCard">>
<<lingo SomeLongText>>
```
Note that lingo macro will use the [[parse mode|WikiText Parser Modes]] in the current position where this procedure is invoked.