diff --git a/crates/typst/src/text/lang.rs b/crates/typst/src/text/lang.rs index 39115a34f..041a3bdbb 100644 --- a/crates/typst/src/text/lang.rs +++ b/crates/typst/src/text/lang.rs @@ -14,7 +14,7 @@ macro_rules! translation { }; } -const TRANSLATIONS: [(&str, &str); 33] = [ +const TRANSLATIONS: [(&str, &str); 34] = [ translation!("ar"), translation!("ca"), translation!("cs"), @@ -30,6 +30,7 @@ const TRANSLATIONS: [(&str, &str); 33] = [ translation!("hu"), translation!("it"), translation!("ja"), + translation!("la"), translation!("nb"), translation!("nl"), translation!("nn"), @@ -75,6 +76,7 @@ impl Lang { pub const HUNGARIAN: Self = Self(*b"hu ", 2); pub const ITALIAN: Self = Self(*b"it ", 2); pub const JAPANESE: Self = Self(*b"ja ", 2); + pub const LATIN: Self = Self(*b"la ", 2); pub const LOWER_SORBIAN: Self = Self(*b"dsb", 3); pub const NYNORSK: Self = Self(*b"nn ", 2); pub const POLISH: Self = Self(*b"pl ", 2); diff --git a/crates/typst/src/text/smartquote.rs b/crates/typst/src/text/smartquote.rs index 797f0804b..64fecb768 100644 --- a/crates/typst/src/text/smartquote.rs +++ b/crates/typst/src/text/smartquote.rs @@ -196,7 +196,7 @@ impl<'s> SmartQuotes<'s> { /// region as an all-uppercase ISO 3166-alpha2 code. /// /// Currently, the supported languages are: English, Czech, Danish, German, - /// Swiss / Liechtensteinian German, Estonian, Icelandic, Lithuanian, + /// Swiss / Liechtensteinian German, Estonian, Icelandic, Italian, Latin, Lithuanian, /// Latvian, Slovak, Slovenian, Spanish, Bosnian, Finnish, Swedish, French, /// Hungarian, Polish, Romanian, Japanese, Traditional Chinese, Russian, and /// Norwegian. @@ -225,6 +225,9 @@ impl<'s> SmartQuotes<'s> { "fr" => ("‹\u{00A0}", "\u{00A0}›", "«\u{00A0}", "\u{00A0}»"), "fi" | "sv" if alternative => ("’", "’", "»", "»"), "bs" | "fi" | "sv" => ("’", "’", "”", "”"), + "it" if alternative => default, + "la" if alternative => ("“", "”", "«\u{202F}", "\u{202F}»"), + "it" | "la" => ("“", "”", "«", "»"), "es" if matches!(region, Some("ES") | None) => ("“", "”", "«", "»"), "hu" | "pl" | "ro" => ("’", "’", "„", "”"), "no" | "nb" | "nn" if alternative => low_high, diff --git a/crates/typst/translations/la.txt b/crates/typst/translations/la.txt new file mode 100644 index 000000000..3ec63fffc --- /dev/null +++ b/crates/typst/translations/la.txt @@ -0,0 +1,7 @@ +figure = Descriptio +table = Tabula +equation = Equatio +bibliography = Conspectus librorum +heading = Caput +outline = Index capitum +raw = Exemplum diff --git a/tests/ref/smartquote.png b/tests/ref/smartquote.png index 070e04876..e297c6a0b 100644 Binary files a/tests/ref/smartquote.png and b/tests/ref/smartquote.png differ diff --git a/tests/suite/text/smartquote.typ b/tests/suite/text/smartquote.typ index 02ac4455e..4c27be074 100644 --- a/tests/suite/text/smartquote.typ +++ b/tests/suite/text/smartquote.typ @@ -36,6 +36,14 @@ #set text(lang: "ru") "Лошадь не ест салат из огурцов" - это была первая фраза, сказанная по 'телефону'. +#set text(lang: "it") +"Il cavallo non mangia insalata di cetrioli" è stata la prima frase pronunciata al 'telefono'. + +#set text(lang: "la") +#set smartquote(alternative: true) +"Equus cucumeris sem non edit" prima sententia in 'telephono' prolata fuit. +#set smartquote(alternative: false) + --- smartquote-empty --- // Test single pair of quotes. ""