i18n_ast.d.ts
3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { ParseSourceSpan } from '../parse_util';
export declare class Message {
nodes: Node[];
placeholders: {
[phName: string]: string;
};
placeholderToMessage: {
[phName: string]: Message;
};
meaning: string;
description: string;
/**
* @param nodes message AST
* @param placeholders maps placeholder names to static content
* @param placeholderToMessage maps placeholder names to messages (used for nested ICU messages)
* @param meaning
* @param description
*/
constructor(nodes: Node[], placeholders: {
[phName: string]: string;
}, placeholderToMessage: {
[phName: string]: Message;
}, meaning: string, description: string);
}
export interface Node {
sourceSpan: ParseSourceSpan;
visit(visitor: Visitor, context?: any): any;
}
export declare class Text implements Node {
value: string;
sourceSpan: ParseSourceSpan;
constructor(value: string, sourceSpan: ParseSourceSpan);
visit(visitor: Visitor, context?: any): any;
}
export declare class Container implements Node {
children: Node[];
sourceSpan: ParseSourceSpan;
constructor(children: Node[], sourceSpan: ParseSourceSpan);
visit(visitor: Visitor, context?: any): any;
}
export declare class Icu implements Node {
expression: string;
type: string;
cases: {
[k: string]: Node;
};
sourceSpan: ParseSourceSpan;
expressionPlaceholder: string;
constructor(expression: string, type: string, cases: {
[k: string]: Node;
}, sourceSpan: ParseSourceSpan);
visit(visitor: Visitor, context?: any): any;
}
export declare class TagPlaceholder implements Node {
tag: string;
attrs: {
[k: string]: string;
};
startName: string;
closeName: string;
children: Node[];
isVoid: boolean;
sourceSpan: ParseSourceSpan;
constructor(tag: string, attrs: {
[k: string]: string;
}, startName: string, closeName: string, children: Node[], isVoid: boolean, sourceSpan: ParseSourceSpan);
visit(visitor: Visitor, context?: any): any;
}
export declare class Placeholder implements Node {
value: string;
name: string;
sourceSpan: ParseSourceSpan;
constructor(value: string, name: string, sourceSpan: ParseSourceSpan);
visit(visitor: Visitor, context?: any): any;
}
export declare class IcuPlaceholder implements Node {
value: Icu;
name: string;
sourceSpan: ParseSourceSpan;
constructor(value: Icu, name: string, sourceSpan: ParseSourceSpan);
visit(visitor: Visitor, context?: any): any;
}
export interface Visitor {
visitText(text: Text, context?: any): any;
visitContainer(container: Container, context?: any): any;
visitIcu(icu: Icu, context?: any): any;
visitTagPlaceholder(ph: TagPlaceholder, context?: any): any;
visitPlaceholder(ph: Placeholder, context?: any): any;
visitIcuPlaceholder(ph: IcuPlaceholder, context?: any): any;
}