Skip to content

LangsHandler

Signature

export declare class LangsHandler extends BaseHandler

Private types

LangFileResultTypeAlias
type LangFileResult = {    file: Record<string, any>;    locale: string;} | false;

Properties

values: Partial<Record<string, any>>;
filter: (path: string) => boolean;

Filters a file path.

Parameters
path
The path to filter.
Returns

`true` if the path passes the filter, otherwise `false`.

onReload?: (locale: string, value: Record<string, any>) => void;

Methods

getKey(lang: string, message: string): string | undefined;
load(dir: string): Promise<void>;
set(instances: LangInstance[]): void | Promise<void>;

Applies files synchronously until an onFile hook returns a promise. The returned promise covers the remaining files in order and rejects on the first failure.

reload(lang: string): Promise<any>;
reloadAll(stopIfFail?: boolean): Promise<void>;