Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion Rules/Languages/de/SharedRules/general.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,23 @@
then: [x: "concat('\uF8FE', DefinitionValue($Word, 'Speech', 'PluralForms'))", ct: " "]
else: [x: "concat('\uF8FE', $Word)", ct: "s"]


# Currency symbols precede amounts in MathML but are spoken after them in German: $ 3 -> 3 dollar.
- name: currency
tag: mrow
match: "count(*)=3 and DefinitionValue(*[1], 'Speech', 'CurrencySymbols') != ''"
variables:
- IsSingular: "*[3][self::m:mn and .=1] and *[2]='\u2062'"
- CurrencyWord: "DefinitionValue(*[1], 'Speech', 'CurrencySymbols')"
replace:
- bookmark: "*[3]/@id"
- x: "*[3]"
- test:
- if: "$IsSingular"
then: [x: "$CurrencyWord"]
- else_if: "DefinitionValue($CurrencyWord, 'Speech', 'PluralForms') != ''"
then: [x: "DefinitionValue($CurrencyWord, 'Speech', 'PluralForms')"]
else: [x: "$CurrencyWord"]

- name: sin
tag: mi
match: ".='sin'"
Expand Down
17 changes: 17 additions & 0 deletions tests/Languages/de/units.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,23 @@ fn non_si_unit_plural_regression() -> Result<()> {
Ok(())
}

#[test]
fn currency_symbol_precedes_amount() -> Result<()> {
// German speaks a prefixed currency symbol after its amount.
let expr = r#"<math><mi>$</mi><mn>3</mn></math>"#;
test("de", "ClearSpeak", expr, "3 dollar")?;
test("de", "SimpleSpeak", expr, "3 dollar")?;

let expr = r#"<math><mi>€</mi><mn>1</mn></math>"#;
test("de", "ClearSpeak", expr, "1 euro")?;
test("de", "SimpleSpeak", expr, "1 euro")?;

let expr = r#"<math><mi>£</mi><mn>4,7</mn></math>"#;
test("de", "ClearSpeak", expr, "4,7 pfund")?;
test("de", "SimpleSpeak", expr, "4,7 pfund")?;
Ok(())
}

/*
#[test]
fn si_base_with_prefixes() -> Result<()> {
Expand Down
Loading