diff --git a/core/wiki/macros/lingo.tid b/core/wiki/macros/lingo.tid index fc2e60ebc..24d451b03 100644 --- a/core/wiki/macros/lingo.tid +++ b/core/wiki/macros/lingo.tid @@ -1,10 +1,24 @@ title: $:/core/macros/lingo -tags: $:/tags/Macro +tags: $:/tags/Global -\define lingo-base() + +\procedure lingo-base() $:/language/ -\end +\end lingo-base -\define lingo(title) -{{$(lingo-base)$$title$}} -\end +\procedure lingo(title,override-lingo-base) + + +<$parameters $parseMode="parseMode"> + + <$let active-lingo-base={{{ [!match[]else] }}}> + + <$transclude $tiddler={{{ [addsuffix] }}} $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 diff --git a/editions/tw5.com/tiddlers/macros/LingoMacro.tid b/editions/tw5.com/tiddlers/macros/LingoMacro.tid index f91f94c6f..7c222e2df 100644 --- a/editions/tw5.com/tiddlers/macros/LingoMacro.tid +++ b/editions/tw5.com/tiddlers/macros/LingoMacro.tid @@ -1,16 +1,37 @@ -created: 20150221154907000 -modified: 20150221155706000 -title: lingo Macro -tags: Macros [[Core Macros]] caption: lingo +created: 20150221154907000 +modified: 20231028123405895 +tags: Macros [[Core Macros]] +title: lingo Macro +type: text/vnd.tiddlywiki The <<.def lingo>> [[macro|Macros]] relates to the translation of ~TiddlyWiki's user interface into other languages. It returns a piece of text in the user's currently selected language. -Translatable text is supplied by language plugins containing tiddlers with specific titles that start with `$:/language/`. +Translatable text is supplied by: -!! Parameters +# Language plugins +# Any l10n (localization) strings outside of the language plugins + +!! Language plugins + +You can directly pass title to `lingo` macro, when there is a language plugin containing a tiddler with such title that start with `$:/language/`. ;title : The title of the shadow tiddler that contains the text. The prefix `$:/language/` is added automatically -<<.macro-examples "lingo">> +<<.macro-examples "lingo (for language plugin)">> + +!! Any l10n strings + +To translate any text that directly placed in user's wiki, instead of in a language plugin, you can set the `lingo-base` variable to teach <<.def lingo>> macro the place to look for. + +!!! Parameters + +;key +: The last part of title of the tiddler that contains the text. The `<<lingo-base>>` prefix and current language name prefix is added automatically +;lingo-base-fallback +: Optional lingo-base when it is not possible to define `lingo-base` variable (for example, when using this macro in the caption field), you can set the lingo base by passing this parameter + +<<.macro-examples "lingo (for custom base)">> + +{{lingo Macro (file structure)}} diff --git a/editions/tw5.com/tiddlers/macros/examples/lingo Macro (custom base examples).tid b/editions/tw5.com/tiddlers/macros/examples/lingo Macro (custom base examples).tid new file mode 100644 index 000000000..26f4e0735 --- /dev/null +++ b/editions/tw5.com/tiddlers/macros/examples/lingo Macro (custom base examples).tid @@ -0,0 +1,21 @@ +created: 20231028120432257 +modified: 20240206113509050 +tags: [[lingo Macro]] [[Macro Examples]] +title: lingo (for custom base) Macro (Examples) +type: text/vnd.tiddlywiki + +\define lingo-base() lingo Macro (custom base examples)/ + +Given the `\define lingo-base() lingo Macro (custom base examples)/`, this example shows the localizaion key `ExampleKey` being translate to the text in [[lingo Macro (custom base examples)/en-GB/ExampleKey]]: + +<$macrocall $name=".example" n="1" eg="""<<lingo ExampleKey>>"""/> + +This example shows the `lingo-base` can be set as second parameter: + +<$macrocall $name=".example" n="2" eg="""<<lingo ExampleKey "lingo Macro (custom base examples)/">>"""/> + +When use lingo macro in a [[Inline Mode WikiText]] like [[list|Lists in WikiText]] or [[title|Headings in WikiText]], the parse mode will be inline, so translated text will be inlined too. + +<$macrocall $name=".example" n="3" eg="""# <<lingo ExampleKey>>"""/> + +<$macrocall $name=".example" n="4" eg="""!! <<lingo ExampleKey>>"""/> diff --git a/editions/tw5.com/tiddlers/macros/examples/lingo Macro (custom base examples)_en-GB_ExampleKey.tid b/editions/tw5.com/tiddlers/macros/examples/lingo Macro (custom base examples)_en-GB_ExampleKey.tid new file mode 100644 index 000000000..d94d1bdee --- /dev/null +++ b/editions/tw5.com/tiddlers/macros/examples/lingo Macro (custom base examples)_en-GB_ExampleKey.tid @@ -0,0 +1,8 @@ +created: 20231028120526948 +modified: 20240206113155142 +title: lingo Macro (custom base examples)/en-GB/ExampleKey +type: text/vnd.tiddlywiki + +This is the translated text of key "~ExampleKey" under lingo-base `lingo Macro (custom base examples)/` (don't forget the tailing slash `/`) + +And is multi-line, if it is translated in the block mode by default. (Become single line if set to inline mode.) diff --git a/editions/tw5.com/tiddlers/macros/examples/lingo Macro (file structure).tid b/editions/tw5.com/tiddlers/macros/examples/lingo Macro (file structure).tid new file mode 100644 index 000000000..e653f234b --- /dev/null +++ b/editions/tw5.com/tiddlers/macros/examples/lingo Macro (file structure).tid @@ -0,0 +1,73 @@ +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. diff --git a/editions/tw5.com/tiddlers/macros/examples/lingo.tid b/editions/tw5.com/tiddlers/macros/examples/lingo Macro (language plugin examples).tid similarity index 90% rename from editions/tw5.com/tiddlers/macros/examples/lingo.tid rename to editions/tw5.com/tiddlers/macros/examples/lingo Macro (language plugin examples).tid index 8f0fb9d57..8b7bceba1 100644 --- a/editions/tw5.com/tiddlers/macros/examples/lingo.tid +++ b/editions/tw5.com/tiddlers/macros/examples/lingo Macro (language plugin examples).tid @@ -1,7 +1,7 @@ created: 20150221151358000 modified: 20150221160113000 tags: [[lingo Macro]] [[Macro Examples]] -title: lingo Macro (Examples) +title: lingo (for language plugin) Macro (Examples) type: text/vnd.tiddlywiki This example shows the text used as the basis for the title of a newly created tiddler: diff --git a/plugins/tiddlywiki/menubar/config.tid b/plugins/tiddlywiki/menubar/config.tid index abcb8fcea..056575fbd 100644 --- a/plugins/tiddlywiki/menubar/config.tid +++ b/plugins/tiddlywiki/menubar/config.tid @@ -3,12 +3,13 @@ tags: $:/tags/ControlPanel/Toolbars caption: Menu Bar \define config-base() $:/config/plugins/menubar/MenuItems/Visibility/ +\define lingo-base() $:/plugins/tiddlywiki/menubar/language/ -! Menu Bar Configuration +! <<lingo Config/Heading1>> -!! Menu Items +!! <<lingo Config/MenuItems/Heading>> -Select which menu items will be shown. You can also drag items to reorder them. +<<lingo Config/MenuItems/Description>> <$set name="tv-config-toolbar-icons" value="yes"> @@ -20,18 +21,18 @@ Select which menu items will be shown. You can also drag items to reorder them. </$set> -!! Breakpoint Position +!! <<lingo Config/BreakpointPosition/Heading>> -The breakpoint position between narrow and wide screens. Should include CSS units (eg. `400px`). +<<lingo Config/BreakpointPosition/Description>> <$edit-text tiddler="$:/config/plugins/menubar/breakpoint" default="" tag="input"/> -!! Contents Tag +!! <<lingo Config/ContentsTag/Heading>> -The tag for the ~TableOfContents used in the Contents dropdown +<<lingo Config/ContentsTag/Description>> <$edit-text tiddler="$:/config/plugins/menubar/TableOfContents/Tag" default="" tag="input"/> -!! Menu Bar Colours +!! <<lingo Config/MenuBarColours/Heading>> -To change the colour of the menu bar, define the colours `menubar-foreground` and `menubar-background` in the currently selected palette +<<lingo Config/MenuBarColours/Description>> diff --git a/plugins/tiddlywiki/menubar/items/contents.tid b/plugins/tiddlywiki/menubar/items/contents.tid index f4fbdb2c2..56bd134b7 100644 --- a/plugins/tiddlywiki/menubar/items/contents.tid +++ b/plugins/tiddlywiki/menubar/items/contents.tid @@ -1,6 +1,6 @@ title: $:/plugins/tiddlywiki/menubar/items/contents -caption: Contents -description: Table of Contents +caption: <<lingo Items/TOC/Name $:/plugins/tiddlywiki/menubar/language/>> +description: <<lingo Items/TOC/Description $:/plugins/tiddlywiki/menubar/language/>> is-dropdown: yes tags: $:/tags/MenuBar diff --git a/plugins/tiddlywiki/menubar/items/hamburger.tid b/plugins/tiddlywiki/menubar/items/hamburger.tid index cbacb5a26..363b5e5d0 100644 --- a/plugins/tiddlywiki/menubar/items/hamburger.tid +++ b/plugins/tiddlywiki/menubar/items/hamburger.tid @@ -1,7 +1,7 @@ title: $:/plugins/tiddlywiki/menubar/items/hamburger tags: $:/tags/MenuBar -caption: Hamburger -description: Show the full menu bar on a narrow screen +caption: <<lingo Items/Hamburger/Name $:/plugins/tiddlywiki/menubar/language/>> +description: <<lingo Items/Hamburger/Description $:/plugins/tiddlywiki/menubar/language/>> custom-menu-content: {{$:/plugins/tiddlywiki/menubar/items/hamburger}} show-when: narrow diff --git a/plugins/tiddlywiki/menubar/items/pagecontrols.tid b/plugins/tiddlywiki/menubar/items/pagecontrols.tid index af4026664..ea91141b3 100644 --- a/plugins/tiddlywiki/menubar/items/pagecontrols.tid +++ b/plugins/tiddlywiki/menubar/items/pagecontrols.tid @@ -1,7 +1,7 @@ title: $:/plugins/tiddlywiki/menubar/items/pagecontrols tags: $:/tags/MenuBar -description: Page controls from the sidebar -caption: Page controls +description: <<lingo Items/PageControls/Name $:/plugins/tiddlywiki/menubar/language/>> +caption: <<lingo Items/PageControls/Name $:/plugins/tiddlywiki/menubar/language/>> custom-menu-content: <$transclude tiddler="$:/plugins/tiddlywiki/menubar/items/pagecontrols" mode="inline"/> \whitespace trim diff --git a/plugins/tiddlywiki/menubar/items/search.tid b/plugins/tiddlywiki/menubar/items/search.tid index e40f27ab5..280330214 100644 --- a/plugins/tiddlywiki/menubar/items/search.tid +++ b/plugins/tiddlywiki/menubar/items/search.tid @@ -1,7 +1,7 @@ title: $:/plugins/tiddlywiki/menubar/items/search custom-menu-content: {{$:/plugins/tiddlywiki/menubar/items/search}} -description: Search -caption: Search +description: <<lingo Items/Search/Name $:/plugins/tiddlywiki/menubar/language/>> +caption: <<lingo Items/Search/Name $:/plugins/tiddlywiki/menubar/language/>> tags: $:/tags/MenuBar \define cancel-search-actions() diff --git a/plugins/tiddlywiki/menubar/items/server.tid b/plugins/tiddlywiki/menubar/items/server.tid index 0f0e438ad..a2cf2c457 100644 --- a/plugins/tiddlywiki/menubar/items/server.tid +++ b/plugins/tiddlywiki/menubar/items/server.tid @@ -1,7 +1,7 @@ title: $:/plugins/tiddlywiki/menubar/items/server tags: $:/tags/MenuBar -description: Server options -caption: Server +description: <<lingo Items/Server/Description $:/plugins/tiddlywiki/menubar/language/>> +caption: <<lingo Items/Server/Name $:/plugins/tiddlywiki/menubar/language/>> custom-menu-content: <$transclude tiddler="$:/plugins/tiddlywiki/menubar/items/server" mode="inline"/> <$list filter="[[$:/status/IsLoggedIn]get[text]else[no]match[yes]]" variable="ignore"> diff --git a/plugins/tiddlywiki/menubar/items/sidebar.tid b/plugins/tiddlywiki/menubar/items/sidebar.tid index 616195a6a..c5e81c79e 100644 --- a/plugins/tiddlywiki/menubar/items/sidebar.tid +++ b/plugins/tiddlywiki/menubar/items/sidebar.tid @@ -1,6 +1,6 @@ title: $:/plugins/tiddlywiki/menubar/items/sidebar -caption: Sidebar -description: Sidebar +caption: <<lingo Items/Sidebar/Name $:/plugins/tiddlywiki/menubar/language/>> +description: <<lingo Items/Sidebar/Name $:/plugins/tiddlywiki/menubar/language/>> is-dropdown: yes tags: $:/tags/MenuBar diff --git a/plugins/tiddlywiki/menubar/items/topleftbar.tid b/plugins/tiddlywiki/menubar/items/topleftbar.tid index 2743848a6..d25c19f08 100644 --- a/plugins/tiddlywiki/menubar/items/topleftbar.tid +++ b/plugins/tiddlywiki/menubar/items/topleftbar.tid @@ -1,7 +1,7 @@ title: $:/plugins/tiddlywiki/menubar/items/topleftbar tags: $:/tags/MenuBar -description: Items from $:/tags/TopLeftBar -caption: Legacy Top Left Bar +description: <<lingo Items/TopLeftBar/Description $:/plugins/tiddlywiki/menubar/language/>> +caption: <<lingo Items/TopLeftBar/Name $:/plugins/tiddlywiki/menubar/language/>> custom-menu-content: <$transclude tiddler="$:/plugins/tiddlywiki/menubar/items/topleftbar" mode="inline"/> <$list filter="[all[shadows+tiddlers]tag[$:/tags/TopLeftBar]!has[draft.of]]" variable="listItem" storyview="pop"> diff --git a/plugins/tiddlywiki/menubar/items/toprightbar.tid b/plugins/tiddlywiki/menubar/items/toprightbar.tid index ae59e759b..e6bb842e4 100644 --- a/plugins/tiddlywiki/menubar/items/toprightbar.tid +++ b/plugins/tiddlywiki/menubar/items/toprightbar.tid @@ -1,7 +1,7 @@ title: $:/plugins/tiddlywiki/menubar/items/toprightbar tags: $:/tags/MenuBar -description: Items from $:/tags/TopRightBar -caption: Legacy Top Right Bar +description: <<lingo Items/TopRightBar/Description $:/plugins/tiddlywiki/menubar/language/>> +caption: <<lingo Items/TopRightBar/Name $:/plugins/tiddlywiki/menubar/language/>> custom-menu-content: <$transclude tiddler="$:/plugins/tiddlywiki/menubar/items/toprightbar" mode="inline"/> custom-menu-styles-wide: float: right; diff --git a/plugins/tiddlywiki/menubar/language/en-GB/Translations.multids b/plugins/tiddlywiki/menubar/language/en-GB/Translations.multids new file mode 100644 index 000000000..443acbbd5 --- /dev/null +++ b/plugins/tiddlywiki/menubar/language/en-GB/Translations.multids @@ -0,0 +1,25 @@ +title: $:/plugins/tiddlywiki/menubar/language/en-GB/ + +Config/Heading1: Menu Bar Configuration +Config/MenuItems/Heading: Menu Items +Config/MenuItems/Description: Select which menu items will be shown. You can also drag items to reorder them. +Config/BreakpointPosition/Heading: Breakpoint Position +Config/BreakpointPosition/Description: The breakpoint position between narrow and wide screens. Should include CSS units (eg. `400px`). +Config/ContentsTag/Heading: Contents Tag +Config/ContentsTag/Description: The tag for the ~TableOfContents used in the Contents dropdown +Config/MenuBarColours/Heading: Menu Bar Colours +Config/MenuBarColours/Description: To change the colour of the menu bar, define the colours `menubar-foreground` and `menubar-background` in the currently selected palette +Items/TOC/Name: Contents +Items/TOC/Description: Table of Contents +Items/Hamburger/Name: Hamburger +Items/Hamburger/Description: Show the full menu bar on a narrow screen +Items/PageControls/Name: Page controls +Items/PageControls/Description: Page controls from the sidebar +Items/Search/Name: Search +Items/Server/Name: Server +Items/Server/Description: Server options +Items/Sidebar/Name: Sidebar +Items/TopLeftBar/Name: Legacy Top Left Bar +Items/TopLeftBar/Description: Items from $:/tags/TopLeftBar +Items/TopRightBar/Name: Legacy Top Right Bar +Items/TopRightBar/Description: Items from $:/tags/TopRightBar \ No newline at end of file diff --git a/plugins/tiddlywiki/menubar/language/en-GB/readme.tid b/plugins/tiddlywiki/menubar/language/en-GB/readme.tid new file mode 100644 index 000000000..0cbb781cd --- /dev/null +++ b/plugins/tiddlywiki/menubar/language/en-GB/readme.tid @@ -0,0 +1,30 @@ +title: $:/plugins/tiddlywiki/menubar/language/en-GB/readme + +!! Introduction + +This plugin provides a menu bar with the following features: + +* Menu items take the form of simple text links, dropdowns, or entirely custom content +* Menu items can be individually enabled via the control panel +* Responds to reduced screen width by abbreviating the menu items to a "hamburger" dropdown + +!! Menu Item Tiddlers + +Menu items are tagged <<tag $:/tags/MenuBar>>. The following fields are used by this plugin: + +|!Field Name |!Purpose | +|title |Each menu item must have a unique title (not shown to the user) | +|description |Description for use in listings | +|tags |Must contain `$:/tags/MenuBar` | +|caption |The text that is displayed for the menu item. Avoid links, using `~` to suppress CamelCase links if required | +|target |For simple link menu items specifies a tiddler title as the target of the link | +|is-dropdown |Set to `yes` to indicate a dropdown menu item | +|dropdown-position |Optional position for the dropdown (can be ''left'', ''above'', ''aboveleft'', ''aboveright'', ''right'', ''belowleft'', ''belowright'' or ''below'') | +|text |For dropdown menu items, specifies the body of the dropdown | +|custom-menu-content |Optional wikitext to be displayed in place of the caption | +|custom-menu-styles-wide |Optional string of styles to be applied to menu item when the menubar is wide | +|custom-menu-styles-narrow |Optional string of styles to be applied to menu item when the menubar is narrow | + +Custom menu items should make sure that the clickable link or button is an immediate child, and not wrapped in another element. + +Note that menu items can be pushed to the right of the menu bar setting the ''custom-menu-styles'' field to `float: right;`. diff --git a/plugins/tiddlywiki/menubar/language/zh-Hans/Translations.multids b/plugins/tiddlywiki/menubar/language/zh-Hans/Translations.multids new file mode 100644 index 000000000..2c7574dd8 --- /dev/null +++ b/plugins/tiddlywiki/menubar/language/zh-Hans/Translations.multids @@ -0,0 +1,25 @@ +title: $:/plugins/tiddlywiki/menubar/language/zh-Hans/ + +Config/Heading1: 菜单栏配置 +Config/MenuItems/Heading: 菜单项 +Config/MenuItems/Description: 选择要显示的菜单项。您还可以通过拖动项目来重新排序。 +Config/BreakpointPosition/Heading: 响应式断点位置 +Config/BreakpointPosition/Description: 窄屏和宽屏之间的分界点位置。应包含 CSS 单位(如 `400px`)。 +Config/ContentsTag/Heading: 内容标签 +Config/ContentsTag/Description: 内容下拉菜单中使用的 TOC 目录标签 +Config/MenuBarColours/Heading: 菜单栏颜色 +Config/MenuBarColours/Description: 要更改菜单栏的颜色,请在当前选定的调色板中定义颜色 `menubar-foreground` 和 `menubar-background`。 +Items/TOC/Name: 内容 +Items/TOC/Description: 目录 +Items/Hamburger/Name: 抽屉 +Items/Hamburger/Description: 在窄屏幕上显示完整的菜单栏 +Items/PageControls/Name: 页面控件 +Items/PageControls/Description: 来自侧边栏的页面控件 +Items/Search/Name: 搜索 +Items/Server/Name: 服务器 +Items/Server/Description: 服务器选项 +Items/Sidebar/Name: 侧边栏 +Items/TopLeftBar/Name: 旧版左上角栏 +Items/TopLeftBar/Description: 来自 $:/tags/TopLeftBar 的项目 +Items/TopRightBar/Name: 旧版右上角栏 +Items/TopRightBar/Description: 来自 $:/tags/TopRightBar 的项目 \ No newline at end of file diff --git a/plugins/tiddlywiki/menubar/language/zh-Hans/readme.tid b/plugins/tiddlywiki/menubar/language/zh-Hans/readme.tid new file mode 100644 index 000000000..1f4a536ac --- /dev/null +++ b/plugins/tiddlywiki/menubar/language/zh-Hans/readme.tid @@ -0,0 +1,30 @@ +title: $:/plugins/tiddlywiki/menubar/language/zh-Hans/readme + +!! 简介 + +该插件提供的菜单栏具有以下功能: + +* 菜单项的形式可以是简单的文本链接、下拉菜单或完全自定义的内容 +* 可通过控制面板单独启用菜单项 +* 通过将菜单项缩减为抽屉式导航(也叫"汉堡包"下拉菜单)来应对屏幕宽度减小的情况 + +!! 菜单项标记 + +菜单项被标记为 <<tag $:/tags/MenuBar>>。本插件使用以下字段: + +|!字段名称 |!用途 | +|title |每个菜单项必须有一个唯一的标题(不显示给用户)| +|description |在列表中使用的描述 | +|tags |必须包含 `$:/tags/MenuBar` | +|caption |菜单项显示的文本。避免使用链接,必要时使用 `~` 来抑制 CamelCase 链接 | +|target |对于简单链接菜单项,指定一个 tiddler 标题作为链接的目标 | +|is-dropdown |设置为 `yes` 表示下拉菜单项 | +|dropdown-position |下拉位置(可选 "左"、"上"、"左上" 等,需要使用英文 ''left'', ''above'', ''aboveleft'', ''aboveright'', ''right'', ''belowleft'', ''belowright'', ''below'') | +|text |对于下拉菜单项,指定下拉菜单的正文 | +|custom-menu-content |可选显示的维基文本,以代替标题 | +|custom-menu-styles-wide |当菜单栏是宽模式时,应用于菜单项的样式字符串选项 | +|custom-menu-styles-narrow |当菜单栏是窄模式时,应用于菜单项的样式的可选字符串 | + +自定义菜单项应确保可点击链接或按钮是直接子元素,而不是包裹在其他元素中。 + +请注意,菜单项可以通过将 ''custom-menu-styles'' 字段设置为 `float: right;` 而推到菜单栏的右侧。 diff --git a/plugins/tiddlywiki/menubar/readme.tid b/plugins/tiddlywiki/menubar/readme.tid index 4282654bd..c9b75abbe 100644 --- a/plugins/tiddlywiki/menubar/readme.tid +++ b/plugins/tiddlywiki/menubar/readme.tid @@ -1,30 +1,5 @@ title: $:/plugins/tiddlywiki/menubar/readme -!! Introduction +\define lingo-base() $:/plugins/tiddlywiki/menubar/language/ -This plugin provides a menu bar with the following features: - -* Menu items take the form of simple text links, dropdowns, or entirely custom content -* Menu items can be individually enabled via the control panel -* Responds to reduced screen width by abbreviating the menu items to a "hamburger" dropdown - -!! Menu Item Tiddlers - -Menu items are tagged <<tag $:/tags/MenuBar>>. The following fields are used by this plugin: - -|!Field Name |!Purpose | -|title |Each menu item must have a unique title (not shown to the user) | -|description |Description for use in listings | -|tags |Must contain `$:/tags/MenuBar` | -|caption |The text that is displayed for the menu item. Avoid links, using `~` to suppress CamelCase links if required | -|target |For simple link menu items specifies a tiddler title as the target of the link | -|is-dropdown |Set to `yes` to indicate a dropdown menu item | -|dropdown-position |Optional position for the dropdown (can be ''left'', ''above'', ''aboveleft'', ''aboveright'', ''right'', ''belowleft'', ''belowright'' or ''below'') | -|text |For dropdown menu items, specifies the body of the dropdown | -|custom-menu-content |Optional wikitext to be displayed in place of the caption | -|custom-menu-styles-wide |Optional string of styles to be applied to menu item when the menubar is wide | -|custom-menu-styles-narrow |Optional string of styles to be applied to menu item when the menubar is narrow | - -Custom menu items should make sure that the clickable link or button is an immediate child, and not wrapped in another element. - -Note that menu items can be pushed to the right of the menu bar setting the ''custom-menu-styles'' field to `float: right;`. +<<lingo readme>> diff --git a/plugins/tiddlywiki/menubar/tree.tid b/plugins/tiddlywiki/menubar/tree.tid new file mode 100644 index 000000000..f818ca78e --- /dev/null +++ b/plugins/tiddlywiki/menubar/tree.tid @@ -0,0 +1,4 @@ +title: $:/plugins/tiddlywiki/menubar/tree +type: text/vnd.tiddlywiki + +<<tree prefix:"$:/plugins/tiddlywiki/menubar/">> \ No newline at end of file diff --git a/plugins/tiddlywiki/tiddlyweb/GettingStarted.tid b/plugins/tiddlywiki/tiddlyweb/GettingStarted.tid index 08df08c07..012dce8aa 100644 --- a/plugins/tiddlywiki/tiddlyweb/GettingStarted.tid +++ b/plugins/tiddlywiki/tiddlyweb/GettingStarted.tid @@ -1,16 +1,7 @@ title: GettingStarted tags: $:/tags/GettingStarted -caption: Step 1<br>Syncing +caption: <<lingo GettingStartedStep1 "$:/plugins/tiddlywiki/tiddlyweb/language/">> -Welcome to ~TiddlyWiki and the ~TiddlyWiki community +\define lingo-base() $:/plugins/tiddlywiki/tiddlyweb/language/ -Visit https://tiddlywiki.com/ to find out more about ~TiddlyWiki and what it can do. - -! Syncing Changes to the Server - -Before you can start storing important information in ~TiddlyWiki it is important to make sure that your changes are being reliably saved by the server. - -# Create a new tiddler using the {{$:/core/images/new-button}} button in the sidebar on the right -# Click the {{$:/core/images/done-button}} button at the top right of the new tiddler -# Check the ~TiddlyWiki command line for a message confirming the tiddler has been saved -# Refresh the page in the browser to and verify that the new tiddler has been correctly saved +<<lingo GettingStarted>> diff --git a/plugins/tiddlywiki/tiddlyweb/configOfficialPluginLibrary.tid b/plugins/tiddlywiki/tiddlyweb/configOfficialPluginLibrary.tid index d2a07991a..dc5b3ae7e 100644 --- a/plugins/tiddlywiki/tiddlyweb/configOfficialPluginLibrary.tid +++ b/plugins/tiddlywiki/tiddlyweb/configOfficialPluginLibrary.tid @@ -4,4 +4,6 @@ url: https://tiddlywiki.com/library/v5.1.23/index.html caption: {{$:/language/OfficialPluginLibrary}} enabled: no -The official plugin library is disabled when using the client-server configuration. Instead, plugins should be installed via the `tiddlywiki.info` file, as described [[here|https://tiddlywiki.com/#Installing%20a%20plugin%20from%20the%20plugin%20library]]. \ No newline at end of file +\define lingo-base() $:/plugins/tiddlywiki/tiddlyweb/language/ + +<<lingo ConfigOfficialPluginLibrary>> diff --git a/plugins/tiddlywiki/tiddlyweb/language/en-GB/GettingStarted.tid b/plugins/tiddlywiki/tiddlyweb/language/en-GB/GettingStarted.tid new file mode 100644 index 000000000..990b02f81 --- /dev/null +++ b/plugins/tiddlywiki/tiddlyweb/language/en-GB/GettingStarted.tid @@ -0,0 +1,14 @@ +title: $:/plugins/tiddlywiki/tiddlyweb/language/en-GB/GettingStarted + +Welcome to ~TiddlyWiki and the ~TiddlyWiki community + +Visit https://tiddlywiki.com/ to find out more about ~TiddlyWiki and what it can do. + +! Syncing Changes to the Server + +Before you can start storing important information in ~TiddlyWiki it is important to make sure that your changes are being reliably saved by the server. + +# Create a new tiddler using the {{$:/core/images/new-button}} button in the sidebar on the right +# Click the {{$:/core/images/done-button}} button at the top right of the new tiddler +# Check the ~TiddlyWiki command line for a message confirming the tiddler has been saved +# Refresh the page in the browser to and verify that the new tiddler has been correctly saved diff --git a/plugins/tiddlywiki/tiddlyweb/language/en-GB/Translations.multids b/plugins/tiddlywiki/tiddlyweb/language/en-GB/Translations.multids new file mode 100644 index 000000000..c03684ad7 --- /dev/null +++ b/plugins/tiddlywiki/tiddlyweb/language/en-GB/Translations.multids @@ -0,0 +1,12 @@ +title: $:/plugins/tiddlywiki/tiddlyweb/language/en-GB/ + +ConfigOfficialPluginLibrary: The official plugin library is disabled when using the client-server configuration. Instead, plugins should be installed via the `tiddlywiki.info` file, as described [[here|https://tiddlywiki.com/#Installing%20a%20plugin%20from%20the%20plugin%20library]]. +GettingStartedStep1: Step 1<br>Syncing +CopySyncerLogs: Copy syncer logs to clipboard +LoginAs: You are logged in<$reveal state="$:/status/UserName" type="nomatch" text="" default=""> as <strong><$text text={{$:/status/UserName}}/></strong></$reveal> +Readonly: <$reveal state="$:/status/IsReadOnly" type="match" text="yes" default="no"> (read-only)</$reveal> +Login: Login +Logout: Logout +SaveSnapshot: Save snapshot for offline use +Refresh/Label: Refresh from server +Refresh/Button: Get latest changes from the server \ No newline at end of file diff --git a/plugins/tiddlywiki/tiddlyweb/language/en-GB/readme.tid b/plugins/tiddlywiki/tiddlyweb/language/en-GB/readme.tid new file mode 100644 index 000000000..63a487e80 --- /dev/null +++ b/plugins/tiddlywiki/tiddlyweb/language/en-GB/readme.tid @@ -0,0 +1,7 @@ +title: $:/plugins/tiddlywiki/tiddlyweb/language/en-GB/readme + +This plugin runs in the browser to synchronise tiddler changes to and from a TiddlyWeb-compatible server (including TiddlyWiki 5 itself, running on Node.js). It is inert when run under Node.js. Disabling this plugin via the browser can not be undone via the browser since this plugin provides the mechanism to synchronize settings with the server. + +Changes made while offline are saved in memory and automatically synchonised with the server when the connection is re-established. However, if the browser tab is closed or another URL is loaded, the in-memory changes will be lost. The [[https://tiddlywiki.com/#BrowserStorage Plugin]] may be added to provide temporary filesystem storage of tiddler changes made while offline and enable them to be synchronised with the server the next time the wiki is loaded in the same browser. + +[[Source code|https://github.com/Jermolene/TiddlyWiki5/blob/master/plugins/tiddlywiki/tiddlyweb]] diff --git a/plugins/tiddlywiki/tiddlyweb/language/zh-Hans/GettingStarted.tid b/plugins/tiddlywiki/tiddlyweb/language/zh-Hans/GettingStarted.tid new file mode 100644 index 000000000..814f8b9c9 --- /dev/null +++ b/plugins/tiddlywiki/tiddlyweb/language/zh-Hans/GettingStarted.tid @@ -0,0 +1,14 @@ +title: $:/plugins/tiddlywiki/tiddlyweb/language/zh-Hans/GettingStarted + +欢迎来到太微和太微社区 + +访问 https://tiddlywiki.com/ 了解太微的细节和了解它能做什么。 + +! 同步更改到服务器 + +在你开始在太微中存储重要信息之前,确保你的修改被服务器可靠地保存是非常重要的。 + +# 使用右侧边栏的 {{$:/core/images/new-button}} 按钮创建一个新条目 +# 点击新条目右上方的 {{$:/core/images/done-button}} 按钮 +# 检查太微命令行是否有确认条目已保存的信息 +# 刷新浏览器页面,确认新条目已正确保存 diff --git a/plugins/tiddlywiki/tiddlyweb/language/zh-Hans/Translations.multids b/plugins/tiddlywiki/tiddlyweb/language/zh-Hans/Translations.multids new file mode 100644 index 000000000..142e872c4 --- /dev/null +++ b/plugins/tiddlywiki/tiddlyweb/language/zh-Hans/Translations.multids @@ -0,0 +1,12 @@ +title: $:/plugins/tiddlywiki/tiddlyweb/language/zh-Hans/ + +ConfigOfficialPluginLibrary: 使用客户端-服务器配置时,官方插件库将被禁用。取而代之的是,应按照[[here|https://tiddlywiki.com/#Installing%20a%20plugin%20from%20the%20plugin%20library]]所述,通过 "tiddlywiki.info" 文件安装插件。 +GettingStartedStep1: 第一步<br>同步 +CopySyncerLogs: 将同步器日志复制到剪贴板 +LoginAs: 您目前已登录<$reveal state="$:/status/UserName" type="nomatch" text="" default="">为<strong><$text text={{$:/status/UserName}}/></strong></$reveal> +Readonly: <$reveal state="$:/status/IsReadOnly" type="match" text="yes" default="no">(只读)</$reveal> +Login: 登录 +Logout: 登出 +SaveSnapshot: 保存快照以供离线使用 +Refresh/Label: 从服务器刷新 +Refresh/Button: 从服务器获取最新变更 \ No newline at end of file diff --git a/plugins/tiddlywiki/tiddlyweb/language/zh-Hans/readme.tid b/plugins/tiddlywiki/tiddlyweb/language/zh-Hans/readme.tid new file mode 100644 index 000000000..b60ef77e2 --- /dev/null +++ b/plugins/tiddlywiki/tiddlyweb/language/zh-Hans/readme.tid @@ -0,0 +1,7 @@ +title: $:/plugins/tiddlywiki/tiddlyweb/language/zh-Hans/readme + +该插件在浏览器中运行,用于双向同步更改的条目到与 TiddlyWeb 兼容的服务器上(包括在 Node.js 上运行的 TiddlyWiki 5 本身)。在 Node.js 上运行时,它是无法自救的:由于就是该插件提供了与服务器同步设置和插件的机制,因此通过浏览器禁用该插件后,是无法撤销对自己的禁用的。 + +离线时所作的更改会保存在内存中,并在重新建立连接时自动与服务器同步。不过,如果关闭浏览器标签页或加载另一个 URL,内存中的更改就会丢失。可以添加[[https://tiddlywiki.com/#BrowserStorage Plugin]],为离线时的条目更改提供临时文件系统存储,并使其在下次在同一浏览器中加载知识库时与服务器同步。 + +[[源代码|https://github.com/Jermolene/TiddlyWiki5/blob/master/plugins/tiddlywiki/tiddlyweb]] diff --git a/plugins/tiddlywiki/tiddlyweb/readme.tid b/plugins/tiddlywiki/tiddlyweb/readme.tid index ee30a2dd4..ac3991be6 100644 --- a/plugins/tiddlywiki/tiddlyweb/readme.tid +++ b/plugins/tiddlywiki/tiddlyweb/readme.tid @@ -1,7 +1,5 @@ title: $:/plugins/tiddlywiki/tiddlyweb/readme -This plugin runs in the browser to synchronise tiddler changes to and from a TiddlyWeb-compatible server (including TiddlyWiki 5 itself, running on Node.js). It is inert when run under Node.js. Disabling this plugin via the browser can not be undone via the browser since this plugin provides the mechanism to synchronize settings with the server. +\define lingo-base() $:/plugins/tiddlywiki/tiddlyweb/language/ -Changes made while offline are saved in memory and automatically synchonised with the server when the connection is re-established. However, if the browser tab is closed or another URL is loaded, the in-memory changes will be lost. The [[https://tiddlywiki.com/#BrowserStorage Plugin]] may be added to provide temporary filesystem storage of tiddler changes made while offline and enable them to be synchronised with the server the next time the wiki is loaded in the same browser. - -[[Source code|https://github.com/Jermolene/TiddlyWiki5/blob/master/plugins/tiddlywiki/tiddlyweb]] +<<lingo readme>> diff --git a/plugins/tiddlywiki/tiddlyweb/syncer-actions-copy-logs.tid b/plugins/tiddlywiki/tiddlyweb/syncer-actions-copy-logs.tid index b141670e6..6a8539028 100644 --- a/plugins/tiddlywiki/tiddlyweb/syncer-actions-copy-logs.tid +++ b/plugins/tiddlywiki/tiddlyweb/syncer-actions-copy-logs.tid @@ -1,6 +1,8 @@ title: $:/plugins/tiddlywiki/tiddlyweb/syncer-actions/copy-logs tags: $:/tags/SyncerDropdown +\define lingo-base() $:/plugins/tiddlywiki/tiddlyweb/language/ + <$button message="tm-copy-syncer-logs-to-clipboard" class="tc-btn-invisible"> -{{$:/core/images/copy-clipboard}} Copy syncer logs to clipboard +{{$:/core/images/copy-clipboard}} <<lingo CopySyncerLogs>> </$button> diff --git a/plugins/tiddlywiki/tiddlyweb/syncer-actions-login-status.tid b/plugins/tiddlywiki/tiddlyweb/syncer-actions-login-status.tid index 11816f1b4..e87c87516 100644 --- a/plugins/tiddlywiki/tiddlyweb/syncer-actions-login-status.tid +++ b/plugins/tiddlywiki/tiddlyweb/syncer-actions-login-status.tid @@ -1,9 +1,11 @@ title: $:/plugins/tiddlywiki/tiddlyweb/syncer-actions/login-status tags: $:/tags/SyncerDropdown +\define lingo-base() $:/plugins/tiddlywiki/tiddlyweb/language/ + <$reveal state="$:/status/IsLoggedIn" type="match" text="yes"> <div class="tc-drop-down-info"> -You are logged in<$reveal state="$:/status/UserName" type="nomatch" text="" default=""> as <strong><$text text={{$:/status/UserName}}/></strong></$reveal><$reveal state="$:/status/IsReadOnly" type="match" text="yes" default="no"> (read-only)</$reveal> +<<lingo LoginAs>><<lingo Readonly>> </div> <hr/> </$reveal> diff --git a/plugins/tiddlywiki/tiddlyweb/syncer-actions-login.tid b/plugins/tiddlywiki/tiddlyweb/syncer-actions-login.tid index cdd95f5a6..f0648c70c 100644 --- a/plugins/tiddlywiki/tiddlyweb/syncer-actions-login.tid +++ b/plugins/tiddlywiki/tiddlyweb/syncer-actions-login.tid @@ -1,8 +1,10 @@ title: $:/plugins/tiddlywiki/tiddlyweb/syncer-actions/login tags: $:/tags/SyncerDropdown +\define lingo-base() $:/plugins/tiddlywiki/tiddlyweb/language/ + <$reveal state="$:/status/IsLoggedIn" type="nomatch" text="yes"> <$button message="tm-login" class="tc-btn-invisible"> -{{$:/core/images/unlocked-padlock}} Login +{{$:/core/images/unlocked-padlock}} <<lingo Login>> </$button> </$reveal> diff --git a/plugins/tiddlywiki/tiddlyweb/syncer-actions-logout.tid b/plugins/tiddlywiki/tiddlyweb/syncer-actions-logout.tid index 358944d1a..861007f2b 100644 --- a/plugins/tiddlywiki/tiddlyweb/syncer-actions-logout.tid +++ b/plugins/tiddlywiki/tiddlyweb/syncer-actions-logout.tid @@ -1,8 +1,10 @@ title: $:/plugins/tiddlywiki/tiddlyweb/syncer-actions/logout tags: $:/tags/SyncerDropdown +\define lingo-base() $:/plugins/tiddlywiki/tiddlyweb/language/ + <$reveal state="$:/status/IsLoggedIn" type="match" text="yes"> <$button message="tm-logout" class="tc-btn-invisible"> -{{$:/core/images/cancel-button}} Logout +{{$:/core/images/cancel-button}} <<lingo Logout>> </$button> </$reveal> diff --git a/plugins/tiddlywiki/tiddlyweb/syncer-actions-refresh.tid b/plugins/tiddlywiki/tiddlyweb/syncer-actions-refresh.tid index c397badc5..2cb2ffd82 100644 --- a/plugins/tiddlywiki/tiddlyweb/syncer-actions-refresh.tid +++ b/plugins/tiddlywiki/tiddlyweb/syncer-actions-refresh.tid @@ -1,9 +1,17 @@ title: $:/plugins/tiddlywiki/tiddlyweb/syncer-actions/refresh tags: $:/tags/SyncerDropdown -<$reveal state="$:/status/IsLoggedIn" type="match" text="yes"> -<$button tooltip="Get latest changes from the server" aria-label="Refresh from server" class="tc-btn-invisible"> -<$action-sendmessage $message="tm-server-refresh"/> -{{$:/core/images/refresh-button}}<span class="tc-btn-text"><$text text="Get latest changes from the server"/></span> -</$button> -</$reveal> +\whitespace trim +<$let lingo-base="$:/plugins/tiddlywiki/tiddlyweb/language/"> + <$wikify name=buttonText text="<<lingo Refresh/Button>>"> + <$wikify name=ariaLabel text="<<lingo Refresh/Label>>"> + <$reveal state="$:/status/IsLoggedIn" type="match" text="yes"> + <$button tooltip=<<ariaLabel>> aria-label=<<ariaLabel>> class="tc-btn-invisible"> + <$action-sendmessage $message="tm-server-refresh"/> + {{$:/core/images/refresh-button}} + <span class="tc-btn-text"><<buttonText>></span> + </$button> + </$reveal> + </$wikify> + </$wikify> +</$let> diff --git a/plugins/tiddlywiki/tiddlyweb/syncer-actions-save-snapshot.tid b/plugins/tiddlywiki/tiddlyweb/syncer-actions-save-snapshot.tid index 23bb4c914..e0eea1994 100644 --- a/plugins/tiddlywiki/tiddlyweb/syncer-actions-save-snapshot.tid +++ b/plugins/tiddlywiki/tiddlyweb/syncer-actions-save-snapshot.tid @@ -1,9 +1,11 @@ title: $:/plugins/tiddlywiki/tiddlyweb/syncer-actions/save-snapshot tags: $:/tags/SyncerDropdown +\define lingo-base() $:/plugins/tiddlywiki/tiddlyweb/language/ + <$button class="tc-btn-invisible"> <$wikify name="site-title" text={{$:/config/SaveWikiButton/Filename}}> <$action-sendmessage $message="tm-download-file" $param={{$:/config/SaveWikiButton/Template}} filename=<<site-title>>/> </$wikify> -{{$:/core/images/download-button}} Save snapshot for offline use +{{$:/core/images/download-button}} <<lingo SaveSnapshot>> </$button> diff --git a/plugins/tiddlywiki/tiddlyweb/tree.tid b/plugins/tiddlywiki/tiddlyweb/tree.tid new file mode 100644 index 000000000..cc7ef97ba --- /dev/null +++ b/plugins/tiddlywiki/tiddlyweb/tree.tid @@ -0,0 +1,4 @@ +title: $:/plugins/tiddlywiki/tiddlyweb/tree +type: text/vnd.tiddlywiki + +<<tree prefix:"$:/plugins/tiddlywiki/tiddlyweb/">> \ No newline at end of file