import { en } from "./en.ts"; import { kk } from "./kk.ts"; import { ru, type Dict } from "./ru.ts"; export type { Dict }; export const LANGS = { ru, kk, en } as const; export type Lang = keyof typeof LANGS; export const LANG_NAMES: Record = { ru: "Русский", kk: "Қазақша", en: "English" }; export const isLang = (v: unknown): v is Lang => typeof v === "string" && Object.hasOwn(LANGS, v); /** Подставляет {ключ} в строку перевода. */ export const fmt = (s: string, vars: Record): string => s.replace(/\{(\w+)\}/g, (m, k: string) => (k in vars ? String(vars[k]) : m));