Skip to content

i18n: add localization infrastructure with Italian translation and fix Tab focus navigation - #272

Open
SamueleFederici02 wants to merge 5 commits into
storytold:mainfrom
SamueleFederici02:i18n-foundation
Open

SamueleFederici02 wants to merge 5 commits into
storytold:mainfrom
SamueleFederici02:i18n-foundation

Conversation

@SamueleFederici02

Copy link
Copy Markdown

This PR introduces the localization infrastructure for DeckCraft with an Italian translation catalog, and fixes an input issue where pressing Tab during slide text editing broke subsequent keystrokes.

Key Changes

  • i18n Foundation:
    • Implemented Catalog parser and lookup in crates/ui-egui/src/i18n/.
    • Added comprehensive Italian translation catalog (crates/ui-egui/src/i18n/it.tsv) covering the ribbon tabs, buttons, dialogs, status bar, and start screen.
    • Added language selector directly to the Home/Start screen and clickable language toggle on the bottom status bar.
    • Translated unsaved changes confirmation dialog (Quit dialog).
  • Editor Tab Input Fix:
    • Switched from ctx.memory(|m| m.focused().is_some()) to ctx.text_edit_focused() in SlideApp::keyboard().
    • Cleared egui focus direction when slide editing is active so Tab inserts indentation/tab characters without stealing focus to UI buttons.
    • Added automated integration regression test ab_during_text_edit_does_not_break_typing.

@SamueleFederici02 SamueleFederici02 changed the title i18n: add Italian localization foundation and fix Tab focus navigation i18n: add localization infrastructure with Italian translation and fix Tab focus navigation Oct 12, 2026
anishguduru pushed a commit to anishguduru/deckcraft that referenced this pull request Oct 16, 2026
macOS DMG: branded window background and icon layout
@ticket-craft ticket-craft Bot mentioned this pull request Oct 26, 2026

@FredApps FredApps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ReviewerA — source-read COMMENT (not an approval)

I read the head of the diff: localisation infrastructure with an Italian translation, and a fix for Tab focus navigation. The lock gains sys-locale 0.3.2, the same crate that deckcraft#555, #543, #548, #575, #579, #538 and #66 add, so this PR is the natural base for the language mechanism that the other language PRs should be stacked on, and the maintainers should pick which one introduces it. Two changes in one title (localisation and Tab focus) should be two PRs, since the focus fix is useful on its own. The Italian catalogue needs a native check against PowerPoint's Italian terms and a statement of who translated it and whether a tool helped. I read the lock hunk and the title. I have not run it, and no exact-head CI result exists for this head. Nothing was run.

I ran nothing and have no exact-head CI result for this PR, so this is not an approval. Where a diff was long I read its code hunks rather than every generated or documentation line.

Status: waiting_author.

@aiongg aiongg added the bugfix Fixes something that is broken: wrong result, crash, data loss label Nov 4, 2026

@aiongg aiongg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI-generated review (Opus). Not a maintainer decision.

Changes needed:

Adds a TSV catalog with lookup, an Italian translation and a language setting, and changes how keyboard focus is handled while slide text is edited. The catalog parser is careful (it validates placeholders and ellipses and reports duplicates), but the focus change and the status bar change need rework.

  • crates/ui-egui/src/lib.rs:618-623 clears egui focus every frame whenever a document is open and no dialog or palette is shown. It does not check that slide text is being edited, so keyboard navigation of ribbon buttons, checkboxes and combo boxes stops working.
  • Because of the switch to text_edit_focused() at crates/ui-egui/src/lib.rs:615, slide key handling now also runs while a non-text widget has focus, so keys meant for that widget also reach the slide.
  • The status bar language label (crates/ui-egui/src/status.rs) now shows the interface language and opens Preferences. That label is meant to show the selection's proofing language and open the Language dialog.
  • crates/ui-egui/src/textures.rs:77-83: the canvas cache key does not include the interface language, so placeholder prompts stay in the old language after a switch until the slide is re-rendered.
  • Some English labels change along the way: the Reflection entry 'Tight' becomes 'Tight Reflection' (ribbon.rs effects_menu), 'Width: ' becomes 'Width:', and the title bar now builds its text from the file path's stem (ribbon.rs title_bar). These belong in a separate change, if they are wanted at all.
  • Many catalog rows (table, zoom, header/footer, hyperlink and other dialog labels) are never looked up, because those dialog bodies do not call t().
  • The PR covers two separate topics, localization and Tab focus. Each would be easier to review and land on its own.
  • crates/ui-egui/src/i18n/it.tsv: say where the Italian translations come from and whether a native speaker has reviewed them.

Claims checked:

  • verified: Implements a catalog parser and lookup in crates/ui-egui/src/i18n/ (crates/ui-egui/src/i18n/catalog.rs:83-122 parses lines, validates contexts, placeholders and ellipses, and reports duplicates; crates/ui-egui/src/i18n/mod.rs:143-157 implements t/tr/tc/trc with English fallback)
  • contradicted: The Italian catalog covers the ribbon tabs, buttons, dialogs, status bar and start screen (The ribbon tabs (ribbon.rs show), status bar (status.rs) and start screen (dialogs.rs start_screen) are wrapped. Of the dialogs, only the shared OK/Cancel buttons, the quit prompt and Preferences call t() (di…
  • contradicted: Adds a language selector to the start screen and a clickable language toggle to the status bar (The start screen combo box is at crates/ui-egui/src/dialogs.rs:883-908. The status bar change at crates/ui-egui/src/status.rs:28-35 replaces the proofing-language label with the interface language name a…
  • verified: Translates the unsaved-changes (quit) dialog (crates/ui-egui/src/dialogs.rs:267-297 wraps the question, the warning and the Don't Save/Save/Cancel buttons in t()/fmt(), with matching rows in it.tsv)
  • verified: SlideApp::keyboard() uses ctx.text_edit_focused() instead of checking for any focused widget (crates/ui-egui/src/lib.rs:615)
  • contradicted: Clears egui focus direction only while slide editing is active, so Tab indents without moving focus to UI buttons (crates/ui-egui/src/lib.rs:618-623: the condition is only an active document, no dialog and no palette. It never checks selection.text, and it calls stop_text_input every frame, which r…
  • verified: Adds the regression test tab_during_text_edit_does_not_break_typing (crates/ui-egui/src/lib.rs:953-982)
  • contradicted: The change is localization only, with English behaviour unchanged (implied by the i18n scope) (crates/ui-egui/src/ribbon.rs effects_menu renames the English 'Tight' to 'Tight Reflection'; ribbon.rs title_bar now derives the title from the path's file stem; size_group changes 'Width: ' to 'Width:')

Recommendation: update the pull request; it will be reviewed again.

Reviewed at bb45215.

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

bugfix Fixes something that is broken: wrong result, crash, data loss

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants