From d9999d66e467479957910f8d3d4e3f9fd30eb9ed Mon Sep 17 00:00:00 2001 From: ultimatile Date: Fri, 5 Sep 2025 02:47:43 +0900 Subject: [PATCH 1/7] =?UTF-8?q?`/docs/reference/introspection/location`?= =?UTF-8?q?=E3=81=AE=E7=BF=BB=E8=A8=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/introspection/location.rs | 49 ++++++++----------- website/translation-status.json | 2 +- 2 files changed, 21 insertions(+), 30 deletions(-) diff --git a/crates/typst-library/src/introspection/location.rs b/crates/typst-library/src/introspection/location.rs index 8f4caaec4..6f24f1c0e 100644 --- a/crates/typst-library/src/introspection/location.rs +++ b/crates/typst-library/src/introspection/location.rs @@ -8,19 +8,17 @@ use crate::foundations::{func, scope, ty, Repr}; use crate::layout::Position; use crate::model::Numbering; -/// Identifies an element in the document. +/// 文書中の要素の識別。 /// -/// A location uniquely identifies an element in the document and lets you -/// access its absolute position on the pages. You can retrieve the current -/// location with the [`here`] function and the location of a queried or shown -/// element with the [`location()`]($content.location) method on content. +/// locationは文書中の要素を一意に識別し、ページ中での絶対位置へのアクセスを提供します。 +/// [`here`]関数を用いて現在位置を取得可能です。 +/// また、検索した位置や表示された要素の位置はコンテンツの[`location()`]($content.location)メソッドを用いて取得可能です。 /// -/// # Locatable elements { #locatable } -/// Currently, only a subset of element functions is locatable. Aside from -/// headings and figures, this includes equations, references, quotes and all -/// elements with an explicit label. As a result, you _can_ query for e.g. -/// [`strong`] elements, but you will find only those that have an explicit -/// label attached to them. This limitation will be resolved in the future. +/// # ロケータブル要素 { #locatable } +/// 現在、要素関数の一部のみがロケータブルです。 +/// 見出しと図表の他に、数式、参照、引用、全ての明示的なラベルを持つ要素が該当します。 +/// したがって、例えば[`strong`]要素に対してクエリが実行 _可能_ ですが、見つかるのは明示的にラベルが付けられたもののみです。 +/// この制限は将来的に解消される予定です。 #[ty(scope)] #[derive(Copy, Clone, Eq, PartialEq, Hash)] pub struct Location(u128); @@ -48,16 +46,13 @@ impl Location { #[scope] impl Location { - /// Returns the page number for this location. + /// このlocationのページ番号を返します。 /// - /// Note that this does not return the value of the [page counter]($counter) - /// at this location, but the true page number (starting from one). + /// このlocationの[ページカウンター]($counter)の値を返すわけではなく、(1始まりの)実際のページ番号を返すことに注意してください。 /// - /// If you want to know the value of the page counter, use - /// `{counter(page).at(loc)}` instead. + /// ページカウンターの値が知りたい場合は代わりに`{counter(page).at(loc)}`を使用してください。 /// - /// Can be used with [`here`] to retrieve the physical page position - /// of the current context: + /// [`here`]と組み合わせることで現在のコンテキストが配置される実際のページ番号が取得できます。 /// ```example /// #context [ /// I am located on @@ -69,24 +64,20 @@ impl Location { engine.introspector.page(self) } - /// Returns a dictionary with the page number and the x, y position for this - /// location. The page number starts at one and the coordinates are measured - /// from the top-left of the page. + /// このlocationのページ番号とx座標とy座標を辞書で返します。 + /// ページ番号は1始まりで、座標はページの左上から測ります。 /// - /// If you only need the page number, use `page()` instead as it allows - /// Typst to skip unnecessary work. + /// ページ番号にのみ興味がある場合は、代わりに`page()`を使用すると不必要な処理を省略できます。 #[func] pub fn position(self, engine: &mut Engine) -> Position { engine.introspector.position(self) } - /// Returns the page numbering pattern of the page at this location. This - /// can be used when displaying the page counter in order to obtain the - /// local numbering. This is useful if you are building custom indices or - /// outlines. + /// このlocationのページ番号の番号付けパターンを返します。 + /// これにより、ページカウンターの表示する際に、その位置での番号付けを取得できます。 + /// これは独自の索引やアウトラインを作成する場合に便利です。 /// - /// If the page numbering is set to `{none}` at that location, this function - /// returns `{none}`. + /// その位置でのページの番号付けが`{none}`に設定されていた場合、`{none}`を返します。 #[func] pub fn page_numbering(self, engine: &mut Engine) -> Option { engine.introspector.page_numbering(self).cloned() diff --git a/website/translation-status.json b/website/translation-status.json index b0d7b43f1..db6063225 100644 --- a/website/translation-status.json +++ b/website/translation-status.json @@ -147,7 +147,7 @@ "/docs/reference/introspection/counter/": "untranslated", "/docs/reference/introspection/here/": "untranslated", "/docs/reference/introspection/locate/": "untranslated", - "/docs/reference/introspection/location/": "untranslated", + "/docs/reference/introspection/location/": "translated", "/docs/reference/introspection/metadata/": "untranslated", "/docs/reference/introspection/query/": "untranslated", "/docs/reference/introspection/state/": "untranslated", From 846224d7af89c2cf4935fb1b4ac3068065e7d0c7 Mon Sep 17 00:00:00 2001 From: ultimatile Date: Mon, 22 Sep 2025 17:32:43 +0900 Subject: [PATCH 2/7] Update crates/typst-library/src/introspection/location.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- crates/typst-library/src/introspection/location.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/typst-library/src/introspection/location.rs b/crates/typst-library/src/introspection/location.rs index 6f24f1c0e..123ab55e5 100644 --- a/crates/typst-library/src/introspection/location.rs +++ b/crates/typst-library/src/introspection/location.rs @@ -12,7 +12,7 @@ use crate::model::Numbering; /// /// locationは文書中の要素を一意に識別し、ページ中での絶対位置へのアクセスを提供します。 /// [`here`]関数を用いて現在位置を取得可能です。 -/// また、検索した位置や表示された要素の位置はコンテンツの[`location()`]($content.location)メソッドを用いて取得可能です。 +/// また、検索した位置や表示された要素の位置は、コンテンツの[`location()`]($content.location)メソッドを使って取得できます。 /// /// # ロケータブル要素 { #locatable } /// 現在、要素関数の一部のみがロケータブルです。 From 26c73cc60f8e399520668fde49db291a0b23bdcb Mon Sep 17 00:00:00 2001 From: ultimatile Date: Mon, 22 Sep 2025 17:45:31 +0900 Subject: [PATCH 3/7] Update crates/typst-library/src/introspection/location.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- crates/typst-library/src/introspection/location.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/typst-library/src/introspection/location.rs b/crates/typst-library/src/introspection/location.rs index 123ab55e5..b8dc43c9a 100644 --- a/crates/typst-library/src/introspection/location.rs +++ b/crates/typst-library/src/introspection/location.rs @@ -67,7 +67,7 @@ impl Location { /// このlocationのページ番号とx座標とy座標を辞書で返します。 /// ページ番号は1始まりで、座標はページの左上から測ります。 /// - /// ページ番号にのみ興味がある場合は、代わりに`page()`を使用すると不必要な処理を省略できます。 + /// ページ番号のみに興味がある場合は、代わりに`page()`を使用すると不要な処理を省略できます。 #[func] pub fn position(self, engine: &mut Engine) -> Position { engine.introspector.position(self) From 25b1bbe8e14c0c05987e13026c23eda5d5b642a3 Mon Sep 17 00:00:00 2001 From: ultimatile Date: Mon, 22 Sep 2025 17:44:06 +0900 Subject: [PATCH 4/7] Update crates/typst-library/src/introspection/location.rs --- crates/typst-library/src/introspection/location.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/typst-library/src/introspection/location.rs b/crates/typst-library/src/introspection/location.rs index b8dc43c9a..e61febf95 100644 --- a/crates/typst-library/src/introspection/location.rs +++ b/crates/typst-library/src/introspection/location.rs @@ -52,7 +52,7 @@ impl Location { /// /// ページカウンターの値が知りたい場合は代わりに`{counter(page).at(loc)}`を使用してください。 /// - /// [`here`]と組み合わせることで現在のコンテキストが配置される実際のページ番号が取得できます。 + /// [`here`]と組み合わせることで現在のコンテキストにおける実際のページ番号が取得できます。 /// ```example /// #context [ /// I am located on From dc5c701ddee75ee869dffc3399b53109380b4bc8 Mon Sep 17 00:00:00 2001 From: Shunsuke Kimura Date: Sun, 5 Oct 2025 08:38:07 +0900 Subject: [PATCH 5/7] Add: glossary Signed-off-by: Shunsuke Kimura --- docs/glossary.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/glossary.md b/docs/glossary.md index 47ef874c6..50c890fc7 100644 --- a/docs/glossary.md +++ b/docs/glossary.md @@ -25,3 +25,5 @@ description: | | table | 表 | データや情報を整理して表示する要素 | | supplement | 補足語 | [参照]($ref)されるものの種類を指す文字列、「図1」の「図」など | | numbering | 番号付け | [見出し]($heading/#parameters-numbering)や[図表]($figure/#parameters-numbering)、[番号付きリスト]($enum/#parameters-numbering)などの番号の書式を定義する方法 | +| location | ロケーション | [ロケーション]($location)を参照 | +| locatable | ロケータブル | [ロケータブル要素]($location/#locatable)を参照 | From 86574bca41110002dc9597206654a65470007d9d Mon Sep 17 00:00:00 2001 From: ultimatile Date: Mon, 6 Oct 2025 04:09:15 +0900 Subject: [PATCH 6/7] Apply suggestion from @ultimatile --- crates/typst-library/src/introspection/location.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/typst-library/src/introspection/location.rs b/crates/typst-library/src/introspection/location.rs index e61febf95..b5a4aa6b1 100644 --- a/crates/typst-library/src/introspection/location.rs +++ b/crates/typst-library/src/introspection/location.rs @@ -48,7 +48,7 @@ impl Location { impl Location { /// このlocationのページ番号を返します。 /// - /// このlocationの[ページカウンター]($counter)の値を返すわけではなく、(1始まりの)実際のページ番号を返すことに注意してください。 + /// このlocationの[ページカウンター]($counter)の値を返すのではなく、(1始まりの)実際のページ番号を返すことに注意してください。 /// /// ページカウンターの値が知りたい場合は代わりに`{counter(page).at(loc)}`を使用してください。 /// From ce990e7666f88f02221378884c124d1463ff0bf4 Mon Sep 17 00:00:00 2001 From: ultimatile Date: Mon, 6 Oct 2025 04:12:07 +0900 Subject: [PATCH 7/7] Apply suggestion from @ultimatile --- crates/typst-library/src/introspection/location.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/typst-library/src/introspection/location.rs b/crates/typst-library/src/introspection/location.rs index b5a4aa6b1..ff268cb1c 100644 --- a/crates/typst-library/src/introspection/location.rs +++ b/crates/typst-library/src/introspection/location.rs @@ -16,7 +16,7 @@ use crate::model::Numbering; /// /// # ロケータブル要素 { #locatable } /// 現在、要素関数の一部のみがロケータブルです。 -/// 見出しと図表の他に、数式、参照、引用、全ての明示的なラベルを持つ要素が該当します。 +/// 見出しや図表の他に、数式、参照、引用、全ての明示的なラベルを持つ要素が該当します。 /// したがって、例えば[`strong`]要素に対してクエリが実行 _可能_ ですが、見つかるのは明示的にラベルが付けられたもののみです。 /// この制限は将来的に解消される予定です。 #[ty(scope)]