i18n: French and Serbian Options headings without the context prefix (#1891)

fr.rs and sr.rs translated three `context|label` keys with the context
kept ("Options|Général", "Opcije|Opšte", "Options de la feuille|Affichage"
...). `Language::tr` shows a found translation as it is, so File › Options
section headings and the Sheet Options "View" checkboxes showed the prefix.
The values now hold only the label.

Tests: `translations_never_show_the_context_prefix` (no catalog shows a `|`
for any key) and `translated_options_headings_show_no_context_prefix`
(File › Options in French and Serbian); both fail on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Vedran Dobos
2026-10-19 02:05:57 +02:00
co-authored by Claude Opus 5.5
parent 6e984bb84d
commit f1015e1e6b
5 changed files with 46 additions and 7 deletions
+18
View File
@@ -647,6 +647,24 @@ mod tests {
assert_eq!(Language::parse("xx"), None);
}
#[test]
fn translations_never_show_the_context_prefix() {
// `tr` returns a found translation as it is, so a catalog that keeps `context|` in its
// value shows it on screen (File › Options read "Options|Général" in French).
for language in Language::ALL {
for (english, _) in JAPANESE {
let shown = language.tr(english);
assert!(!shown.contains('|'), "{} shows a context prefix for {english}: {shown}", language.code());
}
}
assert_eq!(Language::Fr.tr("Options|General"), "Général");
assert_eq!(Language::Fr.tr("Options|Save"), "Enregistrer");
assert_eq!(Language::Fr.tr("Sheet Options|View"), "Affichage");
assert_eq!(Language::Sr.tr("Options|General"), "Opšte");
assert_eq!(Language::Sr.tr("Options|Save"), "Sačuvaj");
assert_eq!(Language::Sr.tr("Sheet Options|View"), "Prikaz");
}
#[test]
fn unknown_saved_language_keeps_the_other_preferences() {
let ui: crate::UiState = serde_json::from_str(r#"{"dark": true, "language": "xx"}"#).unwrap();
+3 -3
View File
@@ -305,7 +305,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"Lookup &\nReference" => "Recherche et\nréférence",
"Math &\nTrig" => "Maths et\ntrigonométrie",
"More\nFunctions" => "Autres\nfonctions",
"Sheet Options|View" => "Options de la feuille|Affichage",
"Sheet Options|View" => "Affichage",
"Print" => "Impression",
"Click to add data" => "Cliquez pour ajouter des données",
"Add header" => "Ajouter un en-tête",
@@ -402,8 +402,8 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"Save the active sheet as comma-separated text." => "Enregistrer la feuille active sous forme de texte séparé par des points-virgules.",
"Web Page (.html)" => "Page web (.html)",
"Save the workbook as a web page." => "Enregistrer le classeur en tant que page web.",
"Options|General" => "Options|Général",
"Options|Save" => "Options|Enregistrer",
"Options|General" => "Général",
"Options|Save" => "Enregistrer",
"Show formula bar" => "Afficher la barre de formule",
"Enable AutoComplete for cell values" => "Activer la saisie semi-automatique des valeurs de cellule",
"Save .xlsx workbooks automatically after every change" => "Enregistrer automatiquement les classeurs .xlsx après chaque modification",
+3 -3
View File
@@ -297,7 +297,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"Lookup &\nReference" => "Pretraga i\nreference",
"Math &\nTrig" => "Matematika i\ntrigonometrija",
"More\nFunctions" => "Još\nfunkcija",
"Sheet Options|View" => "Opcije lista|Prikaz",
"Sheet Options|View" => "Prikaz",
"Print" => "Štampaj",
"Click to add data" => "Kliknite da dodate podatke",
"Add header" => "Dodaj zaglavlje",
@@ -394,8 +394,8 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"Save the active sheet as comma-separated text." => "Sačuvaj aktivni list kao tekst odvojen zapetama.",
"Web Page (.html)" => "Veb stranica (.html)",
"Save the workbook as a web page." => "Sačuvaj radnu svesku kao veb stranicu.",
"Options|General" => "Opcije|Opšte",
"Options|Save" => "Opcije|Sačuvaj",
"Options|General" => "Opšte",
"Options|Save" => "Sačuvaj",
"Show formula bar" => "Prikaži traku formule",
"Enable AutoComplete for cell values" => "Omogući automatsko dovršavanje vrednosti ćelija",
"Save .xlsx workbooks automatically after every change" => "Automatski sačuvaj .xlsx radne sveske posle svake izmene",
+20
View File
@@ -132,6 +132,26 @@ fn file_options_opens_the_options_page_and_pages_are_reachable_by_command() {
assert!(h.state().backstage.is_none());
}
#[test]
fn translated_options_headings_show_no_context_prefix() {
for (code, headings, prefixed) in [
("fr", ["Général", "Enregistrer"], ["Options|Général", "Options|Enregistrer"]),
("sr", ["Opšte", "Sačuvaj"], ["Opcije|Opšte", "Opcije|Sačuvaj"]),
] {
let mut h = harness(Services::default());
h.state_mut().run("app.language.set", serde_json::json!({"language": code})).unwrap();
h.state_mut().run("file.options", serde_json::json!({})).unwrap();
h.run_steps(3);
assert_eq!(page(&h), Some("options"));
for heading in headings {
assert!(h.query_all_by_label(heading).next().is_some(), "{code}: no {heading} heading");
}
for label in prefixed {
assert!(h.query_by_label(label).is_none(), "{code}: {label} shows its context");
}
}
}
#[test]
fn export_as_pdf_is_delivered_as_a_download() {
let files = Arc::new(Mutex::new(Vec::<(String, Vec<u8>)>::new()));
+2 -1
View File
@@ -1,6 +1,6 @@
# Localization parity
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-12 · **Change:** minor (Format Cells dialog looks its labels up in the catalog) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-19 · **Change:** minor (French and Serbian `context|label` translations no longer show the context) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4
Per-language status against Excel, which ships its UI in dozens of languages (Windows language
packs cover 100+), with localized function names, argument separators, number and date formats,
@@ -78,6 +78,7 @@ language (none so far) and of localized function names.
| Date | Change | Summary |
|---|---|---|
| 2026-10-19 | minor | French and Serbian kept the context in three `context\|label` translations ("Options\|Général", "Opcije\|Opšte" for `Options\|General`; also `Options\|Save`, `Sheet Options\|View`). `tr` shows a found translation as it is, so File › Options headings and the Sheet Options "View" checkboxes showed the prefix. Fixed; a test checks that no catalog shows a `\|` |
| 2026-10-12 | minor | Format Cells looks up its tabs, labels, options and note through `Language::tr` (Fill tab keyed `Format Cells\|Fill`); dialog titles and OK/Cancel too. Labels already in a table (Number, Currency, Fill…) show translated; the rest fall back to English until the tables add them |
| 2026-10-12 | minor | Brazilian Portuguese catalog (`i18n/pt.rs`) grows from 377 to 923 entries: every key the other catalogs translate, including the dialog strings #669 starts looking up (~42%) |
| 2026-10-11 | minor | German ribbon catalog (`i18n/de.rs`, 266 labels, ~12%); `de` locale tags (de-DE, de-AT, de-CH…) resolve to German. PR #163 (localized German formulas/numbers) still open |