@@ -6,25 +6,25 @@ use crate::engine::Engine;
66use crate :: foundations:: { func, scope, Str , Value } ;
77use crate :: loading:: { DataSource , Load , Readable } ;
88
9- /// Reads structured data from a JSON file.
9+ /// JSONファイルから構造化データを読み込む。
1010///
11- /// The file must contain a valid JSON value, such as object or array. JSON
12- /// objects will be converted into Typst dictionaries, and JSON arrays will be
13- /// converted into Typst arrays. Strings and booleans will be converted into the
14- /// Typst equivalents, `null` will be converted into `{none}`, and numbers will
15- /// be converted to floats or integers depending on whether they are whole
16- /// numbers.
11+ /// 読み込むファイルにはオブジェクトや配列などの有効なJSON値が含まれていなければなりません。
12+ /// JSONオブジェクトはTypstの辞書に変換され、
13+ /// JSON配列はTypstの配列に変換されます。
14+ /// 文字列やブール値はTypstの対応する値に変換され、 `null`は `{none}`に、
15+ /// 数値は整数値であれば整数型に、
16+ /// そうでなければ浮動小数点数型に変換されます。
1717///
18- /// Be aware that integers larger than 2<sup>63</sup>-1 will be converted to
19- /// floating point numbers, which may result in an approximative value.
18+ /// 2<sup>63</sup>-1より大きな整数は浮動小数点数に変換されるため、
19+ /// 近似値になる可能性があることに留意してください。
2020///
21- /// The function returns a dictionary, an array or, depending on the JSON file,
22- /// another JSON data type.
21+ /// この関数は、辞書、配列、
22+ /// あるいはJSONファイルの内容に応じてその他のJSONデータ型を返します。
2323///
24- /// The JSON files in the example contain objects with the keys `temperature`,
25- /// `unit`, and `weather`.
24+ /// この例におけるJSONファイルは、
25+ /// `temperature`、` unit`、および `weather`というキーを持つオブジェクトを含んでいます。
2626///
27- /// # Example
27+ /// # 例
2828/// ```example
2929/// #let forecast(day) = block[
3030/// #box(square(
@@ -51,7 +51,7 @@ use crate::loading::{DataSource, Load, Readable};
5151#[ func( scope, title = "JSON" ) ]
5252pub fn json (
5353 engine : & mut Engine ,
54- /// A [path ]($syntax/#paths) to a JSON file or raw JSON bytes.
54+ /// JSONファイルへの[パス ]($syntax/#paths)、または生のJSONバイト列。
5555 source : Spanned < DataSource > ,
5656) -> SourceResult < Value > {
5757 let data = source. load ( engine. world ) ?;
@@ -62,23 +62,23 @@ pub fn json(
6262
6363#[ scope]
6464impl json {
65- /// Reads structured data from a JSON string/bytes.
65+ /// JSONの文字列やバイト列から構造化データを読み込む。
6666 #[ func( title = "Decode JSON" ) ]
67- #[ deprecated = "`json.decode` is deprecated, directly pass bytes to `json` instead " ]
67+ #[ deprecated = "`json.decode`は非推奨です。代わりにバイト列を直接 `json`に渡してください。 " ]
6868 pub fn decode (
6969 engine : & mut Engine ,
70- /// JSON data.
70+ /// JSONデータ。
7171 data : Spanned < Readable > ,
7272 ) -> SourceResult < Value > {
7373 json ( engine, data. map ( Readable :: into_source) )
7474 }
7575
76- /// Encodes structured data into a JSON string.
76+ /// 構造化データをJSON文字列にエンコードする。
7777 #[ func( title = "Encode JSON" ) ]
7878 pub fn encode (
79- /// Value to be encoded.
79+ /// エンコード対象の値。
8080 value : Spanned < Value > ,
81- /// Whether to pretty print the JSON with newlines and indentation.
81+ /// JSONを改行およびインデント付きで整形表示するかどうか。
8282 #[ named]
8383 #[ default( true ) ]
8484 pretty : bool ,
0 commit comments