summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/typst-library/src/meta/figure.rs17
-rw-r--r--crates/typst-library/src/visualize/image.rs2
-rw-r--r--tests/ref/meta/figure-localization.pngbin0 -> 2724 bytes
-rw-r--r--tests/ref/meta/figure.pngbin190166 -> 54197 bytes
-rw-r--r--tests/typ/meta/figure-localization.typ17
-rw-r--r--tests/typ/meta/figure.typ22
6 files changed, 22 insertions, 36 deletions
diff --git a/crates/typst-library/src/meta/figure.rs b/crates/typst-library/src/meta/figure.rs
index bfcc9b44..362f869e 100644
--- a/crates/typst-library/src/meta/figure.rs
+++ b/crates/typst-library/src/meta/figure.rs
@@ -1,6 +1,5 @@
use std::borrow::Cow;
use std::str::FromStr;
-use typst::util::option_eq;
use super::{Count, Counter, CounterKey, CounterUpdate, Numbering, NumberingPattern};
use crate::layout::{BlockElem, PlaceElem, VElem};
@@ -499,20 +498,12 @@ pub struct FigureCaption {
impl FigureCaption {
/// Gets the default separator in the given language and (optionally)
/// region.
- fn local_separator(lang: Lang, region: Option<Region>) -> &'static str {
+ fn local_separator(lang: Lang, _: Option<Region>) -> &'static str {
match lang {
- Lang::CHINESE => ":",
- Lang::FRENCH if option_eq(region, "CH") => "\u{202f}: ",
- Lang::FRENCH => "\u{a0}: ",
+ Lang::CHINESE => "\u{2003}",
+ Lang::FRENCH => ".\u{a0}– ",
Lang::RUSSIAN => ". ",
- Lang::DANISH
- | Lang::DUTCH
- | Lang::ENGLISH
- | Lang::GERMAN
- | Lang::ITALIAN
- | Lang::SPANISH
- | Lang::SWEDISH
- | _ => ": ",
+ Lang::ENGLISH | _ => ": ",
}
}
diff --git a/crates/typst-library/src/visualize/image.rs b/crates/typst-library/src/visualize/image.rs
index 7f0b8289..b877c472 100644
--- a/crates/typst-library/src/visualize/image.rs
+++ b/crates/typst-library/src/visualize/image.rs
@@ -234,7 +234,7 @@ impl LocalName for ImageElem {
Lang::DUTCH => "Figuur",
Lang::FILIPINO => "Pigura",
Lang::FINNISH => "Kuva",
- Lang::FRENCH => "Figure",
+ Lang::FRENCH => "Fig.",
Lang::GERMAN => "Abbildung",
Lang::HUNGARIAN => "Ábra",
Lang::ITALIAN => "Figura",
diff --git a/tests/ref/meta/figure-localization.png b/tests/ref/meta/figure-localization.png
new file mode 100644
index 00000000..9f7f4c89
--- /dev/null
+++ b/tests/ref/meta/figure-localization.png
Binary files differ
diff --git a/tests/ref/meta/figure.png b/tests/ref/meta/figure.png
index 1bc3b0dc..83bd7b7f 100644
--- a/tests/ref/meta/figure.png
+++ b/tests/ref/meta/figure.png
Binary files differ
diff --git a/tests/typ/meta/figure-localization.typ b/tests/typ/meta/figure-localization.typ
new file mode 100644
index 00000000..da0fb28a
--- /dev/null
+++ b/tests/typ/meta/figure-localization.typ
@@ -0,0 +1,17 @@
+// Test localization-related figure features.
+
+---
+// Test French
+#set text(lang: "fr")
+#figure(
+ circle(),
+ caption: [Un cercle.],
+)
+
+---
+// Test Chinese
+#set text(lang: "zh")
+#figure(
+ rect(),
+ caption: [一个矩形],
+)
diff --git a/tests/typ/meta/figure.typ b/tests/typ/meta/figure.typ
index 36e2da47..7d618d06 100644
--- a/tests/typ/meta/figure.typ
+++ b/tests/typ/meta/figure.typ
@@ -109,25 +109,3 @@ We can clearly see that @fig-cylinder and
table(columns: 2)[a][b],
caption: [The table with custom separator.],
)
-
----
-// Test localized default separator
-#set text(lang: "fr", region: "CH")
-
-#figure(
- circle(),
- caption: [Un cercle.],
-)
-#set text(lang: "es")
-
-#figure(
- polygon.regular(size: 1cm, vertices: 3),
- caption: [Un triángulo.],
-)
-
-#set text(lang: "fr", region: "CA")
-
-#figure(
- square(),
- caption: [Un carré.],
-)