source: trip-planner-front/node_modules/@angular/compiler/esm2015/src/i18n/translation_bundle.js

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: 25.5 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 { MissingTranslationStrategy } from '../core';
9import { HtmlParser } from '../ml_parser/html_parser';
10import { I18nError } from './parse_util';
11import { escapeXml } from './serializers/xml_helper';
12/**
13 * A container for translated messages
14 */
15export class TranslationBundle {
16 constructor(_i18nNodesByMsgId = {}, locale, digest, mapperFactory, missingTranslationStrategy = MissingTranslationStrategy.Warning, console) {
17 this._i18nNodesByMsgId = _i18nNodesByMsgId;
18 this.digest = digest;
19 this.mapperFactory = mapperFactory;
20 this._i18nToHtml = new I18nToHtmlVisitor(_i18nNodesByMsgId, locale, digest, mapperFactory, missingTranslationStrategy, console);
21 }
22 // Creates a `TranslationBundle` by parsing the given `content` with the `serializer`.
23 static load(content, url, serializer, missingTranslationStrategy, console) {
24 const { locale, i18nNodesByMsgId } = serializer.load(content, url);
25 const digestFn = (m) => serializer.digest(m);
26 const mapperFactory = (m) => serializer.createNameMapper(m);
27 return new TranslationBundle(i18nNodesByMsgId, locale, digestFn, mapperFactory, missingTranslationStrategy, console);
28 }
29 // Returns the translation as HTML nodes from the given source message.
30 get(srcMsg) {
31 const html = this._i18nToHtml.convert(srcMsg);
32 if (html.errors.length) {
33 throw new Error(html.errors.join('\n'));
34 }
35 return html.nodes;
36 }
37 has(srcMsg) {
38 return this.digest(srcMsg) in this._i18nNodesByMsgId;
39 }
40}
41class I18nToHtmlVisitor {
42 constructor(_i18nNodesByMsgId = {}, _locale, _digest, _mapperFactory, _missingTranslationStrategy, _console) {
43 this._i18nNodesByMsgId = _i18nNodesByMsgId;
44 this._locale = _locale;
45 this._digest = _digest;
46 this._mapperFactory = _mapperFactory;
47 this._missingTranslationStrategy = _missingTranslationStrategy;
48 this._console = _console;
49 this._contextStack = [];
50 this._errors = [];
51 }
52 convert(srcMsg) {
53 this._contextStack.length = 0;
54 this._errors.length = 0;
55 // i18n to text
56 const text = this._convertToText(srcMsg);
57 // text to html
58 const url = srcMsg.nodes[0].sourceSpan.start.file.url;
59 const html = new HtmlParser().parse(text, url, { tokenizeExpansionForms: true });
60 return {
61 nodes: html.rootNodes,
62 errors: [...this._errors, ...html.errors],
63 };
64 }
65 visitText(text, context) {
66 // `convert()` uses an `HtmlParser` to return `html.Node`s
67 // we should then make sure that any special characters are escaped
68 return escapeXml(text.value);
69 }
70 visitContainer(container, context) {
71 return container.children.map(n => n.visit(this)).join('');
72 }
73 visitIcu(icu, context) {
74 const cases = Object.keys(icu.cases).map(k => `${k} {${icu.cases[k].visit(this)}}`);
75 // TODO(vicb): Once all format switch to using expression placeholders
76 // we should throw when the placeholder is not in the source message
77 const exp = this._srcMsg.placeholders.hasOwnProperty(icu.expression) ?
78 this._srcMsg.placeholders[icu.expression].text :
79 icu.expression;
80 return `{${exp}, ${icu.type}, ${cases.join(' ')}}`;
81 }
82 visitPlaceholder(ph, context) {
83 const phName = this._mapper(ph.name);
84 if (this._srcMsg.placeholders.hasOwnProperty(phName)) {
85 return this._srcMsg.placeholders[phName].text;
86 }
87 if (this._srcMsg.placeholderToMessage.hasOwnProperty(phName)) {
88 return this._convertToText(this._srcMsg.placeholderToMessage[phName]);
89 }
90 this._addError(ph, `Unknown placeholder "${ph.name}"`);
91 return '';
92 }
93 // Loaded message contains only placeholders (vs tag and icu placeholders).
94 // However when a translation can not be found, we need to serialize the source message
95 // which can contain tag placeholders
96 visitTagPlaceholder(ph, context) {
97 const tag = `${ph.tag}`;
98 const attrs = Object.keys(ph.attrs).map(name => `${name}="${ph.attrs[name]}"`).join(' ');
99 if (ph.isVoid) {
100 return `<${tag} ${attrs}/>`;
101 }
102 const children = ph.children.map((c) => c.visit(this)).join('');
103 return `<${tag} ${attrs}>${children}</${tag}>`;
104 }
105 // Loaded message contains only placeholders (vs tag and icu placeholders).
106 // However when a translation can not be found, we need to serialize the source message
107 // which can contain tag placeholders
108 visitIcuPlaceholder(ph, context) {
109 // An ICU placeholder references the source message to be serialized
110 return this._convertToText(this._srcMsg.placeholderToMessage[ph.name]);
111 }
112 /**
113 * Convert a source message to a translated text string:
114 * - text nodes are replaced with their translation,
115 * - placeholders are replaced with their content,
116 * - ICU nodes are converted to ICU expressions.
117 */
118 _convertToText(srcMsg) {
119 const id = this._digest(srcMsg);
120 const mapper = this._mapperFactory ? this._mapperFactory(srcMsg) : null;
121 let nodes;
122 this._contextStack.push({ msg: this._srcMsg, mapper: this._mapper });
123 this._srcMsg = srcMsg;
124 if (this._i18nNodesByMsgId.hasOwnProperty(id)) {
125 // When there is a translation use its nodes as the source
126 // And create a mapper to convert serialized placeholder names to internal names
127 nodes = this._i18nNodesByMsgId[id];
128 this._mapper = (name) => mapper ? mapper.toInternalName(name) : name;
129 }
130 else {
131 // When no translation has been found
132 // - report an error / a warning / nothing,
133 // - use the nodes from the original message
134 // - placeholders are already internal and need no mapper
135 if (this._missingTranslationStrategy === MissingTranslationStrategy.Error) {
136 const ctx = this._locale ? ` for locale "${this._locale}"` : '';
137 this._addError(srcMsg.nodes[0], `Missing translation for message "${id}"${ctx}`);
138 }
139 else if (this._console &&
140 this._missingTranslationStrategy === MissingTranslationStrategy.Warning) {
141 const ctx = this._locale ? ` for locale "${this._locale}"` : '';
142 this._console.warn(`Missing translation for message "${id}"${ctx}`);
143 }
144 nodes = srcMsg.nodes;
145 this._mapper = (name) => name;
146 }
147 const text = nodes.map(node => node.visit(this)).join('');
148 const context = this._contextStack.pop();
149 this._srcMsg = context.msg;
150 this._mapper = context.mapper;
151 return text;
152 }
153 _addError(el, msg) {
154 this._errors.push(new I18nError(el.sourceSpan, msg));
155 }
156}
157//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNsYXRpb25fYnVuZGx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SB7XG4gICAgICAgIGNvbnN0IGN0eCA9IHRoaXMuX2xvY2FsZSA/IGAgZm9yIGxvY2FsZSBcIiR7dGhpcy5fbG9jYWxlfVwiYCA6ICcnO1xuICAgICAgICB0aGlzLl9jb25zb2xlLndhcm4oYE1pc3NpbmcgdHJhbnNsYXRpb24gZm9yIG1lc3NhZ2UgXCIke2lkfVwiJHtjdHh9YCk7XG4gICAgICB9XG4gICAgICBub2RlcyA9IHNyY01zZy5ub2RlcztcbiAgICAgIHRoaXMuX21hcHBlciA9IChuYW1lOiBzdHJpbmcpID0+IG5hbWU7XG4gICAgfVxuICAgIGNvbnN0IHRleHQgPSBub2Rlcy5tYXAobm9kZSA9PiBub2RlLnZpc2l0KHRoaXMpKS5qb2luKCcnKTtcbiAgICBjb25zdCBjb250ZXh0ID0gdGhpcy5fY29udGV4dFN0YWNrLnBvcCgpITtcbiAgICB0aGlzLl9zcmNNc2cgPSBjb250ZXh0Lm1zZztcbiAgICB0aGlzLl9tYXBwZXIgPSBjb250ZXh0Lm1hcHBlcjtcbiAgICByZXR1cm4gdGV4dDtcbiAgfVxuXG4gIHByaXZhdGUgX2FkZEVycm9yKGVsOiBpMThuLk5vZGUsIG1zZzogc3RyaW5nKSB7XG4gICAgdGhpcy5fZXJyb3JzLnB1c2gobmV3IEkxOG5FcnJvcihlbC5zb3VyY2VTcGFuLCBtc2cpKTtcbiAgfVxufVxuIl19
Note: See TracBrowser for help on using the repository browser.