UNPKG

@foxxie/i18n

Version:

I18n management utility for Foxxie projects.

46 lines (41 loc) 2.36 kB
import { InitOptions, TFunction } from 'i18next'; export { InitOptions, TFunction, TOptions, TOptionsBase, default as i18next } from 'i18next'; import { LocaleString } from 'discord-api-types/v10'; import { PathLike } from 'node:fs'; import { O } from '@ruffpuff/ts'; declare const discordLocales: ReadonlySet<"en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "sv-SE" | "th" | "tr" | "uk" | "vi">; declare function isDiscordLocale(lng: string): lng is LocaleString; declare const loadedLocales: Set<string>; declare const loadedNamespaces: Set<string>; declare const loadedPaths: Set<string>; declare const formatters: Formatter[]; interface Formatter { name: string; format: (value: any, lng: string | undefined, options: any) => string; } declare function addFormatters(...formatters: Formatter[]): void; declare function init(options: InitOptions & { languageDirectory: string; }): Promise<void>; declare function load(directory: PathLike): Promise<void>; declare function getT(locale: string): TFunction; declare type CustomGet<K extends string, TCustom> = K & { __type__: TCustom; }; declare function T<TCustom = string>(k: string): CustomGet<string, TCustom>; declare type CustomFunctionGet<K extends string, TArgs, TReturn> = K & { __args__: TArgs; __return__: TReturn; }; declare function FT<TArgs, TReturn = string>(k: string): CustomFunctionGet<string, TArgs, TReturn>; declare module 'i18next' { interface TFunction { lng: string; ns?: string; <K extends string, TReturn>(key: CustomGet<K, TReturn>, options?: TOptionsBase | string): TReturn; <K extends string, TReturn>(key: CustomGet<K, TReturn>, defaultValue: TReturn, options?: TOptionsBase | string): TReturn; <K extends string, TArgs extends O, TReturn>(key: CustomFunctionGet<K, TArgs, TReturn>, options?: TOptions<TArgs>): TReturn; <K extends string, TArgs extends O, TReturn>(key: CustomFunctionGet<K, TArgs, TReturn>, defaultValue: TReturn, options?: TOptions<TArgs>): TReturn; } } export { CustomFunctionGet, CustomGet, FT, Formatter, T, addFormatters, discordLocales, formatters, getT, init, isDiscordLocale, load, loadedLocales, loadedNamespaces, loadedPaths };