UNPKG

@skyra/i18next-backend

Version:

A fast and modern filesystem-based i18next backend for Node.js.

31 lines (28 loc) 1.04 kB
import { BackendModule, Services, InitOptions, ReadCallback } from 'i18next'; import { PathLike } from 'node:fs'; declare class Backend<T = object> implements BackendModule<Backend.Options<T>> { readonly type = "backend"; private paths; private i18nextOptions; init(_: Services, backendOptions: Backend.Options<T>, i18nextOptions: InitOptions): void; read(language: string, namespace: string, callback: ReadCallback): void; private readPaths; private readPathsSync; static readonly type = "backend"; private static readPath; private static readPathSync; private static handleResults; private static resolvePath; } declare namespace Backend { type Options<T = object> = T & { paths: readonly PathResolvable[]; }; } type PathResolvable = string | URL | ((language: string, namespace: string) => PathLike); declare module 'i18next' { interface InitOptions<T = object> { backend?: Backend.Options<T> | undefined; } } export { Backend, type PathResolvable };