diff --git a/crates/typst-library/src/loading/json.rs b/crates/typst-library/src/loading/json.rs index aa908cca4c..c774e35345 100644 --- a/crates/typst-library/src/loading/json.rs +++ b/crates/typst-library/src/loading/json.rs @@ -6,25 +6,25 @@ use crate::engine::Engine; use crate::foundations::{func, scope, Str, Value}; use crate::loading::{DataSource, Load, Readable}; -/// Reads structured data from a JSON file. +/// JSONファイルから構造化データを読み込む。 /// -/// The file must contain a valid JSON value, such as object or array. JSON -/// objects will be converted into Typst dictionaries, and JSON arrays will be -/// converted into Typst arrays. Strings and booleans will be converted into the -/// Typst equivalents, `null` will be converted into `{none}`, and numbers will -/// be converted to floats or integers depending on whether they are whole -/// numbers. +/// 読み込むファイルにはオブジェクトや配列などの有効なJSON値が含まれていなければなりません。 +/// JSONオブジェクトはTypstの辞書に変換され、 +/// JSON配列はTypstの配列に変換されます。 +/// 文字列やブール値はTypstの対応する値に変換され、`null`は`{none}`に、 +/// 数値は整数値であれば整数型に、 +/// そうでなければ浮動小数点数型に変換されます。 /// -/// Be aware that integers larger than 263-1 will be converted to -/// floating point numbers, which may result in an approximative value. +/// 263-1より大きな整数は浮動小数点数に変換されるため、 +/// 近似値になる可能性があることに留意してください。 /// -/// The function returns a dictionary, an array or, depending on the JSON file, -/// another JSON data type. +/// この関数は、辞書、配列、 +/// あるいはJSONファイルの内容に応じてその他のJSONデータ型を返します。 /// -/// The JSON files in the example contain objects with the keys `temperature`, -/// `unit`, and `weather`. +/// この例におけるJSONファイルは、 +/// `temperature`、`unit`、および`weather`というキーを持つオブジェクトを含んでいます。 /// -/// # Example +/// # 例 /// ```example /// #let forecast(day) = block[ /// #box(square( @@ -51,7 +51,7 @@ use crate::loading::{DataSource, Load, Readable}; #[func(scope, title = "JSON")] pub fn json( engine: &mut Engine, - /// A [path]($syntax/#paths) to a JSON file or raw JSON bytes. + /// JSONファイルへの[パス]($syntax/#paths)、または生のJSONバイト列。 source: Spanned, ) -> SourceResult { let data = source.load(engine.world)?; @@ -62,23 +62,23 @@ pub fn json( #[scope] impl json { - /// Reads structured data from a JSON string/bytes. + /// JSONの文字列やバイト列から構造化データを読み込む。 #[func(title = "Decode JSON")] - #[deprecated = "`json.decode` is deprecated, directly pass bytes to `json` instead"] + #[deprecated = "`json.decode`は非推奨です。代わりにバイト列を直接`json`に渡してください。"] pub fn decode( engine: &mut Engine, - /// JSON data. + /// JSONデータ。 data: Spanned, ) -> SourceResult { json(engine, data.map(Readable::into_source)) } - /// Encodes structured data into a JSON string. + /// 構造化データをJSON文字列にエンコードする。 #[func(title = "Encode JSON")] pub fn encode( - /// Value to be encoded. + /// エンコード対象の値。 value: Spanned, - /// Whether to pretty print the JSON with newlines and indentation. + /// JSONを改行およびインデント付きで整形表示するかどうか。 #[named] #[default(true)] pretty: bool, diff --git a/website/translation-status.json b/website/translation-status.json index 0b8dfaa634..ac9c02ed05 100644 --- a/website/translation-status.json +++ b/website/translation-status.json @@ -154,7 +154,7 @@ "/docs/reference/data-loading/": "untranslated", "/docs/reference/data-loading/cbor/": "untranslated", "/docs/reference/data-loading/csv/": "translated", - "/docs/reference/data-loading/json/": "untranslated", + "/docs/reference/data-loading/json/": "translated", "/docs/reference/data-loading/read/": "untranslated", "/docs/reference/data-loading/toml/": "untranslated", "/docs/reference/data-loading/xml/": "untranslated",