Skip to content

feat(i18n): One-Click, Any-Language (#59)#76

Open
ASR1015 wants to merge 1 commit intoAqsa4066:mainfrom
ASR1015:feat/i18n-one-click
Open

feat(i18n): One-Click, Any-Language (#59)#76
ASR1015 wants to merge 1 commit intoAqsa4066:mainfrom
ASR1015:feat/i18n-one-click

Conversation

@ASR1015
Copy link

@ASR1015 ASR1015 commented Aug 30, 2025

Implements “One Click, Any Language” for the site using i18next + react-i18next. Adds a single 🌐 button that cycles languages and persists choice. Includes RTL support for Arabic.

What’s included
• i18n setup (i18next, react-i18next, i18next-browser-languagedetector, i18next-http-backend)
• Language resources under public/locales/{en,hi,es,ar}/translation.json
• Browser language detection + persistence (localStorage)
• One-click language switcher component in the header
• Automatic RTL via when Arabic is active
• Translated header + hero strings (app., landing. keys)
• Root index.html wired for Vite + site CSS, default dark theme for contrast

Implementation notes
• pages/i18n.js initializes i18n with backend loader (/locales/{{lng}}/translation.json) and supported languages: en, hi, es, ar.
• pages/components/LanguageSwitcher.jsx cycles languages and toggles RTL by setting document.documentElement.dir.
• pages/App.jsx consumes t() for visible strings and includes a theme toggle (persists to localStorage).

Screenshots / Demo
• EN, HI, ES, AR (with RTL) verified locally via npm run dev.

How to test
1. npm i
2. npm run dev
3. Click 🌐 to cycle EN → HI → ES → AR.
4. Refresh: language persists.
5. Switch to AR: layout flips to RTL; text appears in Arabic.
6. Optional: open in a fresh/incognito window to see browser-language auto-detection.

Checklist
• One-click language toggle
• i18n resources loaded from /public/locales
• Browser detection + persistence
• RTL support for Arabic
• No breaking changes to existing styles / behavior

Future work (follow-ups welcome)
• Translate remaining sections (FAQ, footer, login/signup) by replacing hardcoded strings with t("...").
• Add a dropdown selector as an alternative to the cycling button (if desired).
• Add unit tests around language persistence.

@ASR1015
Copy link
Author

ASR1015 commented Aug 30, 2025

Hi, the multilingual toggle is ready with EN/HI/ES/AR (with RTL for Arabic). Please review and let me know if more sections need translations.

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.

1 participant