import { LocaleKit } from "https://deno.land/x/localekit@0.4.0/mod.ts";
The main translation/language class. This handles storage of languages, translation/replacement of dynamic substrings, and the ability to add new languages.
Properties
A key to fall back to if the key is not found in the given language. If the fallback key is not found, the fallback language will be checked. If the fallback key isn't found in the fallback language either, the value returned will be "NOT_FOUND"
Methods
addLanguage(code: string, lang: Record<string, unknown>)
Add a new language into the languages object
getTranslationFunc(lang_code: string)
Returns a new function for translating to a specific language replacing the t method
hydrateLanguage(code: string, lang: Record<string, unknown>)
Merge a new set of translations and keys into the language object
t(key: string, opts?: Record<string, unknown>)
Translates a key to a specific language, replacing substrings with necessary values as needed