source: trip-planner-front/node_modules/@angular/compiler/src/render3/view/i18n/util.d.ts

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 3.6 KB
Line 
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 */
8import * as i18n from '../../../i18n/i18n_ast';
9import * as html from '../../../ml_parser/ast';
10import * as o from '../../../output/output_ast';
11import * as t from '../../r3_ast';
12/**
13 * Prefix for non-`goog.getMsg` i18n-related vars.
14 * Note: the prefix uses lowercase characters intentionally due to a Closure behavior that
15 * considers variables like `I18N_0` as constants and throws an error when their value changes.
16 */
17export declare const TRANSLATION_VAR_PREFIX = "i18n_";
18/** Name of the i18n attributes **/
19export declare const I18N_ATTR = "i18n";
20export declare const I18N_ATTR_PREFIX = "i18n-";
21/** Prefix of var expressions used in ICUs */
22export declare const I18N_ICU_VAR_PREFIX = "VAR_";
23/** Prefix of ICU expressions for post processing */
24export declare const I18N_ICU_MAPPING_PREFIX = "I18N_EXP_";
25/** Placeholder wrapper for i18n expressions **/
26export declare const I18N_PLACEHOLDER_SYMBOL = "\uFFFD";
27export declare function isI18nAttribute(name: string): boolean;
28export declare function isI18nRootNode(meta?: i18n.I18nMeta): meta is i18n.Message;
29export declare function isSingleI18nIcu(meta?: i18n.I18nMeta): boolean;
30export declare function hasI18nMeta(node: t.Node & {
31 i18n?: i18n.I18nMeta;
32}): boolean;
33export declare function hasI18nAttrs(element: html.Element): boolean;
34export declare function icuFromI18nMessage(message: i18n.Message): i18n.IcuPlaceholder;
35export declare function wrapI18nPlaceholder(content: string | number, contextId?: number): string;
36export declare function assembleI18nBoundString(strings: string[], bindingStartIndex?: number, contextId?: number): string;
37export declare function getSeqNumberGenerator(startsAt?: number): () => number;
38export declare function placeholdersToParams(placeholders: Map<string, string[]>): {
39 [name: string]: o.LiteralExpr;
40};
41export declare function updatePlaceholderMap(map: Map<string, any[]>, name: string, ...values: any[]): void;
42export declare function assembleBoundTextPlaceholders(meta: i18n.I18nMeta, bindingStartIndex?: number, contextId?: number): Map<string, any[]>;
43/**
44 * Format the placeholder names in a map of placeholders to expressions.
45 *
46 * The placeholder names are converted from "internal" format (e.g. `START_TAG_DIV_1`) to "external"
47 * format (e.g. `startTagDiv_1`).
48 *
49 * @param params A map of placeholder names to expressions.
50 * @param useCamelCase whether to camelCase the placeholder name when formatting.
51 * @returns A new map of formatted placeholder names to expressions.
52 */
53export declare function i18nFormatPlaceholderNames(params: {
54 [name: string]: o.Expression;
55} | undefined, useCamelCase: boolean): {
56 [key: string]: o.Expression;
57};
58/**
59 * Converts internal placeholder names to public-facing format
60 * (for example to use in goog.getMsg call).
61 * Example: `START_TAG_DIV_1` is converted to `startTagDiv_1`.
62 *
63 * @param name The placeholder name that should be formatted
64 * @returns Formatted placeholder name
65 */
66export declare function formatI18nPlaceholderName(name: string, useCamelCase?: boolean): string;
67/**
68 * Generates a prefix for translation const name.
69 *
70 * @param extra Additional local prefix that should be injected into translation var name
71 * @returns Complete translation const prefix
72 */
73export declare function getTranslationConstPrefix(extra: string): string;
74/**
75 * Generate AST to declare a variable. E.g. `var I18N_1;`.
76 * @param variable the name of the variable to declare.
77 */
78export declare function declareI18nVariable(variable: o.ReadVarExpr): o.Statement;
Note: See TracBrowser for help on using the repository browser.