Skip to content

feat(i18n): add Korean locale and graceful fallback for missing locales - #12733

Closed
YeonghyeonKO wants to merge 2 commits into
langflow-ai:mainfrom
YeonghyeonKO:feat/add-korean-locale
Closed

feat(i18n): add Korean locale and graceful fallback for missing locales#12733
YeonghyeonKO wants to merge 2 commits into
langflow-ai:mainfrom
YeonghyeonKO:feat/add-korean-locale

Conversation

@YeonghyeonKO

@YeonghyeonKO YeonghyeonKO commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add ko.json with full Korean translations for all 388 UI strings
  • Register Korean (한국어) in SUPPORTED_LANGUAGES constant
  • Add try-catch in loadLanguage() to gracefully fall back to English when a locale file is missing

Problem

When a user's browser language is set to Korean (navigator.language returns "ko"), the app attempts to dynamically import ./locales/ko.json which doesn't exist. This causes an unhandled runtime error:

Uncaught (in promise) Error: Unknown variable dynamic import: ./locales/ko.json

This crashes the app on startup for Korean-speaking users. The same issue affects any browser language not in the current locale set.

Fixes #12735

Changes

File Change
src/frontend/src/locales/ko.json Full Korean translations for all UI strings (matching ja.json pattern)
src/frontend/src/constants/languages.ts Add { code: "ko", label: "한국어" } to SUPPORTED_LANGUAGES
src/frontend/src/i18n.ts Wrap dynamic import in try-catch to fall back to English for unsupported locales

Related Issues & Commits

The loadLanguage() fallback fix is complementary to #12671 — even with automatic detection disabled, users who manually select an unsupported language (or have a stale localStorage preference) would still hit this error.

Test Plan

  • Set browser language to Korean → verify app loads with Korean UI
  • Set browser language to an unsupported locale (e.g., th) → verify app falls back to English without errors
  • Verify Korean appears in Settings → Language selector
  • Verify all translated strings render correctly in Korean

🤖 Generated with Claude Code

- Add ko.json with full Korean translations for all UI strings
- Register Korean (한국어) in SUPPORTED_LANGUAGES
- Add try-catch in loadLanguage() to gracefully fall back to English
  when a locale file is missing, preventing the "Unknown variable
  dynamic import" error

The loadLanguage() function currently throws an unhandled error when
the browser's language doesn't match any available locale file (e.g.,
navigator.language returns "ko" but ko.json doesn't exist). This
causes a runtime crash on app startup for users with unsupported
browser languages.

Related:
- langflow-ai#12226 (IBM Globalization Pipeline integration and i18n setup)
- langflow-ai#12671 (disable automatic browser language detection)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 19778779-9e8a-489c-8db6-9ff92d896ade

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

The pull request adds Korean language support to the frontend application by registering the language in the supported languages list, implementing error handling for missing locale files during dynamic import, and providing a comprehensive Korean translation file.

Changes

Cohort / File(s) Summary
Language Support Configuration
src/frontend/src/constants/languages.ts, src/frontend/src/i18n.ts
Added Korean ("ko", "한국어") to supported languages list and wrapped dynamic locale import in try/catch block to gracefully handle missing locale files with warning logging.
Korean Locale Translations
src/frontend/src/locales/ko.json
Added complete Korean translation file covering UI text for errors, success states, alerts, dialogs, chat messaging, settings, store browsing, tables, component labels, navigation, modals, and parameterized placeholders.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 3 warnings)

Check name Status Explanation Resolution
Test Coverage For New Implementations ❌ Error The PR adds error-handling for missing locale files but i18n.test.ts lacks tests for the try-catch fallback mechanism. Add tests verifying non-existent locale loading, console.warn calls, and graceful English fallback behavior.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Test Quality And Coverage ⚠️ Warning PR introduces try-catch error handling in loadLanguage() but lacks test coverage for error paths, non-existent locales, and newly added Korean locale. Add tests for unsupported locale handling, console.warn verification, English fallback behavior, and Korean locale loading to src/frontend/src/i18n.test.ts.
Test File Naming And Structure ⚠️ Warning PR adds Korean locale support to i18n system without including test files for the new functionality. Add test files to verify Korean locale loading, fallback mechanism, and language constant exports work correctly.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: adding Korean locale support and implementing error handling for missing locales.
Excessive Mock Usage Warning ✅ Passed Test file demonstrates appropriate minimal mock usage with jest.spyOn() used twice and immediately restored, testing actual i18n behavior rather than replacing core logic.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 16, 2026
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 16, 2026
- "misc.playground": keep as "Playground" (proper noun, no translation)
- "flow.statusInactive": "실행이 중단되었습니다." (more natural Korean)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 17, 2026
@YeonghyeonKO

Copy link
Copy Markdown
Contributor Author

@RamGopalSrikar @Adam-Aghili @vjgit96
Hi, this PR is related to #12226 (#12226) and fixing fallback for missing locales. Could you please review the issue(#12735) and this PR?

@RamGopalSrikar

Copy link
Copy Markdown
Contributor

#12733 refer to this PR, language for korean not included yet.

@YeonghyeonKO

YeonghyeonKO commented Apr 21, 2026

Copy link
Copy Markdown
Contributor Author

@RamGopalSrikar Right, this PR has two features:

  • applying fallback mechanism for missing locales (which is an urgent feature, has to be merged)
  • adding Korean locale

@YeonghyeonKO

Copy link
Copy Markdown
Contributor Author

Superseded by #13674, which is rebased onto current main and covers all 2,228 keys in en.json. Closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(i18n): loadLanguage() crashes on unsupported browser locale (missing fallback)

2 participants