feat(i18n): One-Click, Any-Language (#59)#76
Open
ASR1015 wants to merge 1 commit intoAqsa4066:mainfrom
Open
Conversation
Author
|
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. |
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.
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.