Skip to content

i18n: dialogs follow the interface language; Spanish dialogs - #669

Open
manucarcor wants to merge 2 commits into
storytold:mainfrom
manucarcor:i18n/es-dialogs
Open

manucarcor wants to merge 2 commits into
storytold:mainfrom
manucarcor:i18n/es-dialogs

Conversation

@manucarcor

Copy link
Copy Markdown

Dialogs ignored the interface language: with Español selected, the ribbon was Spanish but Format Cells, Find and Replace, Sort, Name Manager, Data Analysis, Solver and the rest stayed English. This PR makes every dialog follow the interface language and adds the full set of Spanish dialog strings.

What changes

  • Dialogs translate when drawn. Dialog still holds English titles, tabs, field labels and options, because the control channel (ui.dialog, ui.dialog.set) and the existing tests use them as ids. They are translated at draw time through a local tr(ui, …) helper. It uses the same i18n::current(ctx) pattern as widgets.rs. This covers form dialogs, through form_fields and ok_cancel, and every custom body: Format Cells, Insert Function, Find and Replace, Go To, Sort, Name Manager, Recommended Charts, Select Data, Conditional Formatting Rules Manager, Search Commands, Goal Seek, Data Analysis, Solver and Solver Results, Spelling, About, Macros, Agent Control, Insert Picture, Save a Copy, Save Changes and Start.
  • Message boxes translate their title, text and OK button.
  • Text that includes workbook data uses {placeholder} keys, such as "Do you want to save the changes you made to {title}?", following the "Page {page} of {pages}" precedent in backstage.rs. Notes built in Dialog::open use app.ui.language.
  • Insert Function categories now read "Date & Time", "Math & Trig", "Lookup & Reference" instead of the enum names DateTime / MathTrig. This also improves English.
  • Spanish (i18n/es.rs): about 380 new entries in Excel's Spanish wording, 764 in total (about 35% of the ~2,200 strings). The Format Cells Fill tab uses a Format Cells|Fill key ("Relleno"), because the ribbon's "Fill" is the verb "Rellenar".
  • Language::translation exposes the catalog lookup as an Option, so tests can tell "translated" from "fell back to English". tr now uses it.
  • Other languages are unchanged until their catalogs add the new keys: missing strings still fall back to English one by one.
  • Docs: ROADMAP.md and docs/localization-parity.md re-measure Spanish. It was listed as 0% / none.
  • contributors/people.toml: adds my own entry only.

Tests

  • dialogs::tests::spanish_translates_every_dialog_string checks that Spanish has an entry for every dialog string. It scans dialogs.rs for tr(…, "…") / lang.tr("…") literals, then opens every form and custom dialog and checks each title, field label and option, plus the Analysis ToolPak tools, the All Charts list and the sample workbook names.
  • dialogs::tests::placeholders_survive_translation checks that every {name} in a key is kept in its translation.
  • dialogs::tests::dialog_ids_stay_english_in_other_languages checks that titles and tabs stay English inside Dialog.
  • tests/interaction.rs::dialogs_draw_in_the_interface_language (kittest) draws Find and Replace, Format Cells and Insert in Spanish, checks the labels, and checks that a translated option still sets the same value.
  • English output is unchanged: the existing tests that query " OK ", " Cancel ", "New…" and other labels still pass.

cargo xtask ci: fmt, clippy, assets, layers, wasm, parity and keytips pass. cargo test --workspace has 3 failures, and all 3 also fail on main (b3acae6) without this change:

All other gridcraft-ui-egui tests pass, including the 26 in interaction.rs.

Checked by eye in an offscreen snapshot (--language es) and in a Windows build: the ribbon, Format Cells, and Find and Replace show in Spanish.

Not in this PR

Dialogs kept English chrome in every interface language. Titles, tabs,
field labels and options stay English in `Dialog` (they are ids for the
control channel and tests) and are now translated when drawn, through a
`tr` helper like the ribbon widgets'. Message boxes translate too.

- dialogs.rs: every dialog (forms and custom bodies: Format Cells, Find
  and Replace, Sort, Name Manager, charts, Goal Seek, Data Analysis,
  Solver, Spelling, About, Macros, Save Changes…) draws through `tr`;
  text with workbook data uses `{placeholder}` keys. Insert Function
  shows readable categories ("Date & Time", not `DateTime`).
- i18n/es.rs: ~380 Spanish entries in Excel's Spanish wording (764 total).
- i18n.rs: `Language::translation` exposes catalog lookups for tests.
- Tests: every dialog string has a Spanish entry (source scan plus every
  form dialog opened), placeholders survive translation, ids stay
  English, and a kittest draws Find and Replace, Format Cells and Insert
  in Spanish.
- Docs: ROADMAP and localization-parity re-measure Spanish (~35%).
- contributors/people.toml: my own entry.
h-a-n-a-s-h-i pushed a commit that referenced this pull request Oct 13, 2026
Brazilian Portuguese had 377 catalog entries, so most dialogs, menus and
tooltips showed in English with the interface set to Português (Brasil).
This adds every key the other catalogs translate (counting the open
Spanish-dialog #669, Russian #676, Czech #652, Polish #650, Turkish #663
and Italian #713 PRs), bringing pt-BR to 923 entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@FredApps FredApps left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested. I reviewed the description, discussion and file list at 50e349b. There are no hosted checks on this head, and no tests were run locally (builds are paused), so nothing here was validated beyond reading.

  1. Clean-room. The description says the new Spanish entries are "in Excel's Spanish wording". AGENTS.md says to never copy vendor wording beyond feature names, and the other language PRs state that their tables were written from the meaning of the English labels. Please confirm that the roughly 380 new entries in i18n/es.rs were written from the English text and not taken from Microsoft's Spanish strings, and reword the description accordingly. If they were taken from Excel, they need to be rewritten.
  2. Translations in each language. The PR routes every dialog string through the catalog but adds the new keys only to Spanish: "Other languages are unchanged until their catalogs add the new keys". The repo rule is that every new string needs a translation in each language, so please add them to the other catalogs (cs, de, fr, ko, pt, ru, sr, zh) in this PR, or limit the PR to a mechanism and state clearly which strings are new.
  3. English output does change, contrary to "English output is unchanged": the Insert Function categories now read "Date & Time", "Math & Trig", "Lookup & Reference" instead of the enum names DateTime / MathTrig. That is a separate visible change and should be its own PR, or at least be called out as one with a test of the English text.
  4. Mixed in: Language::translation (a new lookup API), the Spanish catalog growth, the dialog rewrites in dialogs.rs, ROADMAP and parity docs, and a contributor entry all travel together. The catalog content and the mechanism are easiest to review apart.

Please also get "cargo xtask ci" to run on the updated head.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants