mirror of
https://github.com/storytold/AniCraft.git
synced 2026-11-29 17:43:57 +01:00
fix(i18n): keep Hebrew out of ready_codes until bidi exists and respect script subtags
This commit is contained in:
1 parent
8f13fb08fa
commit
cddc15092b
3 files changed
+236
-45
No files matched your search
@@ -96,7 +96,7 @@ and a trailing `…`. Then open a pull request in craft-i18n. Follow its clean-r
|
||||
from the plain meaning of the English, never from another product's translated interface.
|
||||
|
||||
A language is offered once craft-i18n has its `anicraft.tsv` and it is in `i18n::READY`
|
||||
(left-to-right Latin, Greek and Cyrillic scripts today, plus Georgian and Hebrew in builds with their craft-fonts faces).
|
||||
(left-to-right Latin, Greek and Cyrillic scripts today, plus Georgian in builds with its craft-fonts face).
|
||||
|
||||
## Building with translations
|
||||
|
||||
@@ -119,7 +119,7 @@ shaping. So:
|
||||
|---|---|
|
||||
| Latin, Greek, Cyrillic | Offered when a catalog exists. |
|
||||
| Georgian | Offered when a catalog exists and the build embedded a valid Noto Sans Georgian from craft-fonts (via `CRAFT_FONTS_DIR` or the nearby checkout `build.rs` discovers); hidden only when it did not (`i18n::ready_codes`). |
|
||||
| Hebrew | Offered when a catalog exists and the build embedded a valid Noto Sans Hebrew (`Hebr`, via `CRAFT_FONTS_DIR` or the nearby checkout `build.rs` discovers); hidden only when it did not (`i18n::ready_codes`). `i18n::is_rtl()` / `i18n::is_rtl_code()` expose script direction for RTL helpers and legacy `iw` tags normalize to `he`. |
|
||||
| Hebrew | Not offered yet: embeds `NotoSansHebrew-Regular.ttf` (`Hebr`, via `CRAFT_FONTS_DIR` or the nearby checkout `build.rs` discovers) and prepares legacy `iw` -> `he` normalization plus `i18n::is_rtl()` / `i18n::is_rtl_code()`, while `he` remains out of `i18n::ready_codes()` until egui supports bidi text layout and mirrored widgets. |
|
||||
| Chinese, Japanese, Korean | Draw correctly, but need a font the app doesn't bundle (a craft-fonts face), then a `READY` entry. |
|
||||
| Arabic, Persian, Urdu, Kurdish, Dhivehi | Not offered: right to left needs bidi and shaping in egui's text layout, and mirrored widgets. We follow upstream egui rather than fork it. |
|
||||
| Devanagari, Bengali, Tamil, Telugu, Thai, Lao | Not offered: they need shaping. |
|
||||
|
||||
+31
-16
@@ -39,35 +39,39 @@ pub const PSEUDO: &str = "pseudo";
|
||||
/// Languages the interface can be drawn in today: written left to right, in scripts the bundled
|
||||
/// faces cover and egui lays out a letter at a time (Latin, Greek, Cyrillic). A catalog for any
|
||||
/// other locale is embedded but not offered (docs/localisation.md › Scripts and direction).
|
||||
/// Georgian and Hebrew are not listed here: their faces are not bundled, so [`ready_codes`] adds
|
||||
/// them only when the build embedded Noto Sans Georgian / Noto Sans Hebrew from craft-fonts.
|
||||
/// Georgian is not listed here: its face is not bundled, so [`ready_codes`] adds it only when
|
||||
/// the build embedded Noto Sans Georgian from craft-fonts. Hebrew (`he`) embeds Noto Sans Hebrew
|
||||
/// when available, but remains excluded from [`ready_codes`] until egui supports bidi text layout.
|
||||
pub const READY: &[&str] = &[
|
||||
"az", "bg", "bs", "ca", "cs", "da", "de", "el", "es", "et", "fi", "fr", "gl", "hr", "hu", "id", "it", "kk", "lt", "lv", "nb", "nl", "pl", "pt", "pt-br", "ro", "ru", "sk", "sl", "sq", "sr", "sr-latn", "sv", "tr", "uk",
|
||||
"az", "bg", "bs", "ca", "cs", "da", "de", "el", "es", "et", "fi", "fr", "gl", "hr", "hu", "id", "it", "kk", "lt", "lv", "nb", "nl", "pl", "pt",
|
||||
"pt-br", "ro", "ru", "sk", "sl", "sq", "sr", "sr-latn", "sv", "tr", "uk",
|
||||
];
|
||||
|
||||
/// [`READY`] plus the languages whose script needs a craft-fonts face this build embedded.
|
||||
pub fn ready_codes() -> Vec<&'static str> {
|
||||
ready_with(crate::theme::georgian_font().is_some(), crate::theme::hebrew_font().is_some())
|
||||
ready_with(crate::theme::georgian_font().is_some())
|
||||
}
|
||||
|
||||
fn ready_with(georgian_face: bool, hebrew_face: bool) -> Vec<&'static str> {
|
||||
fn ready_with(georgian_face: bool) -> Vec<&'static str> {
|
||||
let mut codes = READY.to_vec();
|
||||
if georgian_face {
|
||||
codes.push("ka");
|
||||
}
|
||||
if hebrew_face {
|
||||
codes.push("he");
|
||||
}
|
||||
codes
|
||||
}
|
||||
|
||||
/// Whether `code` names a right-to-left interface language (`ar`, `dv`, `fa`, `he`, `ku`, `ps`,
|
||||
/// `sd`, `ug`, `ur`, `yi`, and legacy `iw` tags normalized via `normalize_code`).
|
||||
/// Whether `code` names a right-to-left interface language (`ar`, `ckb`, `dv`, `fa`, `he`, `ps`,
|
||||
/// `sd`, `ug`, `ur`, `yi`, and legacy `iw` tags normalized via `normalize_code`), honoring any
|
||||
/// explicit ISO 15924 script subtag before applying language defaults.
|
||||
#[cfg_attr(not(test), allow(dead_code))]
|
||||
pub fn is_rtl_code(code: &str) -> bool {
|
||||
let normalized = Languages::normalize_code(code);
|
||||
let base = normalized.split('-').next().unwrap_or("");
|
||||
matches!(base, "ar" | "dv" | "fa" | "he" | "ku" | "ps" | "sd" | "ug" | "ur" | "yi")
|
||||
let normalized = Languages::normalize_code(code.split(['.', '@']).next().unwrap_or(code));
|
||||
let mut parts = normalized.split('-').filter(|p| !p.is_empty());
|
||||
let Some(base) = parts.next() else { return false };
|
||||
if let Some(script) = parts.find(|p| p.len() == 4 && p.chars().all(|c| c.is_ascii_alphabetic())) {
|
||||
return matches!(script, "arab" | "hebr" | "thaa" | "syrc" | "nkoo" | "adlm" | "mand" | "samr" | "rohg");
|
||||
}
|
||||
matches!(base, "ar" | "ckb" | "dv" | "fa" | "he" | "ps" | "sd" | "ug" | "ur" | "yi")
|
||||
}
|
||||
|
||||
/// Whether the active interface language uses right-to-left script direction.
|
||||
@@ -91,7 +95,8 @@ struct Language {
|
||||
/// The last subtag is a region (`br`, `419`): the locale falls back to its base language.
|
||||
fn regional_base(code: &str) -> Option<&str> {
|
||||
let (base, region) = code.rsplit_once('-')?;
|
||||
let is_region = (region.len() == 2 && region.chars().all(|c| c.is_ascii_alphabetic())) || (region.len() == 3 && region.chars().all(|c| c.is_ascii_digit()));
|
||||
let is_region =
|
||||
(region.len() == 2 && region.chars().all(|c| c.is_ascii_alphabetic())) || (region.len() == 3 && region.chars().all(|c| c.is_ascii_digit()));
|
||||
is_region.then_some(base)
|
||||
}
|
||||
|
||||
@@ -286,7 +291,13 @@ pub fn known(pref: &str) -> bool {
|
||||
/// pseudo-locale is listed in debug builds and while it is in use.
|
||||
pub fn offered() -> Vec<(&'static str, &'static str)> {
|
||||
let now = current();
|
||||
LANGUAGES.list.iter().enumerate().filter(|(i, l)| !matches!(l.kind, Kind::Pseudo) || cfg!(debug_assertions) || *i == now).map(|(_, l)| (l.code.as_str(), l.name.as_str())).collect()
|
||||
LANGUAGES
|
||||
.list
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter(|(i, l)| !matches!(l.kind, Kind::Pseudo) || cfg!(debug_assertions) || *i == now)
|
||||
.map(|(_, l)| (l.code.as_str(), l.name.as_str()))
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// The name of the language [`AUTO`] picks on this computer, for the picker's first entry.
|
||||
@@ -342,7 +353,11 @@ impl Languages {
|
||||
fn count<'a>(&'a self, i: usize, one: &'static str, other: &'static str, n: u64) -> &'a str {
|
||||
match self.get(i).kind {
|
||||
Kind::English => {
|
||||
if n == 1 { one } else { other }
|
||||
if n == 1 {
|
||||
one
|
||||
} else {
|
||||
other
|
||||
}
|
||||
}
|
||||
Kind::Pseudo => pseudo_static(if n == 1 { one } else { other }),
|
||||
Kind::Catalog(_) => self.plural(i, one, other, n),
|
||||
|
||||
+203
-27
@@ -43,7 +43,10 @@ fn shell_sources() -> Vec<(String, String)> {
|
||||
/// A file without its `#[cfg(test)] mod … {` block at the end (tests aren't interface).
|
||||
fn without_tests(src: &str) -> String {
|
||||
let lines: Vec<&str> = src.lines().collect();
|
||||
let cut = lines.windows(2).position(|w| w.first().is_some_and(|l| l.trim() == "#[cfg(test)]") && w.get(1).is_some_and(|l| l.trim_start().starts_with("mod ") && l.trim_end().ends_with('{')));
|
||||
let cut = lines.windows(2).position(|w| {
|
||||
w.first().is_some_and(|l| l.trim() == "#[cfg(test)]")
|
||||
&& w.get(1).is_some_and(|l| l.trim_start().starts_with("mod ") && l.trim_end().ends_with('{'))
|
||||
});
|
||||
match cut {
|
||||
Some(n) => lines.get(..n).unwrap_or_default().join("\n"),
|
||||
None => src.to_string(),
|
||||
@@ -53,10 +56,38 @@ fn without_tests(src: &str) -> String {
|
||||
/// Code before a literal, on its line, that makes it something other than interface text:
|
||||
/// logs and console output, ids and keys, commands and their parameters, attributes.
|
||||
const NOT_UI: &[&str] = &[
|
||||
"eprintln!(", "println!(", "print!(", "panic!(", "assert", "unreachable!(", "Id::new(", "id_salt(", "persistent_id(", "json!(", "execute(", "perform(", "invoke(", ".run(", "find_command(", "#[", "env!(", "include_str!(", "include_bytes!(", "concat!(", "var(",
|
||||
"contains(", "starts_with(", "ends_with(", "strip_prefix(", "strip_suffix(", "matches!(", "== ", "!= ",
|
||||
"eprintln!(",
|
||||
"println!(",
|
||||
"print!(",
|
||||
"panic!(",
|
||||
"assert",
|
||||
"unreachable!(",
|
||||
"Id::new(",
|
||||
"id_salt(",
|
||||
"persistent_id(",
|
||||
"json!(",
|
||||
"execute(",
|
||||
"perform(",
|
||||
"invoke(",
|
||||
".run(",
|
||||
"find_command(",
|
||||
"#[",
|
||||
"env!(",
|
||||
"include_str!(",
|
||||
"include_bytes!(",
|
||||
"concat!(",
|
||||
"var(",
|
||||
"contains(",
|
||||
"starts_with(",
|
||||
"ends_with(",
|
||||
"strip_prefix(",
|
||||
"strip_suffix(",
|
||||
"matches!(",
|
||||
"== ",
|
||||
"!= ",
|
||||
// The start-up log (`startup::line`): English, like console messages, for bug reports.
|
||||
"line(&", "write(&format!(",
|
||||
"line(&",
|
||||
"write(&format!(",
|
||||
];
|
||||
|
||||
/// Whether a prose literal outside the macros is allowed: not interface text by its context,
|
||||
@@ -246,13 +277,18 @@ fn extract() {
|
||||
let only = std::env::var("ANICRAFT_I18N_LOCALE").ok().map(|l| l.to_ascii_lowercase());
|
||||
let mut missing_in: Option<Catalog> = None;
|
||||
if let Some(locales) = &checkout {
|
||||
let mut codes: Vec<String> = std::fs::read_dir(locales).map(|r| r.flatten().filter(|e| e.path().is_dir()).map(|e| e.file_name().to_string_lossy().into_owned()).collect()).unwrap_or_default();
|
||||
let mut codes: Vec<String> = std::fs::read_dir(locales)
|
||||
.map(|r| r.flatten().filter(|e| e.path().is_dir()).map(|e| e.file_name().to_string_lossy().into_owned()).collect())
|
||||
.unwrap_or_default();
|
||||
codes.sort();
|
||||
println!("locale translated stale (of {} AniCraft strings; READY = offered once it has anicraft.tsv)", keys.len());
|
||||
for code in &codes {
|
||||
let (cat, own) = disk_catalog(locales, code);
|
||||
let n = keys.iter().filter(|k| translated(&cat, k)).count();
|
||||
let stale = own.iter().filter(|r| !r.context.starts_with('@') && !keys.contains(&Key::Text { context: r.context.clone(), source: r.source.clone() })).count();
|
||||
let stale = own
|
||||
.iter()
|
||||
.filter(|r| !r.context.starts_with('@') && !keys.contains(&Key::Text { context: r.context.clone(), source: r.source.clone() }))
|
||||
.count();
|
||||
let ready = if super::ready(code, READY) { "READY" } else { "" };
|
||||
println!("{code:<10} {n:>5} ({:>3} %) {stale:>8} {ready}", n * 100 / keys.len().max(1));
|
||||
if only.as_deref() == Some(code.as_str()) {
|
||||
@@ -290,10 +326,18 @@ const DE_COMMON: &str = "@id\tlanguage.name\tDeutsch\n\tSave\tSpeichern\n\tOpen\
|
||||
const DE_APP: &str = "\tOpen\tDatei öffnen\n\tSaved {path}\t{path} gespeichert\n@id\tedit.undo\tRückgängig\n";
|
||||
const PT_COMMON: &str = "@id\tlanguage.name\tPortuguês\n\tSave\tGuardar\n\tOpen\tAbrir\n";
|
||||
const PT_BR_APP: &str = "@id\tlanguage.name\tPortuguês (Brasil)\n\tSave\tSalvar\n@plural\t{n} frame|{n} frames\t{n} quadro|{n} quadros\n";
|
||||
const RU_APP: &str = "@id\tlanguage.name\tРусский\n@plural\t{n} frame|{n} frames\t{n} кадр|{n} кадра|{n} кадров\n@plural\t{n} layer|{n} layers\t{n} слой|{n} слоя\n";
|
||||
const RU_APP: &str =
|
||||
"@id\tlanguage.name\tРусский\n@plural\t{n} frame|{n} frames\t{n} кадр|{n} кадра|{n} кадров\n@plural\t{n} layer|{n} layers\t{n} слой|{n} слоя\n";
|
||||
|
||||
fn fixture() -> Languages {
|
||||
let embedded = [("de", DE_COMMON, DE_APP), ("pt", PT_COMMON, ""), ("pt-BR", "", PT_BR_APP), ("ru", "", RU_APP), ("ar", "\tSave\tحفظ\n", "\tOpen\tفتح\n"), ("fr", "\tSave\tEnregistrer\n", "")];
|
||||
let embedded = [
|
||||
("de", DE_COMMON, DE_APP),
|
||||
("pt", PT_COMMON, ""),
|
||||
("pt-BR", "", PT_BR_APP),
|
||||
("ru", "", RU_APP),
|
||||
("ar", "\tSave\tحفظ\n", "\tOpen\tفتح\n"),
|
||||
("fr", "\tSave\tEnregistrer\n", ""),
|
||||
];
|
||||
let (l, problems) = Languages::new(&embedded, READY);
|
||||
assert!(problems.is_empty(), "{problems:?}");
|
||||
l
|
||||
@@ -313,7 +357,7 @@ fn offered_languages_have_their_own_catalog_and_a_ready_script() {
|
||||
#[test]
|
||||
fn georgian_is_offered_only_when_its_face_is_embedded() {
|
||||
let ka = [("ka", "", "@id\tlanguage.name\tქართული\n")];
|
||||
let offered = |face: bool| Languages::new(&ka, &ready_with(face, false)).0.list.iter().any(|l| l.code == "ka");
|
||||
let offered = |face: bool| Languages::new(&ka, &ready_with(face)).0.list.iter().any(|l| l.code == "ka");
|
||||
assert!(!offered(false), "no face, no Georgian");
|
||||
assert!(offered(true));
|
||||
// The real build agrees with its own face.
|
||||
@@ -344,12 +388,17 @@ fn georgian_is_offered_only_when_its_face_is_embedded() {
|
||||
#[test]
|
||||
fn hebrew_is_offered_only_when_its_face_is_embedded() {
|
||||
let he = [("he", "", "@id\tlanguage.name\tעברית\n")];
|
||||
let offered = |face: bool| Languages::new(&he, &ready_with(false, face)).0.list.iter().any(|l| l.code == "he");
|
||||
assert!(!offered(false), "no face, no Hebrew");
|
||||
assert!(offered(true));
|
||||
assert_eq!(ready_codes().contains(&"he"), crate::theme::hebrew_font().is_some());
|
||||
// Hebrew stays out of `ready_codes()` until egui supports bidi text layout, even when its font is embedded.
|
||||
assert!(!ready_codes().contains(&"he"), "Hebrew must remain outside ready_codes until bidi layout exists");
|
||||
assert!(!Languages::new(&he, &ready_with(false)).0.list.iter().any(|l| l.code == "he"));
|
||||
assert!(!Languages::new(&he, &ready_with(true)).0.list.iter().any(|l| l.code == "he"));
|
||||
// Explicitly enabling "he" in a test still loads the Hebrew catalog cleanly.
|
||||
assert!(Languages::new(&he, &["he"]).0.list.iter().any(|l| l.code == "he"));
|
||||
if std::env::var("CRAFT_FONTS_REQUIRED").is_ok_and(|v| v == "1") {
|
||||
assert!(crate::theme::hebrew_font().is_some(), "CRAFT_FONTS_REQUIRED=1 but this build embeds no valid NotoSansHebrew-Regular.ttf (craft-fonts `Hebr`)");
|
||||
assert!(
|
||||
crate::theme::hebrew_font().is_some(),
|
||||
"CRAFT_FONTS_REQUIRED=1 but this build embeds no valid NotoSansHebrew-Regular.ttf (craft-fonts `Hebr`)"
|
||||
);
|
||||
}
|
||||
let Some(face) = crate::theme::hebrew_font() else {
|
||||
println!("hebrew face test: skipped, this build embeds no Hebrew face");
|
||||
@@ -371,9 +420,13 @@ fn hebrew_is_offered_only_when_its_face_is_embedded() {
|
||||
fn rtl_helper_recognizes_hebrew_and_legacy_iw() {
|
||||
assert!(is_rtl_code("he"));
|
||||
assert!(is_rtl_code("he-IL"));
|
||||
assert!(is_rtl_code("he-Hebr-IL"));
|
||||
assert!(is_rtl_code("iw"));
|
||||
assert!(is_rtl_code("iw_IL"));
|
||||
assert!(is_rtl_code("ar"));
|
||||
assert!(is_rtl_code("ku-Arab-IQ"));
|
||||
assert!(!is_rtl_code("ku-Latn-TR"));
|
||||
assert!(!is_rtl_code("sd-Deva-IN"));
|
||||
assert!(!is_rtl_code("en"));
|
||||
assert!(!is_rtl_code("ka"));
|
||||
assert!(!is_rtl());
|
||||
@@ -552,7 +605,9 @@ fn strings_in(v: &serde_json::Value, out: &mut BTreeSet<String>) {
|
||||
serde_json::Value::Object(o) => {
|
||||
for (k, x) in o {
|
||||
match x {
|
||||
serde_json::Value::String(s) if matches!(k.as_str(), "name" | "text" | "label") && s.chars().filter(char::is_ascii_alphabetic).count() >= 3 => {
|
||||
serde_json::Value::String(s)
|
||||
if matches!(k.as_str(), "name" | "text" | "label") && s.chars().filter(char::is_ascii_alphabetic).count() >= 3 =>
|
||||
{
|
||||
out.insert(s.clone());
|
||||
}
|
||||
_ => strings_in(x, out),
|
||||
@@ -720,7 +775,38 @@ fn every_control_can_be_used_in_the_pseudo_locale() {
|
||||
a.run("element.set_color_effect", serde_json::json!({"style": style}));
|
||||
}));
|
||||
}
|
||||
for panel in ["sound", "camera", "springbones", "shapebones", "shapeweights", "warp", "motion", "motionpins", "actions", "script", "prefs", "envelope", "audiokeys", "lipsync", "onionmenu", "editmultiple", "edittransform", "onionsymbol", "find", "explorer", "publish", "publishreport", "publishanim", "start", "testmovie", "testmovieinside", "templates", "savetemplate", "brushlibrary", "brushcurve"] {
|
||||
for panel in [
|
||||
"sound",
|
||||
"camera",
|
||||
"springbones",
|
||||
"shapebones",
|
||||
"shapeweights",
|
||||
"warp",
|
||||
"motion",
|
||||
"motionpins",
|
||||
"actions",
|
||||
"script",
|
||||
"prefs",
|
||||
"envelope",
|
||||
"audiokeys",
|
||||
"lipsync",
|
||||
"onionmenu",
|
||||
"editmultiple",
|
||||
"edittransform",
|
||||
"onionsymbol",
|
||||
"find",
|
||||
"explorer",
|
||||
"publish",
|
||||
"publishreport",
|
||||
"publishanim",
|
||||
"start",
|
||||
"testmovie",
|
||||
"testmovieinside",
|
||||
"templates",
|
||||
"savetemplate",
|
||||
"brushlibrary",
|
||||
"brushcurve",
|
||||
] {
|
||||
found.extend(click_everything(panel, |a, _| a.open_panel(Some(panel))));
|
||||
}
|
||||
// Test Movie in a window of its own (ADR 0062; egui stands in for the window system here).
|
||||
@@ -728,7 +814,14 @@ fn every_control_can_be_used_in_the_pseudo_locale() {
|
||||
ctx.set_embed_viewports(false);
|
||||
a.open_panel(Some("testmovie"));
|
||||
}));
|
||||
for tool in [crate::app::Tool::Brush, crate::app::Tool::PaintBrush, crate::app::Tool::Eraser, crate::app::Tool::PaintBucket, crate::app::Tool::Pencil, crate::app::Tool::Width] {
|
||||
for tool in [
|
||||
crate::app::Tool::Brush,
|
||||
crate::app::Tool::PaintBrush,
|
||||
crate::app::Tool::Eraser,
|
||||
crate::app::Tool::PaintBucket,
|
||||
crate::app::Tool::Pencil,
|
||||
crate::app::Tool::Width,
|
||||
] {
|
||||
found.extend(click_everything(&format!("{tool:?}"), |a, _| a.tool = tool));
|
||||
}
|
||||
assert!(found.is_empty(), "{} things in plain English after using the controls:\n{}", found.len(), found.join("\n"));
|
||||
@@ -749,11 +842,39 @@ fn status_lines_for_every_result_are_translated() {
|
||||
});
|
||||
let bare = json!({});
|
||||
let ids = [
|
||||
"file.new", "file.open", "file.recover", "file.discard_recovery", "file.save", "file.save_as", "file.import", "file.import_to_library",
|
||||
"file.export_audio", "file.export_sprite_sheet", "file.export_html", "file.export_lottie", "file.export_png", "file.export_gif", "file.export_apng", "file.export_webp",
|
||||
"sound.delete", "edit.undo", "edit.redo", "edit.delete", "layer.delete", "draw.erase_all", "scene.delete", "scene.new",
|
||||
"timeline.clear_keyframe", "timeline.copy_frames", "timeline.cut_frames", "timeline.paste_frames", "timeline.remove_frame",
|
||||
"plugin.run", "plugin.install", "plugin.remove", "plugin.reload",
|
||||
"file.new",
|
||||
"file.open",
|
||||
"file.recover",
|
||||
"file.discard_recovery",
|
||||
"file.save",
|
||||
"file.save_as",
|
||||
"file.import",
|
||||
"file.import_to_library",
|
||||
"file.export_audio",
|
||||
"file.export_sprite_sheet",
|
||||
"file.export_html",
|
||||
"file.export_lottie",
|
||||
"file.export_png",
|
||||
"file.export_gif",
|
||||
"file.export_apng",
|
||||
"file.export_webp",
|
||||
"sound.delete",
|
||||
"edit.undo",
|
||||
"edit.redo",
|
||||
"edit.delete",
|
||||
"layer.delete",
|
||||
"draw.erase_all",
|
||||
"scene.delete",
|
||||
"scene.new",
|
||||
"timeline.clear_keyframe",
|
||||
"timeline.copy_frames",
|
||||
"timeline.cut_frames",
|
||||
"timeline.paste_frames",
|
||||
"timeline.remove_frame",
|
||||
"plugin.run",
|
||||
"plugin.install",
|
||||
"plugin.remove",
|
||||
"plugin.reload",
|
||||
];
|
||||
let mut plain = Vec::new();
|
||||
for id in ids {
|
||||
@@ -784,9 +905,15 @@ fn edit_multiple_frames_status_lines_are_translated() {
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
assert!(plain.is_empty(), "status lines in plain English:
|
||||
{}", plain.join("
|
||||
"));
|
||||
assert!(
|
||||
plain.is_empty(),
|
||||
"status lines in plain English:
|
||||
{}",
|
||||
plain.join(
|
||||
"
|
||||
"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -882,7 +1009,21 @@ fn screen_reader_names_are_translated_too() {
|
||||
// the source guideline can't see: ones passed through variables or built at run time).
|
||||
use crate::app::Tool;
|
||||
let mut found = untranslated_names("default", |_, _| {});
|
||||
for tool in [Tool::Rect, Tool::Star, Tool::Text, Tool::Pencil, Tool::Brush, Tool::Eraser, Tool::PaintBucket, Tool::Eyedropper, Tool::Pen, Tool::Camera, Tool::Bone, Tool::Bind, Tool::Warp] {
|
||||
for tool in [
|
||||
Tool::Rect,
|
||||
Tool::Star,
|
||||
Tool::Text,
|
||||
Tool::Pencil,
|
||||
Tool::Brush,
|
||||
Tool::Eraser,
|
||||
Tool::PaintBucket,
|
||||
Tool::Eyedropper,
|
||||
Tool::Pen,
|
||||
Tool::Camera,
|
||||
Tool::Bone,
|
||||
Tool::Bind,
|
||||
Tool::Warp,
|
||||
] {
|
||||
found.extend(untranslated_names(&format!("{tool:?} tool"), |a, _| a.tool = tool));
|
||||
}
|
||||
// Selections and states that change what Properties, the timeline and the dialogs show.
|
||||
@@ -915,7 +1056,42 @@ fn screen_reader_names_are_translated_too() {
|
||||
found.extend(untranslated_names("library item", |a, _| {
|
||||
a.library_sel = a.s.doc.library.first().map(|s| crate::app::LibraryItem::Symbol(s.id));
|
||||
}));
|
||||
for panel in ["start", "drop", "droplibrary", "select", "motion", "motionspan", "motionpath", "motionedit", "camera", "sound", "prefs", "shortcuts", "palette", "about", "files", "licenses", "confirm", "recovery", "frames", "filters", "plugins", "actions", "script", "scriptproblems", "testmovie", "testmovieinside", "testscript", "exporthtml", "envelope", "audiokeys", "lipsync", "templates", "savetemplate", "droptimeline"] {
|
||||
for panel in [
|
||||
"start",
|
||||
"drop",
|
||||
"droplibrary",
|
||||
"select",
|
||||
"motion",
|
||||
"motionspan",
|
||||
"motionpath",
|
||||
"motionedit",
|
||||
"camera",
|
||||
"sound",
|
||||
"prefs",
|
||||
"shortcuts",
|
||||
"palette",
|
||||
"about",
|
||||
"files",
|
||||
"licenses",
|
||||
"confirm",
|
||||
"recovery",
|
||||
"frames",
|
||||
"filters",
|
||||
"plugins",
|
||||
"actions",
|
||||
"script",
|
||||
"scriptproblems",
|
||||
"testmovie",
|
||||
"testmovieinside",
|
||||
"testscript",
|
||||
"exporthtml",
|
||||
"envelope",
|
||||
"audiokeys",
|
||||
"lipsync",
|
||||
"templates",
|
||||
"savetemplate",
|
||||
"droptimeline",
|
||||
] {
|
||||
found.extend(untranslated_names(panel, |a, _| a.open_panel(Some(panel))));
|
||||
}
|
||||
assert!(found.is_empty(), "{} screen-reader names not translated in the pseudo-locale:\n{}", found.len(), found.join("\n"));
|
||||
|
||||
Reference in new issue
Block a user