diff --git a/docs/terms.toml b/docs/terms.toml index feeb520..4b25b50 100644 --- a/docs/terms.toml +++ b/docs/terms.toml @@ -116,3 +116,18 @@ description = "The distance between consecutive elements in a sequence" en = "separator" zh = "分隔符" description = "A character or item used to separate or mark boundaries between elements" + +[destructure] +en = "destructure" +zh = "解构" +description = "The process of extracting values from arrays or dictionaries into individual variables" + +[destructured] +en = "destructured" +zh = "被解构的" +description = "Having been processed through destructuring; past participle of destructure" + +[binding] +en = "binding" +zh = "绑定" +description = "The association of a value with a variable name (let binding) or the physical binding of pages in a book (page binding)" diff --git a/locales/docs/typst-docs.toml b/locales/docs/typst-docs.toml index 880c108..e7c2c1e 100644 --- a/locales/docs/typst-docs.toml +++ b/locales/docs/typst-docs.toml @@ -725,7 +725,7 @@ zh = "一系列值。\n\n您可以通过将以逗号分隔的值序列括在括 [reference.foundations.array.array.enumerate.details] en = "Returns a new array with the values alongside their indices.\n\nThe returned array consists of `(index, value)` pairs in the form of\nlength-2 arrays. These can be [destructured]($scripting/#bindings) with\na let binding or for loop." -zh = "返回一个包含值及其索引的新数组。\n\n返回的数组由 `(index, value)` 对组成,形式为长度为 2 的数组。这些可以通过 let 绑定或 for 循环进行[解构]($scripting/#bindings)。" +zh = "返回一个包含值及其索引的新数组。\n\n返回的数组由 `(index, value)` 对组成,形式为长度为 2 的数组。这些可以通过 let「绑定」([binding](#x-term-binding))或 for 循环进行「解构」([destructured](#x-term-destructured))。" [reference.foundations.array.array.enumerate.oneliner] en = "Returns a new array with the values alongside their indices." @@ -5419,7 +5419,7 @@ zh = "页面背景中的内容。\n\n这些内容将放置在页面主体的后 [reference.layout.page.page.binding.details] en = "On which side the pages will be bound.\n\n- `{auto}`: Equivalent to `left` if the [text direction]($text.dir)\n is left-to-right and `right` if it is right-to-left.\n- `left`: Bound on the left side.\n- `right`: Bound on the right side.\n\nThis affects the meaning of the `inside` and `outside` options for\nmargins." -zh = "页面将绑定在哪一侧。\n\n- `{auto}`: 如果 [文本方向]($text.dir) 是左到右,则等同于 `left`;如果文本方向是右到左,则等同于 `right`。\n- `left`: 绑定在左侧。\n- `right`: 绑定在右侧。\n\n这会影响边距的 `inside` 和 `outside` 选项的含义。" +zh = "页面将「绑定」([binding](#x-term-binding))在哪一侧。\n\n- `{auto}`: 如果 [文本方向]($text.dir) 是左到右,则等同于 `left`;如果文本方向是右到左,则等同于 `right`。\n- `left`: 绑定在左侧。\n- `right`: 绑定在右侧。\n\n这会影响边距的 `inside` 和 `outside` 选项的含义。" [reference.layout.page.page.body.details] en = "The contents of the page(s).\n\nMultiple pages will be created if the content does not fit on a single\npage. A new page with the page properties prior to the function invocation\nwill be created after the body has been typeset." @@ -5466,7 +5466,7 @@ zh = "页面高度。\n\n如果设置为 `{auto}`,则只能通过插入 [分 [reference.layout.page.page.margin.details] en = "The page's margins.\n\n- `{auto}`: The margins are set automatically to 2.5/21 times the smaller\n dimension of the page. This results in 2.5cm margins for an A4 page.\n- A single length: The same margin on all sides.\n- A dictionary: With a dictionary, the margins can be set individually.\n The dictionary can contain the following keys in order of precedence:\n - `top`: The top margin.\n - `right`: The right margin.\n - `bottom`: The bottom margin.\n - `left`: The left margin.\n - `inside`: The margin at the inner side of the page (where the\n [binding]($page.binding) is).\n - `outside`: The margin at the outer side of the page (opposite to the\n [binding]($page.binding)).\n - `x`: The horizontal margins.\n - `y`: The vertical margins.\n - `rest`: The margins on all sides except those for which the\n dictionary explicitly sets a size.\n\nThe values for `left` and `right` are mutually exclusive with\nthe values for `inside` and `outside`.\n\n" -zh = "页面边距。\n\n- `{auto}`: 边距自动设置为页面较小尺寸的 2.5/21 倍。这将产生 A4 页面的 2.5cm 边距。\n- 单个长度: 所有边都使用相同的边距。\n- 「字典」([dictionary](#x-term-dictionary)): 使用字典可以单独设置边距。字典可以包含以下键,按优先级顺序排列:\n - `top`: 上边距。\n - `right`: 右边距。\n - `bottom`: 下边距。\n - `left`: 左边距。\n - `inside`: 页面内侧的边距([绑定]($page.binding) 所在的一侧)。\n - `outside`: 页面外侧的边距(与 [绑定]($page.binding) 相反的一侧)。\n - `x`: 水平边距。\n - `y`: 垂直边距。\n - `rest`: 所有边距,除了字典显式设置大小的边。\n\n`left` 和 `right` 的值与 `inside` 和 `outside` 的值是互斥的。\n\n" +zh = "页面边距。\n\n- `{auto}`: 边距自动设置为页面较小尺寸的 2.5/21 倍。这将产生 A4 页面的 2.5cm 边距。\n- 单个长度: 所有边都使用相同的边距。\n- 「字典」([dictionary](#x-term-dictionary)): 使用字典可以单独设置边距。字典可以包含以下键,按优先级顺序排列:\n - `top`: 上边距。\n - `right`: 右边距。\n - `bottom`: 下边距。\n - `left`: 左边距。\n - `inside`: 页面内侧的边距(「绑定」([binding](#x-term-binding))所在的一侧)。\n - `outside`: 页面外侧的边距(与 [绑定]($page.binding) 相反的一侧)。\n - `x`: 水平边距。\n - `y`: 垂直边距。\n - `rest`: 所有边距,除了字典显式设置大小的边。\n\n`left` 和 `right` 的值与 `inside` 和 `outside` 的值是互斥的。\n\n" [reference.layout.page.page.number-align.details] en = "The alignment of the page numbering.\n\nIf the vertical component is `top`, the numbering is placed into the\nheader and if it is `bottom`, it is placed in the footer. Horizon\nalignment is forbidden. If an explicit matching `header` or `footer` is\ngiven, the numbering is ignored.\n\n" diff --git a/locales/docs/typst-docs/reference.scripting.body.toml b/locales/docs/typst-docs/reference.scripting.body.toml index 0de05c4..4d87307 100644 --- a/locales/docs/typst-docs/reference.scripting.body.toml +++ b/locales/docs/typst-docs/reference.scripting.body.toml @@ -52,7 +52,7 @@ en = """- **Code block:** `{{ let x = 1; x + 2 }}` \\ determine the block's value. Expressions without useful output, like `{let}` bindings yield `{none}`, which can be joined with any value without effect.""" zh = """- **代码块:** `{{ let x = 1; x + 2 }}` \\ - 在编写代码时,您可能希望将计算分成多个语句,创建一些中间变量等等。代码块允许您在需要一个表达式的地方写多个表达式。代码块中的各个表达式应该用换行符或分号分隔。代码块中各个表达式的输出值被连接起来以确定块的值。没有有用输出的表达式,如 `{let}` 绑定,产生 `{none}`,可以与任何值连接而没有效果。""" + 在编写代码时,您可能希望将计算分成多个语句,创建一些中间变量等等。代码块允许您在需要一个表达式的地方写多个表达式。代码块中的各个表达式应该用换行符或分号分隔。代码块中各个表达式的输出值被连接起来以确定块的值。没有有用输出的表达式,如 `{let}` 「绑定」([bindings](#x-term-binding)),产生 `{none}`,可以与任何值连接而没有效果。""" [[main]] en = """- **Content block:** `{[*Hey* there!]}` \\ @@ -90,7 +90,7 @@ will be initialized as `{none}`. The `{let}` keyword can also be used to create a [custom named function]($function/#defining-functions). Variables can be accessed for the rest of the containing block (or the rest of the file if there is no containing block).""" -zh = """## 绑定和解构 { #bindings } +zh = """## 「绑定」([binding](#x-term-binding))和「解构」([destructure](#x-term-destructure)) { #bindings } 如上所示,变量可以用 `{let}` 绑定定义。变量被赋值为等号后面的表达式的值。赋值是可选的,如果没有赋值,变量将被初始化为 `{none}`。`{let}` 关键字也可以用于创建 [自定义命名函数]($function/#defining-functions)。变量可以在包含块(或文件中没有包含块时为整个文件)的剩余部分访问。""" [[main]] @@ -109,7 +109,7 @@ en = """Let bindings can also be used to destructure [arrays]($array) and assignment should mirror an array or dictionary. The `..` operator can be used once in the pattern to collect the remainder of the array's or dictionary's items.""" -zh = """Let 绑定也可以用于解构 [数组]($array) 和 [字典]($dictionary)。在这种情况下,赋值的左侧应该与数组或字典匹配。`..` 操作符可以用于一次在模式中收集数组或字典的其余部分。""" +zh = """Let 绑定也可以用于「解构」([destructure](#x-term-destructure)) [数组]($array) 和 [字典]($dictionary)。在这种情况下,赋值的左侧应该与数组或字典匹配。`..` 操作符可以用于一次在模式中收集数组或字典的其余部分。""" [[main]] en = """```example @@ -140,7 +140,7 @@ Homer wrote #h. [[main]] en = """You can use the underscore to discard elements in a destructuring pattern:""" -zh = """您可以使用下划线来丢弃解构模式中的元素:""" +zh = """您可以使用下划线来丢弃「解构」([destructuring](#x-term-destructure))模式中的元素:""" [[main]] en = """```example @@ -150,7 +150,7 @@ The y coordinate is #y. [[main]] en = """Destructuring also works in argument lists of functions ...""" -zh = """解构也适用于函数的参数列表 ...""" +zh = """「解构」([destructuring](#x-term-destructure))也适用于函数的参数列表 ...""" [[main]] en = """```example @@ -243,7 +243,7 @@ en = """- `{for value in array {..}}` \\ Iterates over the items in the [array]. The destructuring syntax described in [Let binding]($scripting/#bindings) can also be used here.""" zh = """- `{for value in array {..}}` \\ - 迭代 [数组] 中的项目。[Let 绑定]($scripting/#bindings) 中描述的解构语法也可以在这里使用。""" + 迭代 [数组] 中的项目。[Let 绑定]($scripting/#bindings) 中描述的「解构」([destructuring](#x-term-destructure))语法也可以在这里使用。""" [[main]] en = """- `{for pair in dict {..}}` \\ @@ -252,7 +252,7 @@ en = """- `{for pair in dict {..}}` \\ than `{for pair in dict.pairs() {..}}` because it doesn't create a temporary array of all key-value pairs.""" zh = """- `{for pair in dict {..}}` \\ - 迭代 [字典] 中的键值对。键值对也可以通过使用 `{for (key, value) in dict {..}}` 进行解构。它比 `{for pair in dict.pairs() {..}}` 更高效,因为它不创建所有键值对的临时数组。""" + 迭代 [字典] 中的键值对。键值对也可以通过使用 `{for (key, value) in dict {..}}` 进行「解构」([destructured](#x-term-destructured))。它比 `{for pair in dict.pairs() {..}}` 更高效,因为它不创建所有键值对的临时数组。""" [[main]] en = """- `{for letter in "abc" {..}}` \\ @@ -380,7 +380,7 @@ en = """There are a few special functions that modify the value they are called In some cases, when the method is only called for its side effect, its return value should be ignored (and not participate in joining). The canonical way to discard a value is with a let binding: `{let _ = array.remove(1)}`.""" -zh = """有一些特殊的函数会修改它们被调用的值(例如 [`array.push`]($array.push))。这些函数 _必须_ 以方法形式调用。在某些情况下,当方法仅用于其副作用时,其返回值应被忽略(且不参与连接)。丢弃值的规范方法是使用 let 绑定:`{let _ = array.remove(1)}`。""" +zh = """有一些特殊的函数会修改它们被调用的值(例如 [`array.push`]($array.push))。这些函数 _必须_ 以方法形式调用。在某些情况下,当方法仅用于其副作用时,其返回值应被忽略(且不参与连接)。丢弃值的规范方法是使用 let「绑定」([binding](#x-term-binding)):`{let _ = array.remove(1)}`。""" [[main]] en = """## Modules @@ -413,7 +413,7 @@ en = """- **Import items:** `{import "bar.typ": a, b}` \\ loads all variables defined in a module. You can use the `as` keyword to rename the individual items: `{import "bar.typ": a as one, b as two}`""" zh = """- **导入项:** `{import "bar.typ": a, b}` \\ - 评估路径 `bar.typ` 处的文件,提取变量 `a` 和 `b` 的值(需要定义在 `bar.typ` 中,例如通过 `{let}` 绑定),并在当前文件中定义它们。将 `a, b` 替换为 `*` 加载模块中定义的所有变量。您可以使用 `as` 关键字重命名各个项:`{import "bar.typ": a as one, b as two}`""" + 评估路径 `bar.typ` 处的文件,提取变量 `a` 和 `b` 的值(需要定义在 `bar.typ` 中,例如通过 `{let}` 「绑定」([bindings](#x-term-binding))),并在当前文件中定义它们。将 `a, b` 替换为 `*` 加载模块中定义的所有变量。您可以使用 `as` 关键字重命名各个项:`{import "bar.typ": a as one, b as two}`""" [[main]] en = """Instead of a path, you can also use a [module value]($module), as shown in the @@ -460,7 +460,7 @@ operations, such as [modulus]($calc.rem-euclid), do not have a special syntax and can be achieved using functions from the [`calc`]($category/foundations/calc) module.""" zh = """## 运算符 -以下表格列出了所有可用的单目和双目运算符及其效果、元数(单目、双目)和优先级(更高绑定更强)。一些操作,例如 [取模]($calc.rem-euclid),没有特殊的语法,可以使用 [`calc`]($category/foundations/calc) 模块中的函数来实现。""" +以下表格列出了所有可用的单目和双目运算符及其效果、元数(单目、双目)和优先级(更高「绑定」([binding](#x-term-binding))更强)。一些操作,例如 [取模]($calc.rem-euclid),没有特殊的语法,可以使用 [`calc`]($category/foundations/calc) 模块中的函数来实现。""" [[main]] en = """| Operator | Effect | Arity | Precedence | diff --git a/locales/docs/typst-docs/reference.svg.svg.details.toml b/locales/docs/typst-docs/reference.svg.svg.details.toml index 0f56e10..64a00cd 100644 --- a/locales/docs/typst-docs/reference.svg.svg.details.toml +++ b/locales/docs/typst-docs/reference.svg.svg.details.toml @@ -8,7 +8,7 @@ bound to a specific resolution. Hence, you can print or view SVG files on any device without incurring a loss of quality. (Note that font printing quality may be better with a PDF.) In contrast to a PDF, an SVG cannot contain multiple pages. When exporting a multi-page document, Typst will emit multiple SVGs.""" -zh = """Typst 不仅可以创建 PDF,还可以直接渲染页面到可缩放的矢量图形(SVG),这是在网页中嵌入矢量图形的优选格式。与 PDF 文件一样,SVG 会精确显示您在 Typst 中布置的文档。同样,它们共享不绑定到特定分辨率的优点。因此,您可以在任何设备上打印或查看 SVG 文件,而不会损失质量。(请注意,使用 PDF 打印质量可能更好。)与 PDF 不同,SVG 不能包含多个页面。当导出多页文档时,Typst 将发出多个 SVG。""" +zh = """Typst 不仅可以创建 PDF,还可以直接渲染页面到可缩放的矢量图形(SVG),这是在网页中嵌入矢量图形的优选格式。与 PDF 文件一样,SVG 会精确显示您在 Typst 中布置的文档。同样,它们共享不「绑定」([binding](#x-term-binding))到特定分辨率的优点。因此,您可以在任何设备上打印或查看 SVG 文件,而不会损失质量。(请注意,使用 PDF 打印质量可能更好。)与 PDF 不同,SVG 不能包含多个页面。当导出多页文档时,Typst 将发出多个 SVG。""" [[main]] en = """SVGs can represent text in two ways: By embedding the text itself and rendering diff --git a/locales/docs/typst-docs/reference.syntax.body.toml b/locales/docs/typst-docs/reference.syntax.body.toml index 7c1a3f9..0f25278 100644 --- a/locales/docs/typst-docs/reference.syntax.body.toml +++ b/locales/docs/typst-docs/reference.syntax.body.toml @@ -223,7 +223,7 @@ zh = """| 名称 | 示例 | 参见 | 函数调用 | `{min(x, y)}` | [Function]($function) | | 参数传播 | `{min(..nums)}` | [Arguments]($arguments) | | 无名函数 | `{(x, y) => x + y}` | [Function]($function) | -| 绑定 | `{let x = 1}` | [Scripting]($scripting/#bindings) | +| 「绑定」([binding](#x-term-binding)) | `{let x = 1}` | [Scripting]($scripting/#bindings) | | 命名函数 | `{let f(x) = 2 * x}` | [Function]($function) | | 设置规则 | `{set text(14pt)}` | [Styling]($styling/#set-rules) | | 设置-如果规则 | `{set text(..) if .. }` | [Styling]($styling/#set-rules) | diff --git a/locales/docs/typst-docs/tutorial.advanced-styling.body.toml b/locales/docs/typst-docs/tutorial.advanced-styling.body.toml index 0c7073c..da675dd 100644 --- a/locales/docs/typst-docs/tutorial.advanced-styling.body.toml +++ b/locales/docs/typst-docs/tutorial.advanced-styling.body.toml @@ -295,7 +295,7 @@ en = """```example:single en = """After we bound the content to the `title` variable, we can use it in functions and also within markup (prefixed by `#`, like functions). This way, if we decide on another title, we can easily change it in one place.""" -zh = """绑定到 `title` 变量后,我们可以在函数和标记中使用它(前缀为 `#`,如函数)。这样,如果我们决定使用另一个标题,我们可以在一个地方轻松更改它。""" +zh = """「绑定」([bound](#x-term-binding))到 `title` 变量后,我们可以在函数和标记中使用它(前缀为 `#`,如函数)。这样,如果我们决定使用另一个标题,我们可以在一个地方轻松更改它。""" [[main]] en = """## Adding columns and headings { #columns-and-headings }