add Korean (ko) translation

This commit is contained in:
the0807
2026-03-08 00:35:28 +09:00
parent 0d9ffe2997
commit 1401b9ee15
6 changed files with 1005 additions and 3 deletions

View File

@@ -19,6 +19,7 @@ export const supportedLanguages = [
'nl',
'da',
'sv',
'ko',
] as const;
export type SupportedLanguage = (typeof supportedLanguages)[number];
@@ -39,6 +40,7 @@ export const languageNames: Record<SupportedLanguage, string> = {
nl: 'Nederlands',
da: 'Dansk',
sv: 'Svenska',
ko: '한국어',
};
export const getLanguageFromUrl = (): SupportedLanguage => {
@@ -54,7 +56,7 @@ export const getLanguageFromUrl = (): SupportedLanguage => {
}
const langMatch = path.match(
/^\/(en|ar|fr|es|de|zh|zh-TW|vi|tr|id|it|pt|nl|be|da)(?:\/|$)/
/^\/(en|ar|fr|es|de|zh|zh-TW|vi|tr|id|it|pt|nl|be|da|ko)(?:\/|$)/
);
if (
langMatch &&
@@ -130,7 +132,7 @@ export const changeLanguage = (lang: SupportedLanguage): void => {
let pagePathWithoutLang = relativePath;
const langPrefixMatch = relativePath.match(
/^\/(en|ar|fr|es|de|zh|zh-TW|vi|tr|id|it|pt|nl|be|da)(\/.*)?$/
/^\/(en|ar|fr|es|de|zh|zh-TW|vi|tr|id|it|pt|nl|be|da|ko)(\/.*)?$/
);
if (langPrefixMatch) {
pagePathWithoutLang = langPrefixMatch[2] || '/';
@@ -223,7 +225,7 @@ export const rewriteLinks = (): void => {
}
const langPrefixRegex = new RegExp(
`^(${basePath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')})?/?(en|ar|fr|es|de|zh|zh-TW|vi|tr|id|it|pt|nl|be|da)(/|$)`
`^(${basePath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')})?/?(en|ar|fr|es|de|zh|zh-TW|vi|tr|id|it|pt|nl|be|da|ko)(/|$)`
);
if (langPrefixRegex.test(href)) {
return;