30 lines
868 B
TypeScript
30 lines
868 B
TypeScript
|
import { LangPack } from "./lang_pack.ts"
|
||
|
import en_pack from "./en.ts"
|
||
|
import ru_pack from "./ru.ts"
|
||
|
import rs_pack from "./rs.ts"
|
||
|
import hr_pack from "./hr.ts"
|
||
|
import hu_pack from "./hu.ts"
|
||
|
import pl_pack from "./pl.ts"
|
||
|
import ua_pack from "./pl.ts"
|
||
|
|
||
|
|
||
|
export * from "./lang_pack.ts"
|
||
|
|
||
|
export class LangManager {
|
||
|
static defaultLang: LangPack = en_pack
|
||
|
static langsMap = new Map<string, LangPack>([
|
||
|
[en_pack.code, en_pack],
|
||
|
[ru_pack.code, ru_pack],
|
||
|
[rs_pack.code, rs_pack],
|
||
|
[hr_pack.code, hr_pack],
|
||
|
[hu_pack.code, hu_pack],
|
||
|
[pl_pack.code, pl_pack],
|
||
|
[ua_pack.code, ua_pack],
|
||
|
])
|
||
|
|
||
|
static getDefaultLang(): LangPack { return this.defaultLang }
|
||
|
static getLang(langCode?: string): LangPack {
|
||
|
return this.langsMap.get(langCode || this.defaultLang.code)
|
||
|
|| this.defaultLang
|
||
|
}
|
||
|
}
|