diff --git a/editions/full/tiddlers/Startup-SetLanguage.tid b/editions/full/tiddlers/Startup-SetLanguage.tid new file mode 100644 index 000000000..60c5e3c0e --- /dev/null +++ b/editions/full/tiddlers/Startup-SetLanguage.tid @@ -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/]] }}}/> diff --git a/editions/tw5.com/tiddlers/features/StartupActions.tid b/editions/tw5.com/tiddlers/features/StartupActions.tid index e1aa53204..c6ababfba 100644 --- a/editions/tw5.com/tiddlers/features/StartupActions.tid +++ b/editions/tw5.com/tiddlers/features/StartupActions.tid @@ -1,10 +1,10 @@ created: 20180323092308399 -modified: 20180323092547312 +modified: 20190307183936035 tags: Features title: StartupActions 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: * <> (executed on all platforms) * <> (only executed when running in the browser) @@ -22,6 +22,12 @@ Startup actions are useful for customising TiddlyWiki according to environmental ``` +<<.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: ```