mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-27 09:24:45 +00:00
Add example startup action to switch to browser language
This commit is contained in:
parent
2c2d03f7a7
commit
f047e7cbf5
4
editions/full/tiddlers/Startup-SetLanguage.tid
Normal file
4
editions/full/tiddlers/Startup-SetLanguage.tid
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
title: $:/_Startup/SetLanguage
|
||||||
|
tags: $:/tags/StartupAction
|
||||||
|
|
||||||
|
<$action-setfield $tiddler="$:/language" text={{{ [[$:/languages/en-GB]] [plugin-type[language]sort[description]removeprefix[$:/languages/]] +[prefix{$:/info/browser/language}] ~[[en-GB]] +[addprefix[$:/languages/]] }}}/>
|
@ -1,10 +1,10 @@
|
|||||||
created: 20180323092308399
|
created: 20180323092308399
|
||||||
modified: 20180323092547312
|
modified: 20190307183936035
|
||||||
tags: Features
|
tags: Features
|
||||||
title: StartupActions
|
title: StartupActions
|
||||||
type: text/vnd.tiddlywiki
|
type: text/vnd.tiddlywiki
|
||||||
|
|
||||||
During startup, TiddlyWiki executes any ActionWidgets found in tiddlers with the following system tags:
|
TiddlyWiki executes any ActionWidgets found in tiddlers with the following system tags during startup:
|
||||||
|
|
||||||
* <<tag "$:/tags/StartupAction">> (executed on all platforms)
|
* <<tag "$:/tags/StartupAction">> (executed on all platforms)
|
||||||
* <<tag "$:/tags/StartupAction/Browser">> (only executed when running in the browser)
|
* <<tag "$:/tags/StartupAction/Browser">> (only executed when running in the browser)
|
||||||
@ -22,6 +22,12 @@ Startup actions are useful for customising TiddlyWiki according to environmental
|
|||||||
</$reveal>
|
</$reveal>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
<<.from-version "5.1.20">> This example switches to the language plugin matching the language reported by the browser:
|
||||||
|
|
||||||
|
```
|
||||||
|
<$action-setfield $tiddler="$:/language" text={{{ [[$:/languages/en-GB]] [plugin-type[language]sort[description]removeprefix[$:/languages/]] +[prefix{$:/info/browser/language}] ~[[en-GB]] +[addprefix[$:/languages/]] }}}/>
|
||||||
|
```
|
||||||
|
|
||||||
Note that global macros are not available within startup action tiddlers by default. If you need to access them then you'll need to explicitly include them with an ''import'' [[pragma|Pragma]] at the top of the tiddler:
|
Note that global macros are not available within startup action tiddlers by default. If you need to access them then you'll need to explicitly include them with an ''import'' [[pragma|Pragma]] at the top of the tiddler:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user