feat(i18n): add Korean (ko) translation#52
Conversation
Adds a complete Korean translation (929/929 keys, matching en.json's structure) and registers ko in the language switcher. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
@moduvoice is attempting to deploy a commit to the Projects Team on Vercel. A member of the Team first needs to authorize it. |
| const locales = [ | ||
| { code: "en", label: "English" }, | ||
| { code: "zh-CN", label: "中文" }, | ||
| { code: "ko", label: "한국어" }, | ||
| ] as const; |
There was a problem hiding this comment.
The trigger-button label is resolved via a growing ternary chain. Each new locale requires a code change here in addition to the
locales array. Since each locale entry already exists in that array, the label character can live there too, making the button render generically without any per-locale branching.
| const locales = [ | |
| { code: "en", label: "English" }, | |
| { code: "zh-CN", label: "中文" }, | |
| { code: "ko", label: "한국어" }, | |
| ] as const; | |
| const locales = [ | |
| { code: "en", label: "English", triggerLabel: "EN" }, | |
| { code: "zh-CN", label: "중文", triggerLabel: "中" }, | |
| { code: "ko", label: "한국어", triggerLabel: "한" }, | |
| ] as const; |
Prompt To Fix With AI
This is a comment left during a code review.
Path: client-next/src/components/language-switcher.tsx
Line: 13-17
Comment:
The trigger-button label is resolved via a growing ternary chain. Each new locale requires a code change here in addition to the `locales` array. Since each locale entry already exists in that array, the label character can live there too, making the button render generically without any per-locale branching.
```suggestion
const locales = [
{ code: "en", label: "English", triggerLabel: "EN" },
{ code: "zh-CN", label: "중文", triggerLabel: "中" },
{ code: "ko", label: "한국어", triggerLabel: "한" },
] as const;
```
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| <span className="text-xs font-medium"> | ||
| {currentLocale === "zh-CN" ? "中" : "EN"} | ||
| {currentLocale === "zh-CN" ? "中" : currentLocale === "ko" ? "한" : "EN"} | ||
| </span> |
There was a problem hiding this comment.
With a
triggerLabel field on each locale entry (see suggestion above on the array), the ternary can be replaced by a simple lookup, so the button automatically reflects whatever label is defined in the array without any additional code changes per locale.
| <span className="text-xs font-medium"> | |
| {currentLocale === "zh-CN" ? "中" : "EN"} | |
| {currentLocale === "zh-CN" ? "中" : currentLocale === "ko" ? "한" : "EN"} | |
| </span> | |
| <span className="text-xs font-medium"> | |
| {locales.find((l) => l.code === currentLocale)?.triggerLabel ?? "EN"} | |
| </span> |
Prompt To Fix With AI
This is a comment left during a code review.
Path: client-next/src/components/language-switcher.tsx
Line: 32-34
Comment:
With a `triggerLabel` field on each locale entry (see suggestion above on the array), the ternary can be replaced by a simple lookup, so the button automatically reflects whatever label is defined in the array without any additional code changes per locale.
```suggestion
<span className="text-xs font-medium">
{locales.find((l) => l.code === currentLocale)?.triggerLabel ?? "EN"}
</span>
```
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Motivation
This adds Korean (
ko) translation support — to help Korean-speaking users use thisopen-source project more comfortably in their own language.
(한국 사람들의 오픈소스 이용에 도움이 되게 하기 위해서 한글화 작업을 하였습니다.)
Changes
client-next/messages/ko.json— a complete Korean translation mirroring the exact key structure ofclient-next/messages/en.json(929/929 keys, same nesting as the existingzh-CN.json).koinclient-next/src/components/language-switcher.tsx: added{ code: "ko", label: "한국어" }to thelocaleslist, and added a"한"label for the switcher trigger button.Testing
en.jsonandko.json: 929/929 keys match exactly (no missing, no extra keys).{placeholder}token (e.g.{count},{name},{error},{provider}) is preserved identically betweenen.jsonandko.jsonfor each key — 0 mismatches.npx tsc --noEmit,npm run lint, andnpm run buildinsideclient-next/afternpm install— all completed successfully. The one pre-existing lint error touchinglanguage-switcher.tsx(document.cookieassignment) was confirmed viagit stashto already exist onmasterbefore this change.AI Assistance Disclosure
agent_name: Claude Codeagent_version: 2.1.204model_used: Claude Sonnet 5 (claude-sonnet-5)human_testing: No human manually exercised the running application UI (e.g. clicking through screens with the locale switched to Korean) for this change. The checks that were run — and were run by the AI agent, not a human — are: a script-based key-parity and placeholder-parity diff betweenen.jsonandko.json,npx tsc --noEmit,npm run lint, andnpm run build, all of which passed. Flagging this explicitly per this repo's AI disclosure policy rather than claiming testing that did not happen.contribution_summary: Added a complete Korean (ko) translation (929/929 keys) and registered it in the language switcher.Greptile Summary
This PR adds a complete Korean (
ko) translation to the application by introducingclient-next/messages/ko.json(929 keys, all interpolation placeholders preserved) and registering the locale inlanguage-switcher.tsx.ko.jsonmirrors the structure ofen.jsonexactly; brand-name values (e.g.common.sync.title= "Sincronizado") are left as-is, matching the English source's intent.language-switcher.tsxadds{ code: "ko", label: "한국어" }to the locales array and extends the trigger-button label ternary with a"한"branch, following the same approach used forzh-CN.Confidence Score: 5/5
Safe to merge — changes are purely additive (a new translation file and two lines in the language switcher) with no risk to existing functionality.
The translation file covers all 929 keys with correct placeholder syntax, and the language-switcher registration is a straightforward additive change that matches the existing zh-CN pattern exactly. The only comments are style suggestions around the ternary label chain.
No files require special attention; both changed files are low-risk.
Important Files Changed
common.sync.title= "Sincronizado") is left as-is, matching the English source which also intentionally uses the brand name.kolocale in the locales list and extends the trigger-button label ternary with a "한" label for Korean; pattern mirrors the existingzh-CNhandling.Sequence Diagram
%%{init: {'theme': 'neutral'}}%% sequenceDiagram participant User participant LanguageSwitcher participant Cookie participant i18nRequest as i18n/request.ts participant ko_json as messages/ko.json User->>LanguageSwitcher: clicks "한국어" LanguageSwitcher->>Cookie: "set locale=ko (1-year max-age)" LanguageSwitcher->>LanguageSwitcher: router.refresh() i18nRequest->>Cookie: read locale cookie Cookie-->>i18nRequest: "ko" i18nRequest->>ko_json: dynamic import messages/ko.json ko_json-->>i18nRequest: Korean message map i18nRequest-->>User: page rendered in Korean%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% sequenceDiagram participant User participant LanguageSwitcher participant Cookie participant i18nRequest as i18n/request.ts participant ko_json as messages/ko.json User->>LanguageSwitcher: clicks "한국어" LanguageSwitcher->>Cookie: "set locale=ko (1-year max-age)" LanguageSwitcher->>LanguageSwitcher: router.refresh() i18nRequest->>Cookie: read locale cookie Cookie-->>i18nRequest: "ko" i18nRequest->>ko_json: dynamic import messages/ko.json ko_json-->>i18nRequest: Korean message map i18nRequest-->>User: page rendered in KoreanPrompt To Fix All With AI
Reviews (1): Last reviewed commit: "feat(i18n): add Korean (ko) translation" | Re-trigger Greptile