Skip to content
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.
/// 文書中の要素のロケーションを特定。
///
/// 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:
/// #
/// 特定の要素のロケーションを特定します。
/// ```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つだけの要素にマッチしなければならないセレクター。
/// その要素のロケーションが決定されます。
///
/// 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`]と組み合わせた現在のコンテキストでのロケーションの特定
/// - 何らかのクエリで得られた要素からコンテンツの[`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/": "translated",
"/docs/reference/introspection/counter/": "translated",
"/docs/reference/introspection/here/": "translated",
"/docs/reference/introspection/locate/": "untranslated",
"/docs/reference/introspection/locate/": "translated",
"/docs/reference/introspection/location/": "untranslated",
"/docs/reference/introspection/metadata/": "translated",
"/docs/reference/introspection/query/": "untranslated",
Expand Down