Skip to content

Commit 2b86b82

Browse files
feat: outlineの見出しを日本語に翻訳 (#91)
Signed-off-by: Shunsuke Kimura <[email protected]> Co-authored-by: Shunsuke Kimura <[email protected]>
1 parent 247dca5 commit 2b86b82

File tree

6 files changed

+35
-15
lines changed

6 files changed

+35
-15
lines changed

crates/typst/src/model/figure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use crate::visualize::ImageElem;
2727
/// 自動的にその種類を検出し、それぞれに応じて番号付けします。
2828
/// 例えば、画像を含む図表は表を含む図表とは別々に番号が付けられます。
2929
///
30-
/// # Examples
30+
/// #
3131
/// 以下の例は、画像を含む基本的な図表を示しています。
3232
/// ```example
3333
/// @glacier shows a glacier. Glaciers

crates/typst/src/visualize/image/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ use crate::World;
3939
/// ほとんどの要素と同様に、画像はデフォルトでは _ブロックレベル_ であるため、隣接する段落に統合されることはありません。
4040
/// 画像を強制的にインラインにするには、[`box`]の中に入れてください。
4141
///
42-
/// # Example
42+
/// #
4343
/// ```example
4444
/// #figure(
4545
/// image("molecular.jpg", width: 80%),

docs/src/lib.rs

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,17 @@ fn category_page(resolver: &dyn Resolver, category: Category) -> PageModel {
325325
_ => &title_name,
326326
};
327327
let details = Html::markdown(resolver, category.docs(), Some(1));
328-
let mut outline = vec![OutlineItem::from_name("Summary")];
328+
let mut outline = vec![OutlineItem {
329+
id: "summary".into(),
330+
name: "概要".into(),
331+
children: vec![],
332+
}];
329333
outline.extend(details.outline());
330-
outline.push(OutlineItem::from_name("Definitions"));
334+
outline.push(OutlineItem {
335+
id: "definitions".into(),
336+
name: "定義".into(),
337+
children: vec![],
338+
});
331339
if shorthands.is_some() {
332340
outline.push(OutlineItem::from_name("Shorthands"));
333341
}
@@ -500,13 +508,17 @@ fn func_outline(model: &FuncModel, id_base: &str) -> Vec<OutlineItem> {
500508
let mut outline = vec![];
501509

502510
if id_base.is_empty() {
503-
outline.push(OutlineItem::from_name("Summary"));
511+
outline.push(OutlineItem {
512+
id: "summary".into(),
513+
name: "概要".into(),
514+
children: vec![],
515+
});
504516
outline.extend(model.details.outline());
505517

506518
if !model.params.is_empty() {
507519
outline.push(OutlineItem {
508520
id: "parameters".into(),
509-
name: "Parameters".into(),
521+
name: "引数".into(),
510522
children: model
511523
.params
512524
.iter()
@@ -539,7 +551,7 @@ fn scope_outline(scope: &[FuncModel]) -> Option<OutlineItem> {
539551

540552
Some(OutlineItem {
541553
id: "definitions".into(),
542-
name: "Definitions".into(),
554+
name: "定義".into(),
543555
children: scope
544556
.iter()
545557
.map(|func| {
@@ -558,7 +570,11 @@ fn group_page(
558570
group: &GroupData,
559571
) -> (PageModel, CategoryItem) {
560572
let mut functions = vec![];
561-
let mut outline = vec![OutlineItem::from_name("Summary")];
573+
let mut outline = vec![OutlineItem {
574+
id: "summary".into(),
575+
name: "概要".into(),
576+
children: vec![],
577+
}];
562578

563579
let path: Vec<_> = group.path.iter().map(|s| s.as_str()).collect();
564580
let details = Html::markdown(resolver, &group.details, Some(1));
@@ -642,13 +658,17 @@ fn type_model(resolver: &dyn Resolver, ty: &Type) -> TypeModel {
642658

643659
/// Produce an outline for a type page.
644660
fn type_outline(model: &TypeModel) -> Vec<OutlineItem> {
645-
let mut outline = vec![OutlineItem::from_name("Summary")];
661+
let mut outline = vec![OutlineItem {
662+
id: "summary".into(),
663+
name: "概要".into(),
664+
children: vec![],
665+
}];
646666
outline.extend(model.details.outline());
647667

648668
if let Some(func) = &model.constructor {
649669
outline.push(OutlineItem {
650670
id: "constructor".into(),
651-
name: "Constructor".into(),
671+
name: "コンストラクタ".into(),
652672
children: func_outline(func, "constructor"),
653673
});
654674
}

templates/category_template.html.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<h1 id="summary">{{ body['content']['name'] }}</h1>
55
{{ body['content']['details'] | safe }}
6-
<h2 id="definitions">Definitions</h2>
6+
<h2 id="definitions">定義</h2>
77
<ul class="subgridded">
88
{% for item in body['content']['items'] %}
99
{% if item['code'] %}

templates/func_template.html.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
macros.tooltip_display('Element', 'Element functions can be customized with <code>set</code> and <code>show</code> rules.') }}{% endif %}</small></h1>
88
{{ body['content']['details'] | safe }}
99
<h2 id="parameters">
10-
{{ macros.tooltip_display('Parameters', 'Parameters are the inputs to a function. They are specified in parentheses after the function name.', prefix='parameters') }}
10+
{{ macros.tooltip_display('引数', 'Parameters are the inputs to a function. They are specified in parentheses after the function name.', prefix='parameters') }}
1111
</h2>
1212
{{ macros.function_definition_display(body['content'], type2class, gen_path, prefix=body['content']['name']) }}
1313
{% if body['content']['example'] %}
@@ -18,7 +18,7 @@
1818

1919
{% if body['content']['scope'].__len__() > 0 %}
2020
<h2 id="definitions">
21-
{{ macros.tooltip_display('Definitions', 'Functions and types and can have associated definitions. These are accessed by specifying the function or type, followed by a period, and then the definition\'s name.', prefix='definitions') }}
21+
{{ macros.tooltip_display('定義', 'Functions and types and can have associated definitions. These are accessed by specifying the function or type, followed by a period, and then the definition\'s name.', prefix='definitions') }}
2222
</h2>
2323
{% endif %}
2424
{% for method in body['content']['scope'] %}

templates/type_template.html.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88

99
{% if body['content']['constructor'] %}
1010
<h2 id="constructor">
11-
{{ macros.tooltip_display('Constructor', 'If a type has a constructor, you can call it like a function to create a new value of the type.', prefix='constructor') }}
11+
{{ macros.tooltip_display('コンストラクタ', 'If a type has a constructor, you can call it like a function to create a new value of the type.', prefix='constructor') }}
1212
</h2>
1313
{{ macros.function_display(body['content']['constructor'], type2class, gen_path, prefix='constructor', is_example_folding=false) }}
1414
{% endif %}
1515

1616

1717
{% if body['content']['scope'].__len__() > 0 %}
1818
<h2 id="definitions">
19-
{{ macros.tooltip_display('Definitions', 'Functions and types and can have associated definitions. These are accessed by specifying the function or type, followed by a period, and then the definition\'s name.', prefix='definitions') }}
19+
{{ macros.tooltip_display('定義', 'Functions and types and can have associated definitions. These are accessed by specifying the function or type, followed by a period, and then the definition\'s name.', prefix='definitions') }}
2020
</h2>
2121
{% endif %}
2222
{% for method in body['content']['scope'] %}

0 commit comments

Comments
 (0)