Files
Ely-GPUI-Components/src/i18n/tests/shipped.rs
T
ZacharyZhang-NYandClaude Opus 5.5 d05b1b78ca
CI / platforms (windows-latest) (push) Failing after 16s
CI / site (push) Successful in 25s
CI / crate (push) Failing after 10m59s
CI / platforms (ubuntu-24.04) (push) Canceled after 0s
i18n: shipped components read their copy from the catalog
Select's default placeholder, the clear, close, remove and unpin tooltips,
the completion menu's empty line and the size sample showed English under
zh-CN. A source test now fails on any fixed English literal in them.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-14 19:53:00 -04:00

45 lines
1.5 KiB
Rust

//! Components Ely ships say nothing in fixed English.
/// Sources of components the Ely apps draw.
const SHIPPED: &[(&str, &str)] = &[
("editor/find.rs", include_str!("../../editor/find.rs")),
("editor/hints.rs", include_str!("../../editor/hints.rs")),
("forms/input.rs", include_str!("../../forms/input.rs")),
("forms/select.rs", include_str!("../../forms/select.rs")),
(
"tables/builders.rs",
include_str!("../../tables/builders.rs"),
),
(
"navigation/editor_tabs.rs",
include_str!("../../navigation/editor_tabs.rs"),
),
(
"settings/appearance.rs",
include_str!("../../settings/appearance.rs"),
),
];
#[test]
fn shipped_components_show_no_fixed_english() {
let shown = [".tooltip(\"", ".child(\"", "SharedString::from(\""];
let mut found = Vec::new();
for (path, source) in SHIPPED {
let code = source.split("#[cfg(test)]").next().unwrap_or(source);
for (no, line) in code.lines().enumerate() {
for call in shown {
let Some(at) = line.find(call) else { continue };
let rest = &line[at + call.len()..];
if rest.starts_with(|ch: char| ch.is_ascii_alphabetic()) {
found.push(format!("{path}:{}: {}", no + 1, line.trim()));
}
}
}
}
assert!(
found.is_empty(),
"English outside the catalog:\n{}",
found.join("\n")
);
}