Skip to content

Add i18n support with French as first translation#5

Open
Victor-root wants to merge 1 commit intoaverygan:mainfrom
Victor-root:claude/add-i18n-french-Zf2FQ
Open

Add i18n support with French as first translation#5
Victor-root wants to merge 1 commit intoaverygan:mainfrom
Victor-root:claude/add-i18n-french-Zf2FQ

Conversation

@Victor-root
Copy link
Copy Markdown

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

  • added a new i18n.py module to load translations and resolve the active language
  • added translations/en.json as the default string catalog
  • added translations/fr.json as the first complete translation
  • replaced hardcoded UI strings in templates and JavaScript with translation keys
  • routed backend user-facing messages through the translation layer
  • documented how translations work and how to add a new language in the README

Language selection

The active language can be set with RECLIP_LANG=<code>.
If not set, the app falls back to the Accept-Language header 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.json to translations/<code>.json and translate the values.

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
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.

2 participants