@@ -24,49 +24,31 @@ use crate::layout::{AlignElem, Alignment, Axes, Length, MoveElem, PadElem, Rel,
2424use crate :: model:: { Destination , EmphElem , LinkElem , StrongElem } ;
2525use crate :: text:: UnderlineElem ;
2626
27- /// A piece of document content.
27+ /// 文書のコンテンツ。
2828///
29- /// This type is at the heart of Typst. All markup you write and most
30- /// [functions]($function) you call produce content values. You can create a
31- /// content value by enclosing markup in square brackets. This is also how you
32- /// pass content to functions.
29+ /// この型は、Typstの中心となるものです。Typstのすべてのマークアップやほとんどの[関数]($function)はコンテンツを生成します。コンテンツ値は角括弧でマークアップを囲むことで作成できます。これは、コンテンツを関数に渡す際にも使われる方法です。
3330///
34- /// # Example
31+ /// # 例
3532/// ```example
3633/// Type of *Hello!* is
3734/// #type([*Hello!*])
3835/// ```
3936///
40- /// Content can be added with the `+` operator,
41- /// [joined together]($scripting/#blocks) and multiplied with integers. Wherever
42- /// content is expected, you can also pass a [string]($str) or `{none}`.
37+ /// コンテンツは`+`演算子で追加したり、[結合]($scripting/#blocks)したり、整数と乗算したりすることができます。コンテンツが期待される場所であれば、[文字列]($str)や`{none}`を渡すことも可能です。
38+ ///
39+ /// # 表現
40+ /// コンテンツはフィールドを持つ要素で構成されます。 _要素関数_ で要素を構築する際は、フィールドを引数として提供します。コンテンツ値がある場合は、[フィールドアクセス構文]($scripting/#field-access)でそのフィールドにアクセスできます。
4341///
44- /// # Representation
45- /// Content consists of elements with fields. When constructing an element with
46- /// its _element function,_ you provide these fields as arguments and when you
47- /// have a content value, you can access its fields with [field access
48- /// syntax]($scripting/#field-access).
42+ /// フィールドの中には必須のものがあります。それらは要素を構築する際に提供する必要があるため、その型のコンテンツでは常にフィールドアクセスを通じて利用可能です。
43+ /// 必須フィールドはドキュメント内でそのようにマークされています。
4944///
50- /// Some fields are required: These must be provided when constructing an
51- /// element and as a consequence, they are always available through field access
52- /// on content of that type. Required fields are marked as such in the
53- /// documentation.
45+ /// ほとんどのフィールドはオプションで、必須フィールドと同様に、単一要素を設定するために要素関数に渡すことができます。しかし、[setルール]($styling/#set-rules)で設定して、スコープ内のすべての要素に適用することも可能です。
46+ /// オプションのフィールドは、要素関数に明示的に渡された場合にのみフィールドアクセス構文で利用でき、setルールから適用された場合は利用できません。
5447///
55- /// Most fields are optional: Like required fields, they can be passed to the
56- /// element function to configure them for a single element. However, these can
57- /// also be configured with [set rules]($styling/#set-rules) to apply them to
58- /// all elements within a scope. Optional fields are only available with field
59- /// access syntax when they were explicitly passed to the element function, not
60- /// when they result from a set rule.
48+ /// 各要素にはデフォルトの外観があります。しかし、[showルール]($styling/#show-rules)を使用して、その外観を完全にカスタマイズすることもできます。showルールには要素が渡されます。showルールは要素のフィールドにアクセスし、そこから任意のコンテンツを生成することができます。
6149///
62- /// Each element has a default appearance. However, you can also completely
63- /// customize its appearance with a [show rule]($styling/#show-rules). The show
64- /// rule is passed the element. It can access the element's field and produce
65- /// arbitrary content from it.
66- ///
67- /// In the web app, you can hover over a content variable to see exactly which
68- /// elements the content is composed of and what fields they have.
69- /// Alternatively, you can inspect the output of the [`repr`] function.
50+ /// ウェブアプリでは、コンテンツ変数にマウスカーソルを合わせると、そのコンテンツが正確にどの要素で構成されているか、そしてどのようなフィールドを持っているかを確認できます。
51+ /// または、[`repr`]関数の出力を調べることでも確認できます。
7052#[ ty( scope, cast) ]
7153#[ derive( Clone , Hash ) ]
7254#[ allow( clippy:: derived_hash_with_manual_eq) ]
@@ -532,21 +514,20 @@ impl Content {
532514
533515#[ scope]
534516impl Content {
535- /// The content's element function. This function can be used to create the element
536- /// contained in this content. It can be used in set and show rules for the
537- /// element. Can be compared with global functions to check whether you have
538- /// a specific
539- /// kind of element.
517+ /// コンテンツの要素関数。
518+ /// この関数を用いると、当該コンテンツに含まれる要素を生成できます。
519+ /// この関数は、その要素に対するsetルールやshowルール内でも使用できます。
520+ /// グローバル関数と比較することで、特定の種類の要素を持っているかを確認できます。
540521 #[ func]
541522 pub fn func ( & self ) -> Element {
542523 self . elem ( )
543524 }
544525
545- /// Whether the content has the specified field.
526+ /// コンテンツが特定のフィールドを持つかどうか。
546527 #[ func]
547528 pub fn has (
548529 & self ,
549- /// The field to look for.
530+ /// 調べるフィールド。
550531 field : Str ,
551532 ) -> bool {
552533 if field. as_str ( ) == "label" {
@@ -560,15 +541,13 @@ impl Content {
560541 self . inner . elem . has ( id)
561542 }
562543
563- /// Access the specified field on the content. Returns the default value if
564- /// the field does not exist or fails with an error if no default value was
565- /// specified.
544+ /// コンテンツ内の指定されたフィールドにアクセスします。そのフィールドが存在しない場合はデフォルト値が返されますが、デフォルト値が指定されていない場合はエラーになります。
566545 #[ func]
567546 pub fn at (
568547 & self ,
569- /// The field to access.
548+ /// アクセスするフィールド。
570549 field : Str ,
571- /// A default value to return if the field does not exist.
550+ /// フィールドが存在しない場合のデフォルト値。
572551 #[ named]
573552 default : Option < Value > ,
574553 ) -> StrResult < Value > {
@@ -577,7 +556,7 @@ impl Content {
577556 . map_err ( |e| e. message_no_default ( self , & field) )
578557 }
579558
580- /// Returns the fields of this content.
559+ /// このcontentのフィールドを返します。
581560 ///
582561 /// ```example
583562 /// #rect(
@@ -594,10 +573,7 @@ impl Content {
594573 dict
595574 }
596575
597- /// The location of the content. This is only available on content returned
598- /// by [query] or provided by a [show rule]($reference/styling/#show-rules),
599- /// for other content it will be `{none}`. The resulting location can be
600- /// used with [counters]($counter), [state] and [queries]($query).
576+ /// コンテンツの位置。これは、[クエリ]($query)によって返されたコンテンツ、または[showルール]($reference/styling/#show-rules)によって提供されたコンテンツに対してのみ利用できます。それ以外のコンテンツでは、`{none}`になります。取得された位置情報は、[カウンター]($counter)、[状態]($state)、[クエリ]($query)と一緒に使用できます。
601577 #[ func]
602578 pub fn location ( & self ) -> Option < Location > {
603579 self . inner . location
0 commit comments