mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-14 15:57:49 +00:00
i18n(gu): singular for zero, and install Gujarati craft-fonts faces
Gujarati takes the singular form for 0 and 1, as Hindi does, so gu now uses plural_french. add_craft_fonts installs Gujr faces into the UI families the way it installs Deva faces, so a bundled Gujarati face is used and bundled_fonts_cover_the_catalogs holds when one is added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
138800cb85
commit
234956c52c
@@ -116,7 +116,7 @@ pub static LANGUAGES: [LangInfo; 29] = [
|
||||
code: "gu",
|
||||
name: "ગુજરાતી",
|
||||
source: include_str!("i18n/gu.tsv"),
|
||||
plural: plural_one_other,
|
||||
plural: plural_french,
|
||||
complete_menus: true,
|
||||
catalog: OnceLock::new(),
|
||||
},
|
||||
|
||||
@@ -4,13 +4,13 @@ use super::*;
|
||||
const ZH: fn() -> Lang = || Lang::from_code("zh-hant").expect("zh-hant registered");
|
||||
|
||||
#[test]
|
||||
fn gujarati_resolves_locales_and_uses_one_other_plurals() {
|
||||
fn gujarati_resolves_locales_and_takes_the_singular_for_zero_and_one() {
|
||||
let gu = Lang::from_code("gu").expect("gu registered");
|
||||
for tag in ["gu", "gu-IN", "gu_IN.UTF-8", "GU-in", "gu-Gujr-IN"] {
|
||||
assert_eq!(lang_from_tag(tag), Some(gu), "{tag}");
|
||||
}
|
||||
assert_eq!(gu.name(), "ગુજરાતી");
|
||||
assert_eq!([0, 1, 2, 21].map(gu.0.plural), [1, 0, 1, 1]);
|
||||
assert_eq!([0, 1, 2, 21].map(gu.0.plural), [0, 0, 1, 1]);
|
||||
assert_eq!(tr(gu, "Save"), "સાચવો");
|
||||
}
|
||||
|
||||
|
||||
@@ -571,7 +571,10 @@ pub(crate) fn craft_font_name(f: &vectorcraft_text::CraftFont) -> String {
|
||||
fn add_craft_fonts(fonts: &mut FontDefinitions) {
|
||||
// The name of each face's copy in each family.
|
||||
let mut copies: std::collections::HashMap<(FontFamily, String), String> = std::collections::HashMap::new();
|
||||
for f in vectorcraft_text::CRAFT_FONTS.iter().filter(|f| f.is_japanese() || f.is_georgian() || f.scripts.contains(&"Deva")) {
|
||||
for f in vectorcraft_text::CRAFT_FONTS
|
||||
.iter()
|
||||
.filter(|f| f.is_japanese() || f.is_georgian() || f.scripts.contains(&"Deva") || f.scripts.contains(&"Gujr"))
|
||||
{
|
||||
let name = craft_font_name(f);
|
||||
for (copy, data, families) in crate::ui_fonts::baseline_copies(fonts, &name, &FontData::from_static(f.bytes)) {
|
||||
for family in families {
|
||||
@@ -589,6 +592,7 @@ fn add_craft_fonts(fonts: &mut FontDefinitions) {
|
||||
stack.extend(vectorcraft_text::craft_fonts::japanese_ui_fonts(bold).into_iter().map(copy));
|
||||
stack.extend(vectorcraft_text::craft_fonts::georgian_ui_fonts().into_iter().map(copy));
|
||||
stack.extend(vectorcraft_text::CRAFT_FONTS.iter().filter(|f| f.scripts.contains(&"Deva")).map(copy));
|
||||
stack.extend(vectorcraft_text::CRAFT_FONTS.iter().filter(|f| f.scripts.contains(&"Gujr")).map(copy));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user