UNPKG

795 BTypeScriptView Raw
1export declare abstract class TranslateParser {
2 /**
3 * Interpolates a string to replace parameters
4 * "This is a {{ key }}" ==> "This is a value", with params = { key: "value" }
5 * @param expr
6 * @param params
7 * @returns {string}
8 */
9 abstract interpolate(expr: string, params?: any): string;
10 /**
11 * Gets a value from an object by composed key
12 * parser.getValue({ key1: { keyA: 'valueI' }}, 'key1.keyA') ==> 'valueI'
13 * @param target
14 * @param key
15 * @returns {string}
16 */
17 abstract getValue(target: any, key: string): string;
18}
19export declare class DefaultTranslateParser extends TranslateParser {
20 templateMatcher: RegExp;
21 interpolate(expr: string, params?: any): string;
22 getValue(target: any, key: string): string;
23}