@boost/translate
Version:
Package and application level translations made easy.
23 lines • 1.16 kB
TypeScript
import { type InitOptions } from 'i18next';
import { type PortablePath } from '@boost/common';
import type { Format, Locale, Translator } from './types';
export interface TranslatorOptions {
/** Automatically detect the locale from the environment. Defaults to `true`. */
autoDetect?: boolean;
/** Enable debugging by logging info to the console. */
debug?: boolean;
/** Fallback locale(s) to use when the detected locale isn't translated. Defaults to `en`. */
fallbackLocale?: Locale | Locale[];
/** Locale to explicitly use. */
locale?: Locale;
/** Order in which to load and lookup locale translations. */
lookupType?: InitOptions['load'];
/** File format resource bundles are written in. Defaults to `yaml`. */
resourceFormat?: Format;
}
/**
* Create and return a `Translator` instance with the defined namespace.
* A list of resource paths are required for locating translation files.
*/
export declare function createTranslator(namespace: string[] | string, resourcePath: PortablePath | PortablePath[], options?: TranslatorOptions): Promise<Translator>;
//# sourceMappingURL=createTranslator.d.ts.map