Compile i18n resources
Signature:
export declare function compile(source: string, output: string, options?: CompileOptions): Promise<boolean>;| Parameter | Type | Description |
|---|---|---|
| source | string | the i18n resource source path, you can use glob pattern |
| output | string | the compiled i18n resource output path |
| options | CompileOptions | CompileOptions |
true when all i18n resource successfuly compile, not false
This functoin is asyncronous function. If you want to get about error details, use the handler of CompileOptions and CompileErrorCodes
Compile Error Codes
Signature:
export declare const enum CompileErrorCodes | Member | Value | Description |
|---|---|---|
| INTERNAL_COMPILE_ERROR | 3 | Internal compile error |
| INTERNAL_COMPILE_WARNING | 2 | Internal compile warning |
| NOT_SUPPORTED_FORMAT | 1 | Not supported format |
The error codes of compile function
Compile Options
Signature:
export interface CompileOptions This optioins is used at compile function
Compile handler
Signature:
onCompile?: (source: string, output: string) => void;Compile Error handler
Signature:
onError?: (code: number, source: string, output: string, msg?: string) => void;