Skip to content

Commit 896869a

Browse files
ultimatileCopilot3w36zj6
authored
/docs/reference/layout/lengthの翻訳 (#216)
Co-authored-by: Copilot <[email protected]> Co-authored-by: 3w36zj6 <[email protected]>
1 parent 25d71a9 commit 896869a

File tree

2 files changed

+26
-29
lines changed

2 files changed

+26
-29
lines changed

crates/typst-library/src/layout/length.rs

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ use crate::diag::{bail, HintedStrResult, SourceResult};
1111
use crate::foundations::{func, scope, ty, Context, Fold, Repr, Resolve, StyleChain};
1212
use crate::layout::{Abs, Em};
1313

14-
/// A size or distance, possibly expressed with contextual units.
14+
/// 文脈に応じた単位で表現される場合もある、大きさまたは距離。
1515
///
16-
/// Typst supports the following length units:
16+
/// Typstは以下の長さの単位をサポートしています。
1717
///
18-
/// - Points: `{72pt}`
19-
/// - Millimeters: `{254mm}`
20-
/// - Centimeters: `{2.54cm}`
21-
/// - Inches: `{1in}`
22-
/// - Relative to font size: `{2.5em}`
18+
/// - ポイント: `{72pt}`
19+
/// - ミリメートル: `{254mm}`
20+
/// - センチメートル: `{2.54cm}`
21+
/// - インチ: `{1in}`
22+
/// - 相対フォントサイズ: `{2.5em}`
2323
///
24-
/// You can multiply lengths with and divide them by integers and floats.
24+
/// 長さは整数や浮動小数点数で乗除算できます。
2525
///
26-
/// # Example
26+
/// #
2727
/// ```example
2828
/// #rect(width: 20pt)
2929
/// #rect(width: 2em)
@@ -35,10 +35,9 @@ use crate::layout::{Abs, Em};
3535
/// #(5em).abs
3636
/// ```
3737
///
38-
/// # Fields
39-
/// - `abs`: A length with just the absolute component of the current length
40-
/// (that is, excluding the `em` component).
41-
/// - `em`: The amount of `em` units in this length, as a [float].
38+
/// # フィールド
39+
/// - `abs`: 現在の長さの単なる数値部分(すなわち`em`部分を除いたもの)。
40+
/// - `em`: [float]としての、このlengthでの`em`単位の大きさ。
4241
#[ty(scope, cast)]
4342
#[derive(Default, Copy, Clone, Eq, PartialEq, Hash)]
4443
pub struct Length {
@@ -95,49 +94,47 @@ impl Length {
9594

9695
#[scope]
9796
impl Length {
98-
/// Converts this length to points.
97+
/// このlengthをポイントに変換します。
9998
///
100-
/// Fails with an error if this length has non-zero `em` units (such as
101-
/// `5em + 2pt` instead of just `2pt`). Use the `abs` field (such as in
102-
/// `(5em + 2pt).abs.pt()`) to ignore the `em` component of the length (thus
103-
/// converting only its absolute component).
99+
/// このlengthの`em`単位の値が(単に`2pt`ではなく`5em + 2pt`のように)非ゼロの場合にエラーが発生して失敗します。
100+
/// 長さの`em`成分を無視するために(`(5em + 2pt).abs.pt()`のように)`abs`フィールドを使用してください(したがって数値部分のみが変換されます)。
104101
#[func(name = "pt", title = "Points")]
105102
pub fn to_pt(&self, span: Span) -> SourceResult<f64> {
106103
self.ensure_that_em_is_zero(span, "pt")?;
107104
Ok(self.abs.to_pt())
108105
}
109106

110-
/// Converts this length to millimeters.
107+
/// このlengthをミリメートルに変換します。
111108
///
112-
/// Fails with an error if this length has non-zero `em` units. See the
113-
/// [`pt`]($length.pt) method for more details.
109+
/// このlengthの`em`単位の値が非ゼロの場合にエラーが発生して失敗します。
110+
/// 詳細は[`pt`]($length.pt)メソッドを参照して下さい。
114111
#[func(name = "mm", title = "Millimeters")]
115112
pub fn to_mm(&self, span: Span) -> SourceResult<f64> {
116113
self.ensure_that_em_is_zero(span, "mm")?;
117114
Ok(self.abs.to_mm())
118115
}
119116

120-
/// Converts this length to centimeters.
117+
/// このlengthをセンチメートルに変換します。
121118
///
122-
/// Fails with an error if this length has non-zero `em` units. See the
123-
/// [`pt`]($length.pt) method for more details.
119+
/// このlengthの`em`単位の値が非ゼロの場合にエラーが発生して失敗します。
120+
/// 詳細は[`pt`]($length.pt)メソッドを参照して下さい。
124121
#[func(name = "cm", title = "Centimeters")]
125122
pub fn to_cm(&self, span: Span) -> SourceResult<f64> {
126123
self.ensure_that_em_is_zero(span, "cm")?;
127124
Ok(self.abs.to_cm())
128125
}
129126

130-
/// Converts this length to inches.
127+
/// このlengthをインチに変換します。
131128
///
132-
/// Fails with an error if this length has non-zero `em` units. See the
133-
/// [`pt`]($length.pt) method for more details.
129+
/// このlengthの`em`単位の値が非ゼロの場合にエラーが発生して失敗します。
130+
/// 詳細は[`pt`]($length.pt)メソッドを参照して下さい。
134131
#[func(name = "inches")]
135132
pub fn to_inches(&self, span: Span) -> SourceResult<f64> {
136133
self.ensure_that_em_is_zero(span, "inches")?;
137134
Ok(self.abs.to_inches())
138135
}
139136

140-
/// Resolve this length to an absolute length.
137+
/// このlengthを絶対的な長さに変換します。
141138
///
142139
/// ```example
143140
/// #set text(size: 12pt)

website/translation-status.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
"/docs/reference/layout/grid/": "untranslated",
114114
"/docs/reference/layout/hide/": "translated",
115115
"/docs/reference/layout/layout/": "translated",
116-
"/docs/reference/layout/length/": "untranslated",
116+
"/docs/reference/layout/length/": "translated",
117117
"/docs/reference/layout/measure/": "untranslated",
118118
"/docs/reference/layout/move/": "untranslated",
119119
"/docs/reference/layout/pad/": "translated",

0 commit comments

Comments
 (0)