Skip to content

Common: make console dump headings translatable#124

Open
JumpLink wants to merge 1 commit into
fix/118-message-format-placeholdersfrom
fix/122-translatable-console-headings
Open

Common: make console dump headings translatable#124
JumpLink wants to merge 1 commit into
fix/118-message-format-placeholdersfrom
fix/122-translatable-console-headings

Conversation

@JumpLink

Copy link
Copy Markdown
Owner

Fixes #122

Stacked on #123 (the Android path needs the printf-param substitution introduced there). Merge #123 first, then change this PR's base back to main.

Problem

game-console-event-bridge.ts concatenated the hard-coded strings "Hexdump:\n" / "Disassembly:\n" with the dump content. The heading could never be translated: the GNOME app translates console messages by looking up the whole message via gettext, and a string with dynamic content never matches a msgid. So the English "Hexdump:" heading appeared in the GNOME message console regardless of locale.

Fix

The bridge now dispatches the static msgids "Hexdump:\n%s" / "Disassembly:\n%s" with the dump content as printf parameter:

  • gettext lookup succeeds (static msgid), the content is substituted by each platform's formatAndLog — GNOME via String.format, Android via localize()/vsprintf.
  • common-ui was added to the xgettext source globs so its strings get extracted; the pseudo-_() marker from @learn6502/6502 keeps the package platform-independent.
  • The new msgstrs were seeded from the existing "Hexdump" / "Disassembled" section-heading translations in all 15 languages (translators can refine via Weblate). All .po files validated with msgfmt --check.

Note: the disassembly event currently never carries a message (only data), so that branch is inactive at runtime — it was fixed consistently anyway.

Verification

  • GJS smoke test: "Hexdump:\n%s".format("0600: a9 01 …") renders heading + content correctly.
  • Android i18n JSONs regenerate with correct %s-containing translations (e.g. he: "Hexdump:\n%s": "חילוץ הקסדצימלי:\n%s").
  • yarn format, yarn check:format, yarn build pass; common-ui type check passes.

The game console event bridge concatenated the hard-coded strings
"Hexdump:\n" and "Disassembly:\n" with the dump content, so the
heading could never be translated: the GNOME app looks the whole
message up via gettext, which fails for strings with dynamic parts.

Dispatch the static msgids "Hexdump:\n%s" / "Disassembly:\n%s" with
the dump content as printf param instead, so every platform's
formatAndLog can translate the heading and substitute the content.

Add common-ui to the xgettext sources and seed the new msgstrs from
the existing "Hexdump" / "Disassembled" heading translations.

Fixes #122
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.

1 participant