Skip to content

Commit

Permalink
Merge pull request #6 from relic-yuexi/main
Browse files Browse the repository at this point in the history
Add reference.text.emph and reference.layout.par Element Translations
  • Loading branch information
OrangeX4 authored Aug 13, 2023
2 parents f65434e + b0daea5 commit f9ca2e8
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 45 deletions.
63 changes: 31 additions & 32 deletions docs/i18n/layout/par-zh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,11 @@ body:
- par
display: Paragraph
keywords: null
oneliner: Arranges text, spacing and inline-level elements into a paragraph.
oneliner: 将文本、间距和内联级元素排列成段落。
element: true
details: |-
<p>Arranges text, spacing and inline-level elements into a paragraph.</p>
<p>Although this function is primarily used in set rules to affect paragraph
properties, it can also be used to explicitly render its argument onto a
paragraph of its own.</p>
<p>将文本、间距和内联级元素排列成段落。</p>
<p>虽然这个函数主要用于设置规则以影响段落属性,但也可以用于将其参数显式地呈现在自己的段落中。</p>
<h2 id="example">Example</h2>
<div class="previewed-code"><pre><code><span class="typ-key">#</span><span class="typ-key">show</span> <span class="typ-func">par</span><span class="typ-punct">:</span> <span class="typ-key">set</span> <span class="typ-func">block</span><span class="typ-punct">(</span>spacing<span class="typ-punct">:</span> <span class="typ-num">0.65em</span><span class="typ-punct">)</span>
<span class="typ-key">#</span><span class="typ-key">set</span> <span class="typ-func">par</span><span class="typ-punct">(</span>
Expand All @@ -64,7 +62,7 @@ body:
</code></pre><div class="preview"><img src="/assets/docs/4ad0c7e875ca044b839c4c85e8b6cb15.png" alt="Preview" width="480" height="190"/></div></div>
params:
- name: leading
details: <p>The spacing between lines.</p>
details: <p>行间距。</p>
example: null
types:
- length
Expand All @@ -77,13 +75,9 @@ body:
settable: true
- name: justify
details: |-
<p>Whether to justify text in its line.</p>
<p>Hyphenation will be enabled for justified paragraphs if the <a href="/docs/reference/text/text/#parameters-hyphenate">text
property hyphenate</a> is set to <code><span class="typ-key">auto</span></code> and the
current language is known.</p>
<p>Note that the current <a href="/docs/reference/layout/align/">alignment</a> still has an effect on
the placement of the last line except if it ends with a <a href="/docs/reference/text/linebreak/#parameters-justify">justified line
break</a>.</p>
<p>是否开启两端对齐。</p>
<p>如果文本的<a href="/docs/reference/text/text/#parameters-hyphenate">连字属性</a>设置为<code><span class="typ-key">auto</span></code>,并且当前语言已知,则会在两端对齐的段落中启用连字功能。</p>
<p>请注意,当前的<a href="/docs/reference/layout/align/">对齐方式</a>仍然会影响最后一行的位置,除非最后一行以<a href="/docs/reference/text/linebreak/#parameters-justify">两端对齐的换行</a>结束。</p>
example: null
types:
- boolean
Expand All @@ -96,11 +90,8 @@ body:
settable: true
- name: linebreaks
details: |-
<p>How to determine line breaks.</p>
<p>When this property is set to <code><span class="typ-key">auto</span></code>, its default value, optimized line
breaks will be used for justified paragraphs. Enabling optimized line
breaks for ragged paragraphs may also be worthwhile to improve the
appearance of the text.</p>
<p>如何确定换行位置。</p>
<p>当这个属性被设置为<code><span class="typ-key">auto</span></code>,也就是它的默认值时,会在两端对齐的段落中使用优化过的换行位置。对于不规则对齐的段落启用优化过的换行位置也是有价值的,可以改善文本的外观。</p>
example: |-
<div class="previewed-code"><pre><code><span class="typ-key">#</span><span class="typ-key">set</span> <span class="typ-func">page</span><span class="typ-punct">(</span>width<span class="typ-punct">:</span> <span class="typ-num">190pt</span><span class="typ-punct">)</span>
<span class="typ-key">#</span><span class="typ-key">set</span> <span class="typ-func">par</span><span class="typ-punct">(</span>linebreaks<span class="typ-punct">:</span> <span class="typ-str">&quot;simple&quot;</span><span class="typ-punct">)</span>
Expand All @@ -122,12 +113,11 @@ body:
- string
strings:
- string: simple
details: <p>Determine the line breaks in a simple first-fit style.</p>
details: <p>以简单的逐行适应方式确定换行位置。</p>
- string: optimized
details: |-
<p>Optimize the line breaks for the whole paragraph.</p>
<p>Typst will try to produce more evenly filled lines of text by
considering the whole paragraph when calculating line breaks.</p>
<p>优化整段文字的换行位置。</p>
<p>Typst 将尝试通过在计算换行位置时考虑整个段落,以生成更加均匀填充的文本行。</p>
default: <code><span class="typ-key">auto</span></code>
positional: false
named: true
Expand All @@ -136,14 +126,23 @@ body:
settable: true
- name: first-line-indent
details: |-
<p>The indent the first line of a paragraph should have.</p>
<p>Only the first line of a consecutive paragraph will be indented (not
the first one in a block or on the page).</p>
<p>By typographic convention, paragraph breaks are indicated either by some
space between paragraphs or by indented first lines. Consider reducing
the <a href="/docs/reference/layout/block/#parameters-spacing">paragraph spacing</a> to the [<code>leading</code>] when
using this property (e.g. using
<code><span class="typ-key">#</span><span class="typ-key">show</span> <span class="typ-func">par</span><span class="typ-punct">:</span> <span class="typ-key">set</span> <span class="typ-func">block</span><span class="typ-punct">(</span>spacing<span class="typ-punct">:</span> <span class="typ-num">0.65em</span><span class="typ-punct">)</span></code>).</p>
<p>首行缩进。</p>
<p>只有连续段落中的第一行会有缩进(而不是块或页面上的第一行)。</p>
<p>按照排版规则,段落之间的换行可以通过段落之间的一些空间或段落开头的缩进来表示。
请考虑将<a href="/docs/reference/layout/block/#parameters-spacing"">段落间距</a>设置为[<code>leading</code>],当您使用这个属性时(例如,使用<code><span class="typ-key">#</span><span class="typ-key">show</span> <span class="typ-func">par</span><span class="typ-punct">:</span> <span class="typ-key">set</span> <span class="typ-func">block</span><span class="typ-punct">(</span>spacing<span class="typ-punct">:</span> <span class="typ-num">0.65em</span><span class="typ-punct">)</span></code>)。
</p>
<p>第一段的第一行不缩进,从第二段才开始缩进。这是first-line-indent默认的,西文排版方式。
如果要做到第一行也缩进,变通的解决方案是,在段前加个#h()。
解决代码如下所示:
<code>
#set par(justify: true,first-line-indent: 2em)
#show heading: it => {
it
par()[#text()[#h(0.0em)]]
}
</code>
</p>
example: null
types:
- length
Expand All @@ -155,7 +154,7 @@ body:
variadic: false
settable: true
- name: hanging-indent
details: <p>The indent all but the first line of a paragraph should have.</p>
details: <p>悬挂缩进。段落首行不缩进,其他行缩进。</p>
example: null
types:
- length
Expand All @@ -167,7 +166,7 @@ body:
variadic: false
settable: true
- name: body
details: <p>The contents of the paragraph.</p>
details: <p>段落内容。</p>
example: null
types:
- content
Expand Down
18 changes: 8 additions & 10 deletions docs/i18n/text/emph-zh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ body:
- emph
display: Emphasis
keywords: null
oneliner: Emphasizes content by setting it in italics.
oneliner: 用斜体来突出内容。
element: true
details: |-
<p>Emphasizes content by setting it in italics.</p>
<p>用斜体来突出内容。</p>
<ul>
<li>If the current <a href="/docs/reference/text/text/#parameters-style">text style</a> is <code><span class="typ-str">&quot;normal&quot;</span></code>,
this turns it into <code><span class="typ-str">&quot;italic&quot;</span></code>.</li>
<li>If it is already <code><span class="typ-str">&quot;italic&quot;</span></code> or <code><span class="typ-str">&quot;oblique&quot;</span></code>,
it turns it back to <code><span class="typ-str">&quot;normal&quot;</span></code>.</li>
<li>如果当前的 <a href="/docs/reference/text/text/#parameters-style">文本样式</a> <code><span class="typ-str">&quot;normal&quot;</span></code>
则将其变为 <code><span class="typ-str">&quot;italic&quot;</span></code></li>
<li>如果已经是 <code><span class="typ-str">&quot;italic&quot;</span></code> 或者 <code><span class="typ-str">&quot;oblique&quot;</span></code>
则将其恢复为 <code><span class="typ-str">&quot;normal&quot;</span></code></li>
</ul>
<h2 id="example">Example</h2>
<div class="previewed-code"><pre><code>This is <span class="typ-emph">_emphasized._</span> <span class="typ-escape">\</span>
Expand All @@ -46,12 +46,10 @@ body:
This is <span class="typ-emph">_emphasized_</span> differently.
</code></pre><div class="preview"><img src="/assets/docs/e994151e9b1baafdc57d2fb5046ee42b.png" alt="Preview" width="480" height="190"/></div></div>
<h2 id="syntax">Syntax</h2>
<p>This function also has dedicated syntax: To emphasize content, simply
enclose it in underscores (<code>_</code>). Note that this only works at word
boundaries. To emphasize part of a word, you have to use the function.</p>
<p>这个功能还有特定的语法:要强调内容,只需用下划线 (_) 将其括起来。请注意,这仅在词边界起作用。要强调单词的一部分,你必须使用这个函数,例如"#emph[eng]lish",而"_eng_lish"会报错。</p>
params:
- name: body
details: <p>The content to emphasize.</p>
details: <p>要强调的内容。</p>
example: null
types:
- content
Expand Down
4 changes: 2 additions & 2 deletions docs/i18n/text/linebreak-zh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ body:
- linebreak
display: Line Break
keywords: null
oneliner: Inserts a line break.
oneliner: 插入一个换行。
element: true
details: |-
<p>Inserts a line break.</p>
<p>插入一个换行。</p>
<p>Advances the paragraph to the next line. A single trailing line break at the
end of a paragraph is ignored, but more than one creates additional empty
lines.</p>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/reference/scripting.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Typst 内置了一个强大的脚本语言。可以使用代码自动生成文

## 表达式 { #expressions }

Typse 里面,标记和代码相互交融在一起。
Typst 里面,标记和代码相互交融在一起。
除了最常用的文档元素,其他所有均是由 _函数_ 生成。
为了尽可能的便利,Typst 设计了精巧的语法,用来将代码嵌入在标记中:用 `#`(井号) 来引入一个代码表达式,
表达式结束后,再恢复到正常的标记语法解析。
Expand Down

0 comments on commit f9ca2e8

Please sign in to comment.