Skip to content

feat(i18n): add internationalization support for puzzle text and UI s…#38

Open
ebubeb683-ship-it wants to merge 1 commit into
ThinknetCollective:mainfrom
ebubeb683-ship-it:feat/i18n-support-puzzle-strings
Open

feat(i18n): add internationalization support for puzzle text and UI s…#38
ebubeb683-ship-it wants to merge 1 commit into
ThinknetCollective:mainfrom
ebubeb683-ship-it:feat/i18n-support-puzzle-strings

Conversation

@ebubeb683-ship-it

Copy link
Copy Markdown

Closes #31 This PR adds internationalization (i18n) support for puzzle text, CLI prompts, hints, error messages, and TUI labels using Mozilla Fluent (fluent-bundle). User-facing strings have been extracted out of application logic into declarative Fluent .ftl resource files under contracts/puzzle/locales/.
Key Changes
String Management Integration:
Integrated fluent-bundle and unic-langid in the mesh-puzzle crate.
Built I18nManager in  to handle resource bundle loading, message lookup, parameter interpolation, and fallback resolution.
Extracted Fluent Resource Files:
Added  containing English UI labels, prompts, hints, and error/success messages.
Added working example translations for French in  and Spanish in .
CLI --lang  Selection & Fallback:
Added --lang  and --lang= CLI flag parsing in .
If a requested locale is missing or a specific key is untranslated, the system automatically falls back to English (en).
Contributor Guidelines:
Updated  with step-by-step instructions on how contributors can add new language files under locales/ without modifying core logic.
Unit & Integration Tests:
Added comprehensive tests in  covering default locale selection, language switching, missing key and locale fallback, parameter interpolation, and flag parsing.
How to Test
bash

Run CLI with default English locale

cargo run -p mesh-puzzle

Run CLI with French locale

cargo run -p mesh-puzzle -- --lang fr

Run CLI with Spanish locale

cargo run -p mesh-puzzle -- --lang es

Run unit tests

cargo test -p mesh-puzzle

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.

Title: Add internationalization (i18n) support for puzzle text and UI strings

1 participant