Repository navigation
Move texts to Paraglide JS; Rust reads the same message files - #1
Merged
Merged
Conversation
As in quadeck and haul: the texts move from src/lib/i18n/{de,en}.ts to
messages/{de,en}.json, compiled by Paraglide to typed message functions.
- Frontend: t("gameForm.tabCount", { count }) becomes
m.gameForm_tabCount({ count }); ids chosen at runtime (wine tools,
Proton options, winetricks verbs, MangoHud presets and colours) go
through pickMsg(msgGroup.x, id). The language stays a $state that
Paraglide reads on every call, so switching still re-renders every text
without a reload.
- Backend errors stay structured (AppError → { code, ...fields }); the
frontend shows backendErrors_<code> with the fields as placeholders.
- Rust's own texts (tray menu, quit dialog, root and config dialogs,
headless launch failure) and AppError::localized() now read the same
messages/*.json, built into the binary (locale::text). The second copy
of every backend error text in error.rs is gone.
- Tests: vitest checks that both languages have the same keys and
placeholders, none empty, every message used (UI and Rust), every used
key exists; cargo test checks that every AppError variant has its
message with its fields as placeholders. CI runs the new test step.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014W49icb7XZqhYXUBc1UjzL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This moves prefixr's texts to Paraglide JS, as already done in quadeck and haul. They move from
src/lib/i18n/{de,en}.tstomessages/{de,en}.jsonand are compiled into typed message functions. Rust now reads the same two files, so every text exists only once.Changes
t("gameForm.tabCount", { count })becomesm.gameForm_tabCount({ count }). This covers all 419 texts, and the placeholders keep their names.pickMsg(msgGroup.x, id): wine tools, Proton options, winetricks verbs, MangoHud presets and colours.$state, and Paraglide reads it on every call, so switching re-renders every text without a reload. I checked this in the browser: after a click on "EN", the navigation and content were English straight away.AppErroris sent as{ code, ...fields }, and the frontend showsbackendErrors_<code>with the fields as placeholders.messages/*.json, built into the binary (locale::text). That covers:AppError::localized(), so the second copy of every backend error text inerror.rsis gone.@inlang/paraglide-js,@inlang/plugin-message-format,vitest, and@types/node, which Paraglide's generated files need for svelte-check. With@types/nodein place, the@ts-expect-errorinvite.config.jswas no longer needed and is removed.Tests
bun run test, new CI step), intests/i18n.test.ts:AppErrorvariant has itsbackendErrors_<code>message, with the variant's fields as placeholders;AppError::localizedandlocale::textrender correctly.Checks run:
bun install --frozen-lockfile✅bun run check: 0 errors ✅bun run test✅cargo test --locked: 129 passed ✅bun run build✅🤖 Generated with Claude Code
https://claude.ai/code/session_014W49icb7XZqhYXUBc1UjzL
Generated by Claude Code