1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-12-07 09:18:06 +00:00

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.
This commit is contained in:
lin onetwo
2024-06-08 08:58:21 -05:00
committed by GitHub
parent 3ddd10d373
commit 78ace99685
37 changed files with 400 additions and 94 deletions

View File

@@ -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>>

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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()

View File

@@ -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">

View File

@@ -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

View File

@@ -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">

View File

@@ -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;

View File

@@ -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

View File

@@ -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;`.

View File

@@ -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 的项目

View File

@@ -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;` 而推到菜单栏的右侧。

View File

@@ -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>>

View File

@@ -0,0 +1,4 @@
title: $:/plugins/tiddlywiki/menubar/tree
type: text/vnd.tiddlywiki
<<tree prefix:"$:/plugins/tiddlywiki/menubar/">>