Skip to content

Commit 31a9641

Browse files
committed
Add: translation of ref
Signed-off-by: Shunsuke Kimura <[email protected]>
1 parent 9815bf7 commit 31a9641

File tree

5 files changed

+34
-37
lines changed

5 files changed

+34
-37
lines changed

crates/typst-library/src/model/cite.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ pub struct CiteElem {
5656
#[required]
5757
pub key: Label,
5858

59-
/// ページ番号や章番号などの引用の補足
59+
/// ページ番号や章番号などの引用の補足語
6060
///
61-
/// [References]($ref)の構文では、角括弧で囲むことで補足を追加できます
61+
/// [References]($ref)の構文では、角括弧で囲むことで補足語を追加できます
6262
///
6363
/// ```example
6464
/// This has been proven. @distress[p.~7]

crates/typst-library/src/model/figure.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ pub struct FigureElem {
162162
/// - コンテンツに関わらず特定のカウンターを強制的に使用したい場合
163163
///
164164
/// 種類は、エレメント関数または文字列に設定できます。
165-
/// [`{table}`]($table)、[`{raw}`](raw)、[`{image}`](image)以外のエレメント関数に設定した場合は、図表の補足(supplement)を手動で指定する必要があります。
165+
/// [`{table}`]($table)、[`{raw}`](raw)、[`{image}`](image)以外のエレメント関数に設定した場合は、図表の補足語(supplement)を手動で指定する必要があります。
166166
///
167167
/// ```example
168168
/// #figure(
@@ -174,10 +174,10 @@ pub struct FigureElem {
174174
/// ```
175175
pub kind: Smart<FigureKind>,
176176

177-
/// 図表の補足
177+
/// 図表の補足語
178178
///
179-
/// `{auto}` に設定すると、図表は、種類や[テキスト言語]($text.lang)に基づいて、正しい補足を自動的に決定しようとします
180-
/// 独自の図表タイプを使用している場合は、補足を手動で指定する必要があります
179+
/// `{auto}` に設定すると、図表は、種類や[テキスト言語]($text.lang)に基づいて、正しい補足語を自動的に決定しようとします
180+
/// 独自の図表タイプを使用している場合は、補足語を手動で指定する必要があります
181181
///
182182
/// 関数が指定された場合、その関数は指定された種類の最初の子孫要素(通常は図の本体)に渡され、内容を返す必要があります。
183183
///

crates/typst-library/src/model/reference.rs

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,20 @@ use crate::text::TextElem;
1616

1717
/// ラベルや参考文献への参照。
1818
///
19-
/// Takes a label and cross-references it. There are two kind of references,
20-
/// determined by its [`form`]($ref.form): `{"normal"}` and `{"page"}`.
19+
/// ラベルを指定して、その参照を生成します。
20+
/// 参照の[`form`]($ref.form)には`{"normal"}``{"page"}`の2種類があります。
2121
///
22-
/// The default, a `{"normal"}` reference, produces a textual reference to a
23-
/// label. For example, a reference to a heading will yield an appropriate
24-
/// string such as "Section 1" for a reference to the first heading. The
25-
/// references are also links to the respective element. Reference syntax can
26-
/// also be used to [cite] from a bibliography.
22+
/// デフォルトの`{"normal"}`参照では、ラベルに対するテキスト形式の参照が作られます。
23+
/// たとえば見出しへの参照なら、「Section 1」([`lang`]($text.lang)を`{"ja"}`にしていると「節1」)などのような適切な文字列が表示されます。
24+
/// この参照は、該当する要素へのリンクとしても機能します。
25+
/// また、参照の構文は文献リストからの引用を行う[cite]にも使うことができます。
2726
///
28-
/// As the default form requires a supplement and numbering, the label must be
29-
/// attached to a _referenceable element_. Referenceable elements include
30-
/// [headings]($heading), [figures]($figure), [equations]($math.equation), and
31-
/// [footnotes]($footnote). To create a custom referenceable element like a
32-
/// theorem, you can create a figure of a custom [`kind`]($figure.kind) and
33-
/// write a show rule for it. In the future, there might be a more direct way
34-
/// to define a custom referenceable element.
27+
/// このデフォルト形式では補足語(たとえば「節1」では「節」)と番号が必要なため、ラベルは _参照可能な要素_ に付ける必要があります。
28+
/// 参照可能な要素としては、
29+
/// [headings]($heading)、[figures]($figure)、[equations]($math.equation)、[footnotes]($footnote)
30+
/// などがあります。
31+
/// 定理(theorem)などのカスタム参照可能要素を作成したい場合は、カスタム[`kind`]($figure.kind)の図表として作成し、それに対応するshowルールを書くことで作成可能です。
32+
/// 将来的には、カスタム参照可能要素をもっと直接的に定義する方法が導入されるかもしれません。
3533
///
3634
/// # 例
3735
/// ```example
@@ -61,11 +59,11 @@ use crate::text::TextElem;
6159
/// ```
6260
///
6361
/// # Syntax
64-
/// This function also has dedicated syntax: A `{"normal"}` reference to a
65-
/// label can be created by typing an `@` followed by the name of the label
66-
/// (e.g. `[= Introduction <intro>]` can be referenced by typing `[@intro]`).
62+
/// この機能には専用の記法も用意されています。
63+
/// `{"normal"}` の参照を作成するためには`@`に続けてラベル名を入力します。
64+
/// (たとえば`[= Introduction <intro>]`というラベルを参照するには`[@intro]`と入力します。)
6765
///
68-
/// 補足をカスタマイズするには
66+
/// 補足語をカスタマイズするには
6967
/// `[@intro[Chapter]]`のように、参照の後に角括弧でコンテンツを追加します。
7068
///
7169
/// # カスタム
@@ -106,18 +104,16 @@ pub struct RefElem {
106104
#[required]
107105
pub target: Label,
108106

109-
/// 参照の補足
107+
/// 参照の補足語
110108
///
111-
/// If the [`form`]($ref.form) is set to `{"normal"}`:
112-
/// - For references to headings or figures, this is added before the
113-
/// referenced number.
114-
/// - For citations, this can be used to add a page number.
109+
/// [`form`]($ref.form)が`{"normal"}`で設定されている場合は以下のとおりです。
110+
/// - 見出しや図への参照では、この値が参照番号の前に追加されます。
111+
/// - 文献引用の場合は、ページ番号などを追記するのに使えます。
115112
///
116-
/// If the [`form`]($ref.form) is set to `{"page"}`, then this is added
117-
/// before the page number of the label referenced.
113+
/// もし[`form`]($ref.form)`{"page"}`に設定されている場合には、
114+
/// 参照先ラベルのページ番号の前にこの値が追加されます。
118115
///
119-
/// If a function is specified, it is passed the referenced element and
120-
/// should return content.
116+
/// また、関数が指定されている場合は、それに参照先の要素が渡され、戻り値のコンテンツが補足語となります。
121117
///
122118
/// ```example
123119
/// #set heading(numbering: "1.")
@@ -140,7 +136,7 @@ pub struct RefElem {
140136
#[borrowed]
141137
pub supplement: Smart<Option<Supplement>>,
142138

143-
/// The kind of reference to produce.
139+
/// 生成する参照の種類
144140
///
145141
/// ```example
146142
/// #set page(numbering: "1")
@@ -360,10 +356,10 @@ cast! {
360356
/// The form of the reference.
361357
#[derive(Debug, Default, Copy, Clone, Eq, PartialEq, Hash, Cast)]
362358
pub enum RefForm {
363-
/// Produces a textual reference to a label.
359+
/// ラベルに対して文字列での参照を生成します。
364360
#[default]
365361
Normal,
366-
/// Produces a page reference to a label.
362+
/// ラベルに対してページ番号での参照を生成します。
367363
Page,
368364
}
369365

docs/glossary.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ description: |
2323
| markup | マークアップ | 标记 / 标记模式 | Typstのデフォルトモード |
2424
| script | スクリプト | 脚本 / 脚本模式 | Typstのスクリプトモード、「#」で始まる行 |
2525
| figure | 図表 | 图表 | キャプション付きの図表、`image`ではない |
26+
| supplement | 補足語 | | [参照]($ref)されるものの種類を指す文字列、「図1」の「図」など |

translate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def translate_markdown(api_key, model, base_url, sysprompt, input_file, last_out
5151
parser.add_argument("-s", "--sysprompt", default="""
5252
以下の条件に従い、英文の技術文書を日本語に翻訳してください。訳文のみを返してください。
5353
1. 日本語における標準的なIT技術用語・プログラミング用語を使用して翻訳してください。
54-
2. 日本語の表現習慣を考慮して、語順を変更し、文の成分を補足して、文が日本語の文脈に合った流暢さを保つようにしてください。
54+
2. 日本語の表現習慣を考慮して、語順を変更し、文の成分を補足語して、文が日本語の文脈に合った流暢さを保つようにしてください。
5555
3. 文脈に応じて固有名詞や多義語の翻訳を決定してください。直接的な日本語の対応語がない単語は原文を保持し、可能な場合は注釈を提供してください。
5656
4. 流暢で読みやすく、元の情報が完全に保持されるように翻訳してください。
5757
5. コードブロック中の記述は翻訳しないでください。

0 commit comments

Comments
 (0)