mirror of
https://github.com/storytold/gridcraft.git
synced 2026-10-24 02:36:48 -06:00
Merge pull request #1892 from vedran-dobos:options-prefix-translations
# Conflicts: # crates/ui-egui/src/i18n.rs # docs/localization-parity.md
This commit is contained in:
@@ -682,6 +682,24 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[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();
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -132,6 +132,33 @@ 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, (view, view_prefixed)) in [
|
||||
("fr", ["Général", "Enregistrer"], ["Options|Général", "Options|Enregistrer"], ("Affichage", "Options de la feuille|Affichage")),
|
||||
("sr", ["Opšte", "Sačuvaj"], ["Opcije|Opšte", "Opcije|Sačuvaj"], ("Prikaz", "Opcije lista|Prikaz")),
|
||||
] {
|
||||
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");
|
||||
}
|
||||
// Page Layout › Sheet Options: the Gridlines and Headings "View" checkboxes had the same
|
||||
// prefix. The View tab may share the word, so count at least the two checkboxes.
|
||||
h.state_mut().run("ui.backstage", serde_json::json!({"page": "close"})).unwrap();
|
||||
h.state_mut().ui.ribbon_tab = "Page Layout".into();
|
||||
h.run_steps(3);
|
||||
assert!(h.query_by_label(view_prefixed).is_none(), "{code}: {view_prefixed} shows its context");
|
||||
assert!(h.query_all_by_label(view).count() >= 2, "{code}: the Sheet Options checkboxes don't read {view}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn export_as_pdf_is_delivered_as_a_download() {
|
||||
let files = Arc::new(Mutex::new(Vec::<(String, Vec<u8>)>::new()));
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# File-format parity
|
||||
|
||||
> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-19 · **Change:** minor (.xls dialog sheets are skipped instead of read as worksheets; `.xls` import reads each sheet's display options from WINDOW2: right-to-left, gridlines, headings, zeros, formulas; XLSX text boxes and shapes keep their paragraphs' right-to-left direction on save; CSV/TSV/TXT can open with every field kept as text via `file.open {csvAsText}`; formulas over Excel's 8,192 characters, and `%` or call chains past the nesting limit, are parse errors instead of stack overflows when a file is opened; XLSX PivotTables read and write `rowGrandTotals`/`colGrandTotals` the way Excel does, so a table saved with only one grand total opens with the right one) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4
|
||||
> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-19 · **Change:** minor (HTML export keeps right-to-left) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4
|
||||
> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-19 · **Change:** minor (.xls dialog sheets are skipped instead of read as worksheets; `.xls` import reads each sheet's display options from WINDOW2: right-to-left, gridlines, headings, zeros, formulas; XLSX text boxes and shapes keep their paragraphs' right-to-left direction on save; CSV/TSV/TXT can open with every field kept as text via `file.open {csvAsText}`; formulas over Excel's 8,192 characters, and `%` or call chains past the nesting limit, are parse errors instead of stack overflows when a file is opened; XLSX PivotTables read and write `rowGrandTotals`/`colGrandTotals` the way Excel does, so a table saved with only one grand total opens with the right one; HTML export keeps right-to-left) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4
|
||||
|
||||
Every format Excel opens or saves, with GridCraft's read and write support, fidelity and tests.
|
||||
Part of [target-app-parity.md](target-app-parity.md). **File formats: ~50% ready, 80–120 h**
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# Localization parity
|
||||
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-19 · **Change:** minor (defined-name length limit counts characters, so long Arabic names are accepted; Table names are limited to 255 characters; right-to-left sheets in `.xls` files open right-to-left; text boxes and shapes keep right-to-left paragraph direction through XLSX save) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-19 · **Change:** minor (Save as Web Page and copied HTML keep right-to-left) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-19 · **Change:** minor (defined-name length limit counts characters, so long Arabic names are accepted; Table names are limited to 255 characters; right-to-left sheets in `.xls` files open right-to-left; text boxes and shapes keep right-to-left paragraph direction through XLSX save; Save as Web Page and copied HTML keep right-to-left; 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,
|
||||
@@ -89,6 +88,7 @@ language (none so far) and of localized function names.
|
||||
| 2026-10-19 | minor | Right-to-left sheets in legacy `.xls` files (common in older Arabic workbooks) open right-to-left |
|
||||
| 2026-10-19 | trivial | Text boxes and shapes keep right-to-left paragraph direction (`a:pPr rtl`) on XLSX save, so Excel-authored Arabic and Hebrew text boxes reopen right to left |
|
||||
| 2026-10-19 | minor | Save as Web Page and copied HTML mark right-to-left sheets `dir="rtl"`, let General-aligned Arabic and Hebrew text align by its own direction (`dir="auto"`), and keep numbers on right-to-left sheets left to right and on the left |
|
||||
| 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 |
|
||||
|
||||
Reference in New Issue
Block a user