24 lines
815 B
TypeScript
24 lines
815 B
TypeScript
// 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);
|
|
}
|