Add i18n support with French as first translation#5
Open
Victor-root wants to merge 1 commit intoaverygan:mainfrom
Open
Add i18n support with French as first translation#5Victor-root wants to merge 1 commit intoaverygan:mainfrom
Victor-root wants to merge 1 commit intoaverygan:mainfrom
Conversation
Externalises all user-facing strings into JSON translation files and
wires them through a lightweight i18n module — no new runtime dependency.
Changes:
- i18n.py: new module — loads translations/*, detects language from
RECLIP_LANG env var > Accept-Language header > fallback "en"
- translations/en.json: full English string catalogue (40 keys)
- translations/fr.json: complete French translation
- app.py: error messages now go through t() per-request; passes
t and strings to render_template for Jinja2 and window.i18n
- templates/index.html: all hardcoded strings replaced with
{{ t('key') }} (HTML) and i18n['key'] (JavaScript)
- README.md: new Internationalisation section — how it works,
how to add a language, how to set the active language
To add a new language: copy translations/en.json to
translations/<code>.json and translate the values.
To activate: set RECLIP_LANG=<code> or rely on Accept-Language.
https://claude.ai/code/session_01CnYaYsLwoMGswQwsE5g3Kr
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 PR adds a lightweight internationalization layer and externalizes all user-facing strings into translation files.
English remains the default/fallback language. French is provided as the first additional translation and can be activated via RECLIP_LANG or Accept-Language detection.
What changed
i18n.pymodule to load translations and resolve the active languagetranslations/en.jsonas the default string catalogtranslations/fr.jsonas the first complete translationLanguage selection
The active language can be set with
RECLIP_LANG=<code>.If not set, the app falls back to the
Accept-Languageheader and then to English.Why
This makes the project easier to translate and allows additional languages to be added without changing application logic.
Adding a new language
To add another language, copy
translations/en.jsontotranslations/<code>.jsonand translate the values.