Add internationalization - #232
Merged
Merged
Conversation
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.
Close #198
Summary of the issue
The project lacked full internationalization (i18n) support, making it inaccessible to non-English speakers. The task required configuring language detection, extracting user-facing strings, updating the language switcher, supporting RTL layouts for Arabic and Hebrew, providing initial translations, and documenting the process.
Root cause
The application was primarily rendering hard-coded English text in components like the
LanguageSwitcher. Additionally, Next.js locale detection was explicitly disabled (localeDetection: false) innext.config.js, Hebrew (he) was missing from thenext-i18next.config.jsand switcher definitions, and there was no developer documentation on how to add new languages.Solution implemented
Enabled Next.js's built-in locale detection, integrated missing languages into the configuration, extracted hard-coded strings in the
LanguageSwitcherto utilizenext-i18next's translation hook, mapped missing RTL language rules, added comprehensive translations for the switcher across all configured languages, and documented the process for future expansions.Key changes made
next.config.js: Enabled automatic language detection (localeDetection: true).next-i18next.config.js: Added Hebrew (he) to the supported locales list.src/components/LanguageSwitcher.tsx: Extracted hardcoded texts (e.g. "Select Your Language", "Search languages...") and replaced them witht()calls fromuseTranslation. Added Hebrew to the languages array withrtl: true.public/locales/**/common.json: AddedlanguageSwitchertranslation objects in English (en), Spanish (es), French (fr), Chinese (zh), and Arabic (ar). Created a new directory for Hebrew (he) and added initial translations.README.md: Added an "Internationalization (i18n)" section outlining the standard 4-step process to add new languages.Any trade-offs or considerations
LanguageSwitcherto establish a clear pattern for the rest of the application. Extracting every single string in a massive application all at once could introduce merge conflicts with other feature branches; this establishes the architecture and implements it for the core shell component.Testing steps (how to verify the fix)
npm run devand navigate tohttp://localhost:3000.Please kindly review this task. If there are any corrections, improvements, adjustments, or merge conflicts that you notice regarding my implementation, I'd really appreciate your feedback. I'd also love to hear your overall review of my work on this branch.Thank you!