Skip to content

feat(frontend): implement comprehensive multi-language support (REQ-0018)#27

Merged
Martinay merged 4 commits intomainfrom
feature/REQ-0018-language-support
Mar 31, 2026
Merged

feat(frontend): implement comprehensive multi-language support (REQ-0018)#27
Martinay merged 4 commits intomainfrom
feature/REQ-0018-language-support

Conversation

@Martinay
Copy link
Copy Markdown
Owner

Objective

Implemented comprehensive language support for the application fulfilling REQ-0018.

Changes Made

  • i18next Setup: Hooked up i18next-http-backend and i18next-browser-languagedetector allowing native dynamic translations for 21 new languages without increasing bundle weight.
  • Component Integration: Introduced a smooth <LanguageSwitcher /> component gracefully integrated via Suspense and placed into the LandingPage and ListPage.
  • RTL Layouts: Added conditional document.documentElement.dir = 'rtl' based on the selected language, establishing layout stability for Arabic.
  • Localization Files: Automatically seeded translating JSON files for all matching 21 codes.
  • E2E Stability: Achieved 100% test pass-rate spanning Core functionality, Webdriver headless detection resolution logic (--accept-lang Chrome pref mocking), UI behavior stability, and refactored older brittle E2E bindings replacing textual .click() with standard DOM data-testid strategies.

Note: E2E Tests verify UI locale states consistently.

@Martinay
Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@Martinay
Copy link
Copy Markdown
Owner Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: daf39231bc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

import fs from "fs";
import path from "path";

const sourcePath = path.join(process.cwd(), "src/i18n/locales/en.json");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Point locale generator at an existing source file

The locale setup script now reads from src/i18n/locales/en.json, but that file was removed in this same change, so running node scripts/setup-locales.js crashes with ENOENT before generating any locale files. This breaks the maintenance workflow for regenerating/updating translations and should be switched to a path that still exists (for example the committed English translation under public/locales/en/translation.json) or by restoring the source file.

Useful? React with 👍 / 👎.

Comment on lines +10 to +12
.init({
fallbackLng: 'en',
supportedLngs: ['en', 'ar', 'hi', 'es', 'fr', 'bn', 'pt', 'id', 'ru', 'de', 'ja', 'tr', 'vi', 'it', 'pl', 'uk', 'nl', 'el', 'hu', 'sv', 'cs'],
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restrict i18next loading to language-only locale codes

This init block enables browser locale detection but leaves i18next at its default load: 'all' behavior; for common regional locales like en-US/pt-BR, i18next will try /locales/<region>/translation.json before falling back to /locales/<base>/translation.json. Since only base-language folders are shipped, each affected startup incurs a guaranteed missing-locale request (and can lengthen the Suspense loading state). Add load: 'languageOnly' (or provide regional files) to avoid the repeated misses.

Useful? React with 👍 / 👎.

@martinay-openclaw
Copy link
Copy Markdown
Collaborator

Addressed the review feedback in commit a6546ae:\n\n1) now reads from (existing source), so locale regeneration no longer fails with ENOENT.\n2) now sets to prevent unnecessary regional-locale fetch misses (e.g. , ).\n\nI also re-ran successfully.

@martinay-openclaw
Copy link
Copy Markdown
Collaborator

Follow-up (clean summary): fixed both review points in commit a6546ae.

  • setup-locales source now uses frontend/public/locales/en/translation.json (existing file).
  • i18next config now includes load: languageOnly to avoid regional-locale miss requests.
  • Locale generation script was re-run successfully in frontend.

@Martinay Martinay merged commit 0942272 into main Mar 31, 2026
6 checks passed
@Martinay Martinay deleted the feature/REQ-0018-language-support branch March 31, 2026 04:46
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