feat(global): implement main phase
This commit is contained in:
23
src/lib/i18n/index.ts
Normal file
23
src/lib/i18n/index.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
// Type exports
|
||||
export type { Language, Translations, PromptPreset, PersonalityData } from './types';
|
||||
|
||||
// Context exports (from svelte.ts file for runes support)
|
||||
export { createI18nContext, setI18nContext, getI18n, type I18nContext } from './context.svelte';
|
||||
|
||||
// Translation data
|
||||
import en from './translations/en';
|
||||
import ru from './translations/ru';
|
||||
import type { Language, Translations } from './types';
|
||||
|
||||
const translations: Record<Language, Translations> = { en, ru };
|
||||
|
||||
export const languages: Language[] = ['ru', 'en'];
|
||||
export const defaultLanguage: Language = 'ru';
|
||||
|
||||
export function getTranslations(lang: Language): Translations {
|
||||
return translations[lang] || translations[defaultLanguage];
|
||||
}
|
||||
|
||||
export function isValidLanguage(lang: string): lang is Language {
|
||||
return languages.includes(lang as Language);
|
||||
}
|
||||
Reference in New Issue
Block a user