Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion frontend/src/i18n/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ import LanguageDetector from "i18next-browser-languagedetector";
import en from "./locales/en/translation.json";
import zhCN from "./locales/zh-CN/translation.json";
import zhTW from "./locales/zh-TW/translation.json";
import ru from "./locales/ru/translation.json";

// Define supported languages
export const supportedLanguages = ["en", "zh-CN", "zh-TW"] as const;
export const supportedLanguages = ["en", "zh-CN", "zh-TW", "ru"] as const;
export type SupportedLanguage = (typeof supportedLanguages)[number];

// Language names for display
export const languageNames: Record<SupportedLanguage, string> = {
en: "English",
"zh-CN": "简体中文",
"zh-TW": "繁體中文",
ru: "Русский",
};

// Translation resources
Expand All @@ -29,6 +31,9 @@ const resources = {
"zh-TW": {
translation: zhTW,
},
ru: {
translation: ru,
},
};

// Initialize i18next
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@ import type { SupportedLanguage } from "./config";

// Export language detection utility
export const isValidLanguage = (lang: string): lang is SupportedLanguage => {
return ["en", "zh-CN", "zh-TW"].includes(lang);
return ["en", "zh-CN", "zh-TW", "ru"].includes(lang);
};

// Export language display utility
export const getLanguageDisplayName = (lang: SupportedLanguage): string => {
const names = {
const names: Record<SupportedLanguage, string> = {
en: "English",
"zh-CN": "简体中文",
"zh-TW": "繁體中文",
ru: "Русский",
};
return names[lang];
};
Loading