From 33a035ee0d9f12bc858e9a0cd37942eda1693798 Mon Sep 17 00:00:00 2001 From: "Kevin K." Date: Mon, 28 Oct 2024 15:42:25 +0100 Subject: [PATCH] Fix wrong Greek and Ukrainian language codes (#5261) Co-authored-by: Laurenz --- crates/typst-library/src/text/lang.rs | 8 ++++---- crates/typst-library/src/text/smartquote.rs | 4 ++-- .../typst-library/translations/{gr.txt => el.txt} | 0 .../typst-library/translations/{ua.txt => uk.txt} | 0 ...calization-gr.png => figure-localization-el.png} | Bin tests/ref/{smartquote-gr.png => smartquote-el.png} | Bin tests/suite/model/figure.typ | 4 ++-- tests/suite/text/smartquote.typ | 4 ++-- 8 files changed, 10 insertions(+), 10 deletions(-) rename crates/typst-library/translations/{gr.txt => el.txt} (100%) rename crates/typst-library/translations/{ua.txt => uk.txt} (100%) rename tests/ref/{figure-localization-gr.png => figure-localization-el.png} (100%) rename tests/ref/{smartquote-gr.png => smartquote-el.png} (100%) diff --git a/crates/typst-library/src/text/lang.rs b/crates/typst-library/src/text/lang.rs index 64ab1a7cb..d63dddb70 100644 --- a/crates/typst-library/src/text/lang.rs +++ b/crates/typst-library/src/text/lang.rs @@ -26,7 +26,7 @@ const TRANSLATIONS: [(&str, &str); 36] = [ translation!("fi"), translation!("fr"), translation!("gl"), - translation!("gr"), + translation!("el"), translation!("he"), translation!("hu"), translation!("is"), @@ -47,7 +47,7 @@ const TRANSLATIONS: [(&str, &str); 36] = [ translation!("sv"), translation!("tl"), translation!("tr"), - translation!("ua"), + translation!("uk"), translation!("vi"), translation!("zh-TW"), translation!("zh"), @@ -74,7 +74,7 @@ impl Lang { pub const FRENCH: Self = Self(*b"fr ", 2); pub const GALICIAN: Self = Self(*b"gl ", 2); pub const GERMAN: Self = Self(*b"de ", 2); - pub const GREEK: Self = Self(*b"gr ", 2); + pub const GREEK: Self = Self(*b"el ", 2); pub const HEBREW: Self = Self(*b"he ", 2); pub const HUNGARIAN: Self = Self(*b"hu ", 2); pub const ICELANDIC: Self = Self(*b"is ", 2); @@ -93,7 +93,7 @@ impl Lang { pub const SPANISH: Self = Self(*b"es ", 2); pub const SWEDISH: Self = Self(*b"sv ", 2); pub const TURKISH: Self = Self(*b"tr ", 2); - pub const UKRAINIAN: Self = Self(*b"ua ", 2); + pub const UKRAINIAN: Self = Self(*b"uk ", 2); pub const VIETNAMESE: Self = Self(*b"vi ", 2); /// Return the language code as an all lowercase string slice. diff --git a/crates/typst-library/src/text/smartquote.rs b/crates/typst-library/src/text/smartquote.rs index 5917550d6..925e86d65 100644 --- a/crates/typst-library/src/text/smartquote.rs +++ b/crates/typst-library/src/text/smartquote.rs @@ -247,8 +247,8 @@ impl<'s> SmartQuotes<'s> { "es" if matches!(region, Some("ES") | None) => ("“", "”", "«", "»"), "hu" | "pl" | "ro" => ("’", "’", "„", "”"), "no" | "nb" | "nn" if alternative => low_high, - "ru" | "no" | "nb" | "nn" | "ua" => ("’", "’", "«", "»"), - "gr" => ("‘", "’", "«", "»"), + "ru" | "no" | "nb" | "nn" | "uk" => ("’", "’", "«", "»"), + "el" => ("‘", "’", "«", "»"), "he" => ("’", "’", "”", "”"), _ if lang.dir() == Dir::RTL => ("’", "‘", "”", "“"), _ => default, diff --git a/crates/typst-library/translations/gr.txt b/crates/typst-library/translations/el.txt similarity index 100% rename from crates/typst-library/translations/gr.txt rename to crates/typst-library/translations/el.txt diff --git a/crates/typst-library/translations/ua.txt b/crates/typst-library/translations/uk.txt similarity index 100% rename from crates/typst-library/translations/ua.txt rename to crates/typst-library/translations/uk.txt diff --git a/tests/ref/figure-localization-gr.png b/tests/ref/figure-localization-el.png similarity index 100% rename from tests/ref/figure-localization-gr.png rename to tests/ref/figure-localization-el.png diff --git a/tests/ref/smartquote-gr.png b/tests/ref/smartquote-el.png similarity index 100% rename from tests/ref/smartquote-gr.png rename to tests/ref/smartquote-el.png diff --git a/tests/suite/model/figure.typ b/tests/suite/model/figure.typ index 19e811165..58ba2b2a4 100644 --- a/tests/suite/model/figure.typ +++ b/tests/suite/model/figure.typ @@ -244,9 +244,9 @@ We can clearly see that @fig-cylinder and caption: [Пятиугольник], ) ---- figure-localization-gr --- +--- figure-localization-el --- // Test Greek -#set text(lang: "gr") +#set text(lang: "el") #figure( circle(), caption: [Ένας κύκλος.], diff --git a/tests/suite/text/smartquote.typ b/tests/suite/text/smartquote.typ index fe398b7ad..4940d11b2 100644 --- a/tests/suite/text/smartquote.typ +++ b/tests/suite/text/smartquote.typ @@ -30,8 +30,8 @@ #set text(lang: "fi") "Hevonen ei syö kurkkusalaattia" oli ensimmäinen koskaan 'puhelimessa' lausuttu lause. ---- smartquote-gr --- -#set text(lang: "gr") +--- smartquote-el --- +#set text(lang: "el") "Το άλογο δεν τρώει αγγουροσαλάτα" ήταν η πρώτη πρόταση που ειπώθηκε στο 'τηλέφωνο'. --- smartquote-he ---