дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 11:15:40 +02:00
feat(i18n): add Korean (#1126)
Adds Korean as a UI language: Settings › Appearance & Behavior › System Settings › Language and Region lists 한국어, with Korean catalogs for message keys and source text. Only Chinese must translate every UI text. Other locales may lack entries and show the English text for them; their catalogs are still checked for stale entries, keys English lacks and placeholders that differ from the English text. Co-authored-by: fhrmrk <[email protected]>
Цей коміт міститься в:
1 джерело
fc6a27d4ba
коміт
7f0c78893e
10 files changed
+6337
-20
No files matched your search
@@ -291,6 +291,7 @@ describe("validateSettings", () => {
|
||||
it("keeps valid values, including dark-hc", () => {
|
||||
const v = validateSettings({ appearance: { theme: "dark-hc", accent: "#C9A080", locale: "zh" } });
|
||||
expect(v.appearance).toMatchObject({ theme: "dark-hc", accent: "#c9a080", locale: "zh" });
|
||||
expect(validateSettings({ appearance: { locale: "ko" } }).appearance.locale).toBe("ko");
|
||||
});
|
||||
|
||||
it("reads and writes dotted keys immutably", () => {
|
||||
|
||||
@@ -35,7 +35,7 @@ import { isThemeChoiceId, type ThemeChoiceId } from "@/platform/themes";
|
||||
|
||||
/** A built-in theme, a plugin's (`plugin:<id>/<theme>`) or the legacy `"system"`. */
|
||||
export type ThemeId = ThemeChoiceId | "system";
|
||||
export type LocaleId = "en" | "zh";
|
||||
export type LocaleId = "en" | "zh" | "ko";
|
||||
|
||||
/** A user keymap (Keymap › Duplicate…): its own overrides on top of a bundled preset. */
|
||||
export interface CustomKeymapSettings {
|
||||
@@ -175,7 +175,7 @@ export const LIMITS = {
|
||||
} as const;
|
||||
|
||||
const theme = (v: unknown, d: ThemeId): ThemeId => (v === "system" || isThemeChoiceId(v) ? v : d);
|
||||
const LOCALES: readonly LocaleId[] = ["en", "zh"];
|
||||
const LOCALES: readonly LocaleId[] = ["en", "zh", "ko"];
|
||||
export const HEX_COLOR = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
|
||||
|
||||
type Obj = Record<string, unknown>;
|
||||
|
||||
@@ -717,7 +717,7 @@ export const BEHAVIOR_PAGES: PageSpec[] = [
|
||||
id: "general.language",
|
||||
title: "Language and Region",
|
||||
order: 0,
|
||||
keywords: ["locale", "chinese", "中文", "translation"],
|
||||
keywords: ["locale", "chinese", "中文", "korean", "한국어", "translation"],
|
||||
sections: [
|
||||
{
|
||||
options: [
|
||||
@@ -729,6 +729,7 @@ export const BEHAVIOR_PAGES: PageSpec[] = [
|
||||
options: [
|
||||
{ value: "en", label: "English" },
|
||||
{ value: "zh", label: "简体中文 (Chinese, Simplified)" },
|
||||
{ value: "ko", label: "한국어 (Korean)" },
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
@@ -12,7 +12,10 @@ import { isTauri, onIdeEvent } from "@/platform/ipc";
|
||||
import { applyKeymapSettings } from "@/platform/keymap";
|
||||
import { loadSettings, useProject } from "@/platform/project";
|
||||
import { applyAppearanceOptions, installAltDragGuard, installIdleSave } from "./appearanceRuntime";
|
||||
import { validateSettings } from "./model/schema";
|
||||
import { type LocaleId, validateSettings } from "./model/schema";
|
||||
|
||||
/** `<html lang>` of each UI locale. */
|
||||
const HTML_LANG: Record<LocaleId, string> = { en: "en", zh: "zh-CN", ko: "ko" };
|
||||
|
||||
export function applyRuntimeSettings(raw: unknown, root: HTMLElement = document.documentElement): void {
|
||||
const s = validateSettings(raw);
|
||||
@@ -20,7 +23,7 @@ export function applyRuntimeSettings(raw: unknown, root: HTMLElement = document.
|
||||
|
||||
applyAppearanceOptions(s, root);
|
||||
|
||||
root.lang = s.appearance.locale === "zh" ? "zh-CN" : "en";
|
||||
root.lang = HTML_LANG[s.appearance.locale];
|
||||
}
|
||||
|
||||
/** Subscribes to settings changes; returns the unsubscribe function. */
|
||||
|
||||
Reference in new issue
Заблокувати користувача