diff --git a/crates/typst-library/src/text/raw.rs b/crates/typst-library/src/text/raw.rs index 1ce8bfc611..245f3c759d 100644 --- a/crates/typst-library/src/text/raw.rs +++ b/crates/typst-library/src/text/raw.rs @@ -25,12 +25,12 @@ use crate::text::{FontFamily, FontList, LinebreakElem, LocalName, TextElem, Text use crate::visualize::Color; use crate::World; -/// Raw text with optional syntax highlighting. +/// オプションでシンタックスハイライトを持つ生テキスト。 /// -/// Displays the text verbatim and in a monospace font. This is typically used -/// to embed computer code into your document. +/// テキストをそのまま等幅フォントで表示します。 +/// これは通常、計算機のコードをドキュメント内に埋め込むために使います。 /// -/// # Example +/// # 例 /// ````example /// Adding `rbx` to `rcx` gives /// the desired result. @@ -50,28 +50,23 @@ use crate::World; /// also trimmed. /// ```` /// -/// You can also construct a [`raw`] element programmatically from a string (and -/// provide the language tag via the optional [`lang`]($raw.lang) argument). +/// また、プログラミング的に文字列から[`raw`]要素を作成できます(オプションの[`lang`]($raw.lang)引数を用いて言語タグを提供できます)。 /// ```example /// #raw("fn " + "main() {}", lang: "rust") /// ``` /// -/// # Syntax -/// This function also has dedicated syntax. You can enclose text in 1 or 3+ -/// backticks (`` ` ``) to make it raw. Two backticks produce empty raw text. -/// This works both in markup and code. +/// # 構文 +/// この関数には専用の構文もあります。 +/// テキストを1つまたは3つ以上のバッククォート(`` ` ``)で囲むと生テキストにできます。 +/// 2つのバッククォートは空の生テキストを作成します。 +/// これはマークアップ中でもコード中でも動作します。 /// -/// When you use three or more backticks, you can additionally specify a -/// language tag for syntax highlighting directly after the opening backticks. -/// Within raw blocks, everything (except for the language tag, if applicable) -/// is rendered as is, in particular, there are no escape sequences. +/// 3つ以上のバッククォートを使用する場合、シンタックスハイライトのために開きバッククォートの直後に言語タグを追加で指定することができます。 +/// rawブロック内部では、(もし言語タグが利用可能なら、それ以外の)全てがそのままレンダリングされます。特に、エスケープシーケンスはありません。 /// -/// The language tag is an identifier that directly follows the opening -/// backticks only if there are three or more backticks. If your text starts -/// with something that looks like an identifier, but no syntax highlighting is -/// needed, start the text with a single space (which will be trimmed) or use -/// the single backtick syntax. If your text should start or end with a -/// backtick, put a space before or after it (it will be trimmed). +/// 言語タグは、3つ以上のバッククォートがある場合にのみ使用できる、開きバッククォートの直後に付ける識別子です。 +/// 識別子のようなものからテキストが始まるものの、シンタックスハイライトが不要な場合、単一の空白(トリムされます)からテキストを始めるか、単一のバッククォート構文を使用してください。 +/// バッククォートでテキストが始まるか終わるかしなければならない場合は、その前か後に空白を置いてください(トリムされます)。 #[elem( scope, title = "Raw Text / Code", @@ -83,10 +78,9 @@ use crate::World; PlainText )] pub struct RawElem { - /// The raw text. + /// 生テキスト。 /// - /// You can also use raw blocks creatively to create custom syntaxes for - /// your automations. + /// 自動化のために、rawブロックを使ってカスタム構文をクリエイティブに作成することもできます。 /// /// ````example /// // Parse numbers in raw blocks with the @@ -106,11 +100,10 @@ pub struct RawElem { #[required] pub text: RawContent, - /// Whether the raw text is displayed as a separate block. + /// 生テキストを独立したブロックとして表示するかどうか。 /// - /// In markup mode, using one-backtick notation makes this `{false}`. - /// Using three-backtick notation makes it `{true}` if the enclosed content - /// contains at least one line break. + /// マークアップモードでは、バッククォート1つを使うとこれは`{false}`になります。 + /// バッククォート3つ使うと、囲まれたコンテンツが1つ以上の改行を含む場合は`{true}`になります。 /// /// ````example /// // Display inline code in a small box @@ -141,13 +134,9 @@ pub struct RawElem { #[default(false)] pub block: bool, - /// The language to syntax-highlight in. + /// シンタックスハイライトを行う言語。 /// - /// Apart from typical language tags known from Markdown, this supports the - /// `{"typ"}`, `{"typc"}`, and `{"typm"}` tags for - /// [Typst markup]($reference/syntax/#markup), - /// [Typst code]($reference/syntax/#code), and - /// [Typst math]($reference/syntax/#math), respectively. + /// Markdownで用いられている一般的な言語以外では、[Typst markup]($reference/syntax/#markup)の`{"typ"}`、[Typst code]($reference/syntax/#code)の`{"typc"}`、[Typst math]($reference/syntax/#math)の`{"typm"}`のタグがそれぞれサポートされています。 /// /// ````example /// ```typ @@ -159,15 +148,10 @@ pub struct RawElem { #[borrowed] pub lang: Option, - /// The horizontal alignment that each line in a raw block should have. - /// This option is ignored if this is not a raw block (if specified - /// `block: false` or single backticks were used in markup mode). + /// rawブロック中の各行が持つべき水平方向の配置。 + /// このオプションはrawブロックではない(`block: false`が指定されるか、マークアップモードで1つのバッククォートが使用された)場合は無視されます。 /// - /// By default, this is set to `{start}`, meaning that raw text is - /// aligned towards the start of the text direction inside the block - /// by default, regardless of the current context's alignment (allowing - /// you to center the raw block itself without centering the text inside - /// it, for example). + /// これはデフォルトでは`{start}`で、現在のコンテキストの配置によらず、生テキストがブロック内部の書き始めの位置揃えになることを意味します(例えば、内部テキストを中央揃えにせずにrawブロックを中央揃えにできます)。 /// /// ````example /// #set raw(align: center) @@ -180,15 +164,15 @@ pub struct RawElem { #[default(HAlignment::Start)] pub align: HAlignment, - /// Additional syntax definitions to load. The syntax definitions should be - /// in the [`sublime-syntax` file format](https://www.sublimetext.com/docs/syntax.html). + /// 追加で読み込む構文定義。 + /// 構文定義は[`sublime-syntax`ファイル形式](https://www.sublimetext.com/docs/syntax.html)でなければなりません。 /// - /// You can pass any of the following values: + /// 以下の値のいずれかを渡すことができます。 /// - /// - A path string to load a syntax file from the given path. For more - /// details about paths, see the [Paths section]($syntax/#paths). - /// - Raw bytes from which the syntax should be decoded. - /// - An array where each item is one the above. + /// - 与えられたパスから構文ファイルを読み込みためのパス文字列。 + /// パスに関する詳細は[パスのセクション]($syntax/#paths)を参照してください。 + /// - 構文をデコードするための生バイト列。 + /// - 各アイテムが上記のいずれかである配列。 /// /// ````example /// #set raw(syntaxes: "SExpressions.sublime-syntax") @@ -208,23 +192,20 @@ pub struct RawElem { #[fold] pub syntaxes: Derived, Vec>, - /// The theme to use for syntax highlighting. Themes should be in the - /// [`tmTheme` file format](https://www.sublimetext.com/docs/color_schemes_tmtheme.html). + /// シンタックスハイライトに用いるテーマ。 + /// テーマは[`tmTheme`ファイル形式](https://www.sublimetext.com/docs/color_schemes_tmtheme.html)でなければなりません。 /// - /// You can pass any of the following values: + /// 以下の値のいずれかを渡すことができます。 /// - /// - `{none}`: Disables syntax highlighting. - /// - `{auto}`: Highlights with Typst's default theme. - /// - A path string to load a theme file from the given path. For more - /// details about paths, see the [Paths section]($syntax/#paths). - /// - Raw bytes from which the theme should be decoded. + /// - `{none}`: シンタックスハイライトを無効化します。 + /// - `{auto}`: Typstのデフォルトテーマでハイライトします。 + /// - 与えられたパスからテーマファイルを読み込みためのパス文字列。 + /// パスに関する詳細は[パスのセクション]($syntax/#paths)を参照してください。 + /// - テーマをデコードするための生バイト列。 /// - /// Applying a theme only affects the color of specifically highlighted - /// text. It does not consider the theme's foreground and background - /// properties, so that you retain control over the color of raw text. You - /// can apply the foreground color yourself with the [`text`] function and - /// the background with a [filled block]($block.fill). You could also use - /// the [`xml`] function to extract these properties from the theme. + /// テーマの適用はハイライトされたテキストの色にのみ影響を与えます。テーマの前景および背景プロパティは無視され、生テキストの色の制御は残ります。 + /// [`text`]関数を用いて前景色を、[ブロックの塗り潰し]($block.fill)を用いて背景色を、それぞれ手動で設定できます。 + /// [`xml`]関数でもこれらのプロパティをテーマから抽出できます。 /// /// ````example /// #set raw(theme: "halcyon.tmTheme") @@ -251,8 +232,8 @@ pub struct RawElem { #[borrowed] pub theme: Smart>>, - /// The size for a tab stop in spaces. A tab is replaced with enough spaces to - /// align with the next multiple of the size. + /// スペースで測ったタブ幅。 + /// タブは、次のタブ幅の整数倍位置までのスペースで置き換えられます。 /// /// ````example /// #set raw(tab-size: 8) @@ -612,28 +593,26 @@ impl RawTheme { } } -/// A highlighted line of raw text. +/// ハイライトされた生テキストの行。 /// -/// This is a helper element that is synthesized by [`raw`] elements. +/// これは[`raw`]要素によって合成される補助要素です。 /// -/// It allows you to access various properties of the line, such as the line -/// number, the raw non-highlighted text, the highlighted text, and whether it -/// is the first or last line of the raw block. +/// 行番号、ハイライトされていない生テキスト、ハイライトされたテキスト、rawブロックの最初の行や最後の行であるかどうかなどの、行のさまざまなプロパティにアクセスすることができます。 #[elem(name = "line", title = "Raw Text / Code Line", Show, PlainText)] pub struct RawLine { - /// The line number of the raw line inside of the raw block, starts at 1. + /// 1始まりのrawブロック内の行番号。 #[required] pub number: i64, - /// The total number of lines in the raw block. + /// rawブロック内にある総行数。 #[required] pub count: i64, - /// The line of raw text. + /// 生テキストの行。 #[required] pub text: EcoString, - /// The highlighted raw text. + /// ハイライトされた生テキスト。 #[required] pub body: Content, } diff --git a/website/translation-status.json b/website/translation-status.json index de21f97a7f..d04ba6047d 100644 --- a/website/translation-status.json +++ b/website/translation-status.json @@ -68,7 +68,7 @@ "/docs/reference/text/lorem/": "translated", "/docs/reference/text/lower/": "untranslated", "/docs/reference/text/overline/": "translated", - "/docs/reference/text/raw/": "untranslated", + "/docs/reference/text/raw/": "translated", "/docs/reference/text/smallcaps/": "translated", "/docs/reference/text/smartquote/": "untranslated", "/docs/reference/text/strike/": "translated",