Skip to content

Commit 9bbc555

Browse files
authored
Merge branch 'main' into translate-introspection/location
2 parents 7cba585 + 15c0224 commit 9bbc555

File tree

3 files changed

+23
-31
lines changed

3 files changed

+23
-31
lines changed

crates/typst-library/src/introspection/here.rs

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,27 @@ use crate::diag::HintedStrResult;
44
use crate::foundations::{func, Context};
55
use crate::introspection::Location;
66

7-
/// Provides the current location in the document.
7+
/// 文書中における現在のロケーションを提供。
88
///
9-
/// You can think of `here` as a low-level building block that directly extracts
10-
/// the current location from the active [context]. Some other functions use it
11-
/// internally: For instance, `{counter.get()}` is equivalent to
12-
/// `{counter.at(here())}`.
9+
/// `here`はアクティブな[コンテキスト]($context)から現在のロケーションを直接取得する低レベルな構成要素と考えることができます。
10+
/// いくつかの他の関数が内部で使用しています。
11+
/// 例えば、`{counter.get()}`は`{counter.at(here())}`と等価です。
1312
///
14-
/// Within show rules on [locatable]($location/#locatable) elements, `{here()}`
15-
/// will match the location of the shown element.
13+
/// [ロケータブル]($location/#locatable)要素に対するshowルールにおいて、`{here()}`は表示する要素のロケーションにマッチします。
1614
///
17-
/// If you want to display the current page number, refer to the documentation
18-
/// of the [`counter`] type. While `here` can be used to determine the physical
19-
/// page number, typically you want the logical page number that may, for
20-
/// instance, have been reset after a preface.
15+
/// 現在のページ番号を表示したい場合は、[`counter`]型のドキュメントを参照してください。
16+
/// `here`は物理的なページ番号を決定できますが、通常は、前書きの後にリセットされるような、論理的なページ番号が必要でしょう。
2117
///
22-
/// # Examples
23-
/// Determining the current position in the document in combination with the
24-
/// [`position`]($location.position) method:
18+
/// # 例
19+
/// [`position`]($location.position)メソッドと組み合わせて文書中での現在位置を決定します。
2520
/// ```example
2621
/// #context [
2722
/// I am located at
2823
/// #here().position()
2924
/// ]
3025
/// ```
3126
///
32-
/// Running a [query] for elements before the current position:
27+
/// 現在位置より前にある要素に対して[クエリ]($query)を実行します。
3328
/// ```example
3429
/// = Introduction
3530
/// = Background
@@ -42,7 +37,7 @@ use crate::introspection::Location;
4237
///
4338
/// = Conclusion
4439
/// ```
45-
/// Refer to the [`selector`] type for more details on before/after selectors.
40+
/// セレクターのbeforeおよびafterに関する詳細は[`selector`]型のドキュメントを参照してください。
4641
#[func(contextual)]
4742
pub fn here(context: Tracked<Context>) -> HintedStrResult<Location> {
4843
context.location()

crates/typst-library/src/introspection/locate.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@ use crate::engine::Engine;
55
use crate::foundations::{func, Context, LocatableSelector};
66
use crate::introspection::Location;
77

8-
/// Determines the location of an element in the document.
8+
/// 文書中の要素のロケーションを特定。
99
///
10-
/// Takes a selector that must match exactly one element and returns that
11-
/// element's [`location`]. This location can, in particular, be used to
12-
/// retrieve the physical [`page`]($location.page) number and
13-
/// [`position`]($location.position) (page, x, y) for that element.
10+
/// 厳密に1つだけの要素にマッチしなければならないセレクターを受け取り、要素の[`location`]を返します。
11+
/// このlocationを用いると、特に、物理的な[`page`]($location.page)番号やその要素の[`position`]($location.position)(ページ番号、x座標、y座標)を取得できます。
1412
///
15-
/// # Examples
16-
/// Locating a specific element:
13+
/// #
14+
/// 特定の要素のロケーションを特定します。
1715
/// ```example
1816
/// #context [
1917
/// Introduction is at: \
@@ -26,13 +24,12 @@ use crate::introspection::Location;
2624
pub fn locate(
2725
engine: &mut Engine,
2826
context: Tracked<Context>,
29-
/// A selector that should match exactly one element. This element will be
30-
/// located.
27+
/// 厳密に1つだけの要素にマッチしなければならないセレクター。
28+
/// その要素のロケーションが決定されます。
3129
///
32-
/// Especially useful in combination with
33-
/// - [`here`] to locate the current context,
34-
/// - a [`location`] retrieved from some queried element via the
35-
/// [`location()`]($content.location) method on content.
30+
/// 以下との組み合わせが特に便利です。
31+
/// - [`here`]と組み合わせた現在のコンテキストでのロケーションの特定
32+
/// - 何らかのクエリで得られた要素からコンテンツの[`location()`]($content.location)メソッドを用いて取得した[`location`]
3633
selector: LocatableSelector,
3734
) -> HintedStrResult<Location> {
3835
selector.resolve_unique(engine.introspector, context)

website/translation-status.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@
145145
"/docs/reference/visualize/tiling/": "untranslated",
146146
"/docs/reference/introspection/": "translated",
147147
"/docs/reference/introspection/counter/": "translated",
148-
"/docs/reference/introspection/here/": "untranslated",
149-
"/docs/reference/introspection/locate/": "untranslated",
148+
"/docs/reference/introspection/here/": "translated",
149+
"/docs/reference/introspection/locate/": "translated",
150150
"/docs/reference/introspection/location/": "translated",
151151
"/docs/reference/introspection/metadata/": "translated",
152152
"/docs/reference/introspection/query/": "untranslated",

0 commit comments

Comments
 (0)