summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Fleischer <danflscr@gmail.com>2024-09-02 15:56:19 +0300
committerGitHub <noreply@github.com>2024-09-02 12:56:19 +0000
commita2628ac9702b085f3981c7306cee366717b0b77c (patch)
treebd2eef146089cf6fbfc01f58a95ac9d68d7c65e3
parent95740ac2ab350a194949251febe758914072d803 (diff)
Hebrew Translation + Smart Quotes (#4842)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
-rw-r--r--crates/typst/src/text/lang.rs4
-rw-r--r--crates/typst/src/text/smartquote.rs3
-rw-r--r--crates/typst/translations/he.txt7
-rw-r--r--tests/ref/issue-4476-rtl-title-ending-in-ltr-text.pngbin6312 -> 6358 bytes
-rw-r--r--tests/ref/smartquote.pngbin23873 -> 23870 bytes
-rw-r--r--tests/suite/text/smartquote.typ2
6 files changed, 13 insertions, 3 deletions
diff --git a/crates/typst/src/text/lang.rs b/crates/typst/src/text/lang.rs
index e439533d..6c9c886a 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); 35] = [
+const TRANSLATIONS: [(&str, &str); 36] = [
translation!("ar"),
translation!("ca"),
translation!("cs"),
@@ -27,6 +27,7 @@ const TRANSLATIONS: [(&str, &str); 35] = [
translation!("fr"),
translation!("gl"),
translation!("gr"),
+ translation!("he"),
translation!("hu"),
translation!("is"),
translation!("it"),
@@ -74,6 +75,7 @@ impl Lang {
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 HEBREW: Self = Self(*b"he ", 2);
pub const HUNGARIAN: Self = Self(*b"hu ", 2);
pub const ICELANDIC: Self = Self(*b"is ", 2);
pub const ITALIAN: Self = Self(*b"it ", 2);
diff --git a/crates/typst/src/text/smartquote.rs b/crates/typst/src/text/smartquote.rs
index 02c93fd6..0bcccf41 100644
--- a/crates/typst/src/text/smartquote.rs
+++ b/crates/typst/src/text/smartquote.rs
@@ -208,7 +208,7 @@ impl<'s> SmartQuotes<'s> {
/// 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.
+ /// Chinese, Russian, Norwegian, and Hebrew.
///
/// For unknown languages, the English quotes are used as fallback.
pub fn get(
@@ -242,6 +242,7 @@ impl<'s> SmartQuotes<'s> {
"no" | "nb" | "nn" if alternative => low_high,
"ru" | "no" | "nb" | "nn" | "ua" => ("’", "’", "«", "»"),
"gr" => ("‘", "’", "«", "»"),
+ "he" => ("’", "’", "”", "”"),
_ if lang.dir() == Dir::RTL => ("’", "‘", "”", "“"),
_ => default,
};
diff --git a/crates/typst/translations/he.txt b/crates/typst/translations/he.txt
new file mode 100644
index 00000000..7c3705a4
--- /dev/null
+++ b/crates/typst/translations/he.txt
@@ -0,0 +1,7 @@
+figure = איור
+table = טבלה
+equation = משוואה
+bibliography = רשימת מקורות
+heading = חלק
+outline = תוכן עניינים
+raw = קטע מקור
diff --git a/tests/ref/issue-4476-rtl-title-ending-in-ltr-text.png b/tests/ref/issue-4476-rtl-title-ending-in-ltr-text.png
index 09506966..f3fda12e 100644
--- a/tests/ref/issue-4476-rtl-title-ending-in-ltr-text.png
+++ b/tests/ref/issue-4476-rtl-title-ending-in-ltr-text.png
Binary files differ
diff --git a/tests/ref/smartquote.png b/tests/ref/smartquote.png
index e297c6a0..4adf3185 100644
--- a/tests/ref/smartquote.png
+++ b/tests/ref/smartquote.png
Binary files differ
diff --git a/tests/suite/text/smartquote.typ b/tests/suite/text/smartquote.typ
index a69ad25c..04a82036 100644
--- a/tests/suite/text/smartquote.typ
+++ b/tests/suite/text/smartquote.typ
@@ -28,7 +28,7 @@
"Το άλογο δεν τρώει αγγουροσαλάτα" ήταν η πρώτη πρόταση που ειπώθηκε στο 'τηλέφωνο'.
#set text(lang: "he")
-"הסוס לא אוכל סלט מלפפונים" היה המשפט ההראשון שנאמר ב 'טלפון'.
+"הסוס לא אוכל סלט מלפפונים" היה המשפט ההראשון שנאמר ב'טלפון'.
#set text(lang: "ro")
"Calul nu mănâncă salată de castraveți" a fost prima propoziție rostită vreodată la 'telefon'.