Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions crates/typst-library/src/introspection/locate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ use crate::engine::Engine;
use crate::foundations::{func, Context, LocatableSelector};
use crate::introspection::Location;

/// Determines the location of an element in the document.
/// 文書中の要素の位置を特定。
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// 文書中の要素の位置を特定
/// 文書中の要素のロケーションを特定

///
/// Takes a selector that must match exactly one element and returns that
/// element's [`location`]. This location can, in particular, be used to
/// retrieve the physical [`page`]($location.page) number and
/// [`position`]($location.position) (page, x, y) for that element.
/// 厳密に1つだけの要素にマッチしなければならないセレクターを受け取り、要素の[`location`]を返します。
/// このlocationを用いると、特に、物理的な[`page`]($location.page)番号やその要素の[`position`]($location.position)(ページ番号、x座標、y座標)を取得できます。
///
/// # Examples
/// Locating a specific element:
/// #
/// 特定の要素の位置を特定します。
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// 特定の要素の位置を特定します
/// 特定の要素のロケーションを特定します

/// ```example
/// #context [
/// Introduction is at: \
Expand All @@ -26,13 +24,12 @@ use crate::introspection::Location;
pub fn locate(
engine: &mut Engine,
context: Tracked<Context>,
/// A selector that should match exactly one element. This element will be
/// located.
/// 厳密に1つだけの要素にマッチしなければならないセレクター。
/// その要素の位置が決定されます。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここは引数ではなく戻り値を指していると思いました。

Suggested change
/// その要素の位置が決定されます
/// その要素のロケーションが決定されます

///
/// Especially useful in combination with
/// - [`here`] to locate the current context,
/// - a [`location`] retrieved from some queried element via the
/// [`location()`]($content.location) method on content.
/// 以下との組み合わせが特に便利です。
/// - [`here`]と組み合わせた現在のコンテキストでの位置の特定
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hereはロケーションであったと思います。

Suggested change
/// - [`here`]と組み合わせた現在のコンテキストでの位置の特定
/// - [`here`]と組み合わせた現在のコンテキストでのロケーションの特定

/// - 何らかのクエリで得られた要素からコンテンツの[`location()`]($content.location)メソッドを用いて取得した[`location`]
selector: LocatableSelector,
) -> HintedStrResult<Location> {
selector.resolve_unique(engine.introspector, context)
Expand Down
2 changes: 1 addition & 1 deletion website/translation-status.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
"/docs/reference/introspection/": "untranslated",
"/docs/reference/introspection/counter/": "untranslated",
"/docs/reference/introspection/here/": "untranslated",
"/docs/reference/introspection/locate/": "untranslated",
"/docs/reference/introspection/locate/": "translated",
"/docs/reference/introspection/location/": "untranslated",
"/docs/reference/introspection/metadata/": "untranslated",
"/docs/reference/introspection/query/": "untranslated",
Expand Down