1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | import { AST } from '../../../expression_parser/ast';
|
---|
9 | import * as i18n from '../../../i18n/i18n_ast';
|
---|
10 | import * as o from '../../../output/output_ast';
|
---|
11 | /**
|
---|
12 | * I18nContext is a helper class which keeps track of all i18n-related aspects
|
---|
13 | * (accumulates placeholders, bindings, etc) between i18nStart and i18nEnd instructions.
|
---|
14 | *
|
---|
15 | * When we enter a nested template, the top-level context is being passed down
|
---|
16 | * to the nested component, which uses this context to generate a child instance
|
---|
17 | * of I18nContext class (to handle nested template) and at the end, reconciles it back
|
---|
18 | * with the parent context.
|
---|
19 | *
|
---|
20 | * @param index Instruction index of i18nStart, which initiates this context
|
---|
21 | * @param ref Reference to a translation const that represents the content if thus context
|
---|
22 | * @param level Nestng level defined for child contexts
|
---|
23 | * @param templateIndex Instruction index of a template which this context belongs to
|
---|
24 | * @param meta Meta information (id, meaning, description, etc) associated with this context
|
---|
25 | */
|
---|
26 | export declare class I18nContext {
|
---|
27 | readonly index: number;
|
---|
28 | readonly ref: o.ReadVarExpr;
|
---|
29 | readonly level: number;
|
---|
30 | readonly templateIndex: number | null;
|
---|
31 | readonly meta: i18n.I18nMeta;
|
---|
32 | private registry?;
|
---|
33 | readonly id: number;
|
---|
34 | bindings: Set<AST>;
|
---|
35 | placeholders: Map<string, any[]>;
|
---|
36 | isEmitted: boolean;
|
---|
37 | private _registry;
|
---|
38 | private _unresolvedCtxCount;
|
---|
39 | constructor(index: number, ref: o.ReadVarExpr, level: number, templateIndex: number | null, meta: i18n.I18nMeta, registry?: any);
|
---|
40 | private appendTag;
|
---|
41 | get icus(): any;
|
---|
42 | get isRoot(): boolean;
|
---|
43 | get isResolved(): boolean;
|
---|
44 | getSerializedPlaceholders(): Map<string, any[]>;
|
---|
45 | appendBinding(binding: AST): void;
|
---|
46 | appendIcu(name: string, ref: o.Expression): void;
|
---|
47 | appendBoundText(node: i18n.I18nMeta): void;
|
---|
48 | appendTemplate(node: i18n.I18nMeta, index: number): void;
|
---|
49 | appendElement(node: i18n.I18nMeta, index: number, closed?: boolean): void;
|
---|
50 | appendProjection(node: i18n.I18nMeta, index: number): void;
|
---|
51 | /**
|
---|
52 | * Generates an instance of a child context based on the root one,
|
---|
53 | * when we enter a nested template within I18n section.
|
---|
54 | *
|
---|
55 | * @param index Instruction index of corresponding i18nStart, which initiates this context
|
---|
56 | * @param templateIndex Instruction index of a template which this context belongs to
|
---|
57 | * @param meta Meta information (id, meaning, description, etc) associated with this context
|
---|
58 | *
|
---|
59 | * @returns I18nContext instance
|
---|
60 | */
|
---|
61 | forkChildContext(index: number, templateIndex: number, meta: i18n.I18nMeta): I18nContext;
|
---|
62 | /**
|
---|
63 | * Reconciles child context into parent one once the end of the i18n block is reached (i18nEnd).
|
---|
64 | *
|
---|
65 | * @param context Child I18nContext instance to be reconciled with parent context.
|
---|
66 | */
|
---|
67 | reconcileChildContext(context: I18nContext): void;
|
---|
68 | }
|
---|