Merge pull request #8988 from dotCooCoo/feat/i18n-bg-messages

i18n: Bulgarian translates status and error messages
This commit is contained in:
BFlat
2026-11-25 11:32:14 +07:00
committed by GitHub
5 changed files with 1072 additions and 14 deletions
File diff suppressed because it is too large Load Diff
+46 -1
View File
@@ -212,6 +212,51 @@ fn bundled_catalogs_are_consistent() {
}
}
/// A catalog column with its `\n`, `\t` and `\\` escapes read.
fn unescaped(column: &str) -> String {
let mut out = String::with_capacity(column.len());
let mut chars = column.chars();
while let Some(c) = chars.next() {
if c != '\\' {
out.push(c);
continue;
}
match chars.next() {
Some('n') => out.push('\n'),
Some('t') => out.push('\t'),
Some(other) => out.push(other),
None => out.push('\\'),
}
}
out
}
/// A translated message starts and ends with whitespace only where its English does, so a status
/// message is not shown with a stray space.
#[test]
fn message_translations_keep_their_english_edges() {
let mut wrong = Vec::new();
for (code, _, catalog) in EMBEDDED {
for line in catalog.lines() {
let mut columns = line.splitn(3, '\t');
let (Some(ctx @ ("@msg" | "@msgplural")), Some(src), Some(tr)) = (columns.next(), columns.next(), columns.next()) else { continue };
let (src, tr) = (unescaped(src), unescaped(tr));
let plural = ctx == "@msgplural";
let sources: Vec<&str> = if plural { src.split('|').collect() } else { vec![src.as_str()] };
let forms: Vec<&str> = if plural { tr.split('|').collect() } else { vec![tr.as_str()] };
for (i, form) in forms.into_iter().enumerate() {
let english = sources.get(i).or(sources.last()).copied().unwrap_or_default();
let lead = form.starts_with(char::is_whitespace) && !english.starts_with(char::is_whitespace);
let trail = form.ends_with(char::is_whitespace) && !english.ends_with(char::is_whitespace);
if lead || trail {
wrong.push(format!("{code}: {src:?} -> {form:?}"));
}
}
}
}
assert!(wrong.is_empty(), "{} message translations add whitespace at an edge:\n{}", wrong.len(), wrong.join("\n"));
}
/// The engine learns the language the UI is drawn in each frame: new type takes the Japanese
/// defaults while it is Japanese (#432). A Japanese frame draws in Japanese on this test's thread
/// only: the tests running beside it on other threads still draw in English.
@@ -1637,7 +1682,7 @@ fn command_ids(s: &str) -> Vec<&str> {
/// the messages each one lacks.
const COMPLETE_MESSAGES: &[&str] = &[
"cs", "de", "el", "es", "fr", "hi", "hu", "it", "ja", "ka", "ko", "pl", "pt-br", "ru", "sv", "uk", "vi", "zh-hans", "zh-hant", "fi", "tr", "ca",
"nl", "da", "id",
"nl", "da", "id", "bg",
];
/// Crates whose error and status messages reach the status bar, the crates whose errors the
+1 -1
View File
@@ -312,7 +312,7 @@ other `sv-*` locale resolve to it), Georgian (`ka`, complete; `ka-GE` and `ka_GE
``[{j}] `{_1}`: {why}``, so its reason is translated while a JSON array stays as it is. A literal brace in a
row is written `{{` or `}}`, in the English and in the translation: a message made with `format!` keeps the
doubled braces of its format string, and a plain string literal has each of its braces doubled, so the row for
`"expected {\"objects\": [...]}"` is `expected {{"objects": [...]}}`. Czech, German, Greek, Spanish, French, Georgian, Hindi, Hungarian, Italian, Japanese, Korean, Polish, Brazilian Portuguese, Russian, Simplified Chinese, Traditional Chinese, Swedish, Ukrainian, Vietnamese, Finnish, Turkish, Catalan, Dutch, Danish and Indonesian
`"expected {\"objects\": [...]}"` is `expected {{"objects": [...]}}`. Czech, German, Greek, Spanish, French, Georgian, Hindi, Hungarian, Italian, Japanese, Korean, Polish, Brazilian Portuguese, Russian, Simplified Chinese, Traditional Chinese, Swedish, Ukrainian, Vietnamese, Finnish, Turkish, Catalan, Dutch, Danish, Indonesian and Bulgarian
translate status and error messages (`COMPLETE_MESSAGES` in `i18n::tests`); the untranslated report lists the
message literals the scan finds, and the phrases a parameter schema's error builds at run time
(`SCHEMA_PHRASES`), that one of them has no row for. The scan covers the crates in `MESSAGE_CRATES`, the
+2 -2
View File
@@ -17,7 +17,7 @@ translation never fails a test or a build: the interface shows the English text
`cargo xtask ci` prints the untranslated report (`cargo xtask i18n-report` alone), which lists per language the
strings missing from each catalog with the `complete_menus` flag and the messages missing from each language in
the `COMPLETE_MESSAGES` list. Every non-English language marked "full" has the flag, and all of them except
Bosnian and Bulgarian are in the list. No language has help content: there is no translated (or
Bosnian are in the list. No language has help content: there is no translated (or
English) in-app help, and the docs are English.
**Native review:** every catalog was written clean-room from the English meaning, most of it by agents
@@ -66,7 +66,7 @@ plus review. Native-speaker review is human work and isn't in the hours.
| Czech | `cs` | 9,761 rows, 3,742 of them `@msg` and 51 `@msgplural` (counted 2026-11-17 on `main` at `ee60c51fd9`): the untranslated report lists 222 missing Czech messages, and 15 messages that no checked language has a row for | catalog complete; render-site gaps reduced; native review pending |
| Bosnian | `bs` | 7,227 rows, 1,205 of them `@msg` and 47 `@msgplural` (counted 2026-11-17 on `main` at `ee60c51fd9`): the untranslated report lists 113 missing menu strings, 66 `tl!` literals and 30 undo labels for it; not in `COMPLETE_MESSAGES`, so the report does not check its messages; one/few/other plurals | full; AI-assisted, native review pending |
| Swedish | `sv` | 9,498 rows, 3,311 of them `@msg` and 51 `@msgplural` (counted 2026-11-17 on `main` at `ee60c51fd9`): the untranslated report lists 647 missing messages for it, and 31 menu strings, 14 `tl!` literals and 6 undo labels; one/other plurals | full; native review welcome |
| Bulgarian | `bg` | 7,133 rows, 1,111 of them `@msg` and 47 `@msgplural` (counted 2026-11-17 on `main` at `ee60c51fd9`): the untranslated report lists 76 menu strings, 48 `tl!` literals, 16 undo labels and 45 swatch names for it; its messages are partial | full; AI-drafted, native review pending |
| Bulgarian | `bg` | 8,940 rows, 2,143 of them `@msg` and 56 `@msgplural` (counted 2026-11-25 on `main` at `9d050d2b01`): in `COMPLETE_MESSAGES`, and the untranslated report lists 71 menu strings, 41 `tl!` literals, 13 undo labels, 45 swatch names and 1,933 messages for it; its messages are partial | full; AI-drafted, native review pending |
| Greek | `el` | 8,003 rows, 1,972 of them `@msg` and 51 `@msgplural` (counted 2026-11-17 on `main` at `ee60c51fd9`): the untranslated report lists 1,974 missing messages for it | full; native review welcome |
| Georgian | `ka` | 9,758 rows, 3,740 of them `@msg` and 49 `@msgplural` (counted 2026-11-15): menus, panels, dialogs and plurals (one count-neutral form); the untranslated report lists 1 missing Georgian message; reviewed by a native speaker | full |
| Turkish | `tr` | 9,784 rows, 3,746 of them `@msg` and 51 `@msgplural` (counted 2026-11-17 on `main` at `ee60c51fd9`); 235 messages, 79 menu strings, 39 `tl!` literals, 16 undo labels and the default swatch names still fall back to English | full |
File diff suppressed because one or more lines are too long