diff --git a/crates/typst-library/src/meta/figure.rs b/crates/typst-library/src/meta/figure.rs index bfcc9b449..362f869eb 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) -> &'static str { + fn local_separator(lang: Lang, _: Option) -> &'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 7f0b82891..b877c4721 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 000000000..9f7f4c89f Binary files /dev/null and b/tests/ref/meta/figure-localization.png differ diff --git a/tests/ref/meta/figure.png b/tests/ref/meta/figure.png index 1bc3b0dcf..83bd7b7ff 100644 Binary files a/tests/ref/meta/figure.png and b/tests/ref/meta/figure.png differ diff --git a/tests/typ/meta/figure-localization.typ b/tests/typ/meta/figure-localization.typ new file mode 100644 index 000000000..da0fb28a0 --- /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 36e2da471..7d618d062 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é.], -)