mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-16 23:01:06 +02:00
feat(i18n): add Korean (ko) translation
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).
This commit is contained in:
parent
1ae927a7db
commit
d3d8f10940
5 changed files with 830 additions and 5 deletions
|
|
@ -4,7 +4,7 @@ import type React from "react";
|
|||
import { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
|
||||
import enMessages from "../messages/en.json";
|
||||
|
||||
type Locale = "en" | "es" | "pt" | "hi" | "zh";
|
||||
type Locale = "en" | "es" | "pt" | "hi" | "zh" | "ko";
|
||||
|
||||
/**
|
||||
* Dynamically load locale messages on demand.
|
||||
|
|
@ -20,6 +20,8 @@ const loadMessages = async (locale: Locale): Promise<typeof enMessages> => {
|
|||
return (await import("../messages/pt.json")).default;
|
||||
case "zh":
|
||||
return (await import("../messages/zh.json")).default;
|
||||
case "ko":
|
||||
return (await import("../messages/ko.json")).default;
|
||||
default:
|
||||
return enMessages;
|
||||
}
|
||||
|
|
@ -47,7 +49,7 @@ export function LocaleProvider({ children }: { children: React.ReactNode }) {
|
|||
setMounted(true);
|
||||
if (typeof window !== "undefined") {
|
||||
const stored = localStorage.getItem(LOCALE_STORAGE_KEY);
|
||||
if (stored && (["en", "es", "pt", "hi", "zh"] as const).includes(stored as Locale)) {
|
||||
if (stored && (["en", "es", "pt", "hi", "zh", "ko"] as const).includes(stored as Locale)) {
|
||||
const storedLocale = stored as Locale;
|
||||
setLocaleState(storedLocale);
|
||||
// Load messages for non-English locale
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue