feat(i18n): add Korean (ko) translation#1592
Conversation
Adds a complete Korean locale (surfsense_web/messages/ko.json) with full key parity with en.json, and wires ko into every place locales are currently enumerated: next-intl routing config, the client-side locale context/loader, and the two language-switcher UIs (main app + sidebar user profile).
|
@moduvoice is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughKorean ( ChangesKorean locale support
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant LanguageSwitcher
participant LocaleContext
participant KoreanMessages
User->>LanguageSwitcher: Select Korean
LanguageSwitcher->>LocaleContext: Set locale to ko
LocaleContext->>KoreanMessages: Load ko.json
KoreanMessages-->>LocaleContext: Return Korean translations
LocaleContext-->>User: Render Korean interface
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
surfsense_web/components/LanguageSwitcher.tsx (1)
28-37: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider importing the
Localetype instead of duplicating the union.The
handleLanguageChangefunction castsnewLocaleto"en" | "es" | "pt" | "hi" | "zh" | "ko", which duplicates theLocaletype defined inLocaleContext.tsx. If a new locale is added in the future, both places must be updated independently. Importing and using theLocaletype directly would eliminate this maintenance risk.This same pattern appears in
SidebarUserProfile.tsxline 161.♻️ Proposed refactor
- const handleLanguageChange = (newLocale: string) => { - setLocale(newLocale as "en" | "es" | "pt" | "hi" | "zh" | "ko"); - }; + const handleLanguageChange = (newLocale: string) => { + setLocale(newLocale as Locale); + };This requires exporting
LocalefromLocaleContext.tsx(if not already exported) and importing it here.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@surfsense_web/components/LanguageSwitcher.tsx` around lines 28 - 37, Export the Locale type from LocaleContext.tsx if necessary, then import and use it in LanguageSwitcher’s handleLanguageChange instead of duplicating the locale union. Apply the same refactor to SidebarUserProfile’s corresponding locale cast so both components share the centralized type.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@surfsense_web/components/LanguageSwitcher.tsx`:
- Around line 28-37: Export the Locale type from LocaleContext.tsx if necessary,
then import and use it in LanguageSwitcher’s handleLanguageChange instead of
duplicating the locale union. Apply the same refactor to SidebarUserProfile’s
corresponding locale cast so both components share the centralized type.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 386bf124-9ba8-411e-b028-99254d761f88
📒 Files selected for processing (5)
surfsense_web/components/LanguageSwitcher.tsxsurfsense_web/components/layout/ui/sidebar/SidebarUserProfile.tsxsurfsense_web/contexts/LocaleContext.tsxsurfsense_web/i18n/routing.tssurfsense_web/messages/ko.json
|
@moduvoice Thanks appreciate it but can you reraise this PR on |
|
Done — retargeted this PR to |
Motivation
This adds Korean (
ko) translation support — to help Korean-speaking users use thisopen-source project more comfortably in their own language.
(한국 사람들의 오픈소스 이용에 도움이 되게 하기 위해서 한글화 작업을 하였습니다.)
Changes
surfsense_web/messages/ko.json— a full Korean translation with 1:1 key parity againsten.json(761 leaf keys), preserving all ICU placeholders ({count},{name},{provider}, etc.).koinsurfsense_web/i18n/routing.ts'slocalesarray (next-intl routing config).koinsurfsense_web/contexts/LocaleContext.tsx(the client-side locale loader that actually feedsNextIntlClientProviderinside the app) — added to theLocaletype, the dynamicloadMessagesswitch, and the stored-locale validation list.한국어/ 🇰🇷) option to both language-switcher UIs:surfsense_web/components/LanguageSwitcher.tsxandsurfsense_web/components/layout/ui/sidebar/SidebarUserProfile.tsx, so the new locale is actually selectable, not just present in the JSON.Testing
en.jsonandko.json(0 missing, 0 extra keys) and that every ICU placeholder variable name ({count},{provider}, etc.) matches between the two files.biome checkon all changed/added files — no issues.tsc --noEmitbefore and after the change: identical pre-existing error count (37, all unrelated to i18n — e.g. azh.jsonkey gap and unrelated type issues elsewhere in the codebase).next build(production build) successfully with the new locale wired in.High-level PR Summary
This PR adds complete Korean (
ko) language support to the SurfSense web application. It introduces a comprehensive Korean translation file with 761 keys matching the English version, registers the new locale across the i18n routing configuration and locale context, and adds Korean as a selectable option in both language switcher components. The translation maintains 1:1 key parity withen.jsonand preserves all ICU placeholder variables for dynamic content.⏱️ Estimated Review Time: 30-90 minutes
💡 Review Order Suggestion
surfsense_web/messages/ko.jsonsurfsense_web/i18n/routing.tssurfsense_web/contexts/LocaleContext.tsxsurfsense_web/components/LanguageSwitcher.tsxsurfsense_web/components/layout/ui/sidebar/SidebarUserProfile.tsxSummary by CodeRabbit