source: trip-planner-front/node_modules/@angular/compiler/esm2015/src/i18n/extractor_merger.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: 60.0 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 html from '../ml_parser/ast';
9import { ParseTreeResult } from '../ml_parser/parser';
10import * as i18n from './i18n_ast';
11import { createI18nMessageFactory } from './i18n_parser';
12import { I18nError } from './parse_util';
13const _I18N_ATTR = 'i18n';
14const _I18N_ATTR_PREFIX = 'i18n-';
15const _I18N_COMMENT_PREFIX_REGEXP = /^i18n:?/;
16const MEANING_SEPARATOR = '|';
17const ID_SEPARATOR = '@@';
18let i18nCommentsWarned = false;
19/**
20 * Extract translatable messages from an html AST
21 */
22export function extractMessages(nodes, interpolationConfig, implicitTags, implicitAttrs) {
23 const visitor = new _Visitor(implicitTags, implicitAttrs);
24 return visitor.extract(nodes, interpolationConfig);
25}
26export function mergeTranslations(nodes, translations, interpolationConfig, implicitTags, implicitAttrs) {
27 const visitor = new _Visitor(implicitTags, implicitAttrs);
28 return visitor.merge(nodes, translations, interpolationConfig);
29}
30export class ExtractionResult {
31 constructor(messages, errors) {
32 this.messages = messages;
33 this.errors = errors;
34 }
35}
36var _VisitorMode;
37(function (_VisitorMode) {
38 _VisitorMode[_VisitorMode["Extract"] = 0] = "Extract";
39 _VisitorMode[_VisitorMode["Merge"] = 1] = "Merge";
40})(_VisitorMode || (_VisitorMode = {}));
41/**
42 * This Visitor is used:
43 * 1. to extract all the translatable strings from an html AST (see `extract()`),
44 * 2. to replace the translatable strings with the actual translations (see `merge()`)
45 *
46 * @internal
47 */
48class _Visitor {
49 constructor(_implicitTags, _implicitAttrs) {
50 this._implicitTags = _implicitTags;
51 this._implicitAttrs = _implicitAttrs;
52 }
53 /**
54 * Extracts the messages from the tree
55 */
56 extract(nodes, interpolationConfig) {
57 this._init(_VisitorMode.Extract, interpolationConfig);
58 nodes.forEach(node => node.visit(this, null));
59 if (this._inI18nBlock) {
60 this._reportError(nodes[nodes.length - 1], 'Unclosed block');
61 }
62 return new ExtractionResult(this._messages, this._errors);
63 }
64 /**
65 * Returns a tree where all translatable nodes are translated
66 */
67 merge(nodes, translations, interpolationConfig) {
68 this._init(_VisitorMode.Merge, interpolationConfig);
69 this._translations = translations;
70 // Construct a single fake root element
71 const wrapper = new html.Element('wrapper', [], nodes, undefined, undefined, undefined);
72 const translatedNode = wrapper.visit(this, null);
73 if (this._inI18nBlock) {
74 this._reportError(nodes[nodes.length - 1], 'Unclosed block');
75 }
76 return new ParseTreeResult(translatedNode.children, this._errors);
77 }
78 visitExpansionCase(icuCase, context) {
79 // Parse cases for translatable html attributes
80 const expression = html.visitAll(this, icuCase.expression, context);
81 if (this._mode === _VisitorMode.Merge) {
82 return new html.ExpansionCase(icuCase.value, expression, icuCase.sourceSpan, icuCase.valueSourceSpan, icuCase.expSourceSpan);
83 }
84 }
85 visitExpansion(icu, context) {
86 this._mayBeAddBlockChildren(icu);
87 const wasInIcu = this._inIcu;
88 if (!this._inIcu) {
89 // nested ICU messages should not be extracted but top-level translated as a whole
90 if (this._isInTranslatableSection) {
91 this._addMessage([icu]);
92 }
93 this._inIcu = true;
94 }
95 const cases = html.visitAll(this, icu.cases, context);
96 if (this._mode === _VisitorMode.Merge) {
97 icu = new html.Expansion(icu.switchValue, icu.type, cases, icu.sourceSpan, icu.switchValueSourceSpan);
98 }
99 this._inIcu = wasInIcu;
100 return icu;
101 }
102 visitComment(comment, context) {
103 const isOpening = _isOpeningComment(comment);
104 if (isOpening && this._isInTranslatableSection) {
105 this._reportError(comment, 'Could not start a block inside a translatable section');
106 return;
107 }
108 const isClosing = _isClosingComment(comment);
109 if (isClosing && !this._inI18nBlock) {
110 this._reportError(comment, 'Trying to close an unopened block');
111 return;
112 }
113 if (!this._inI18nNode && !this._inIcu) {
114 if (!this._inI18nBlock) {
115 if (isOpening) {
116 // deprecated from v5 you should use <ng-container i18n> instead of i18n comments
117 if (!i18nCommentsWarned && console && console.warn) {
118 i18nCommentsWarned = true;
119 const details = comment.sourceSpan.details ? `, ${comment.sourceSpan.details}` : '';
120 // TODO(ocombe): use a log service once there is a public one available
121 console.warn(`I18n comments are deprecated, use an <ng-container> element instead (${comment.sourceSpan.start}${details})`);
122 }
123 this._inI18nBlock = true;
124 this._blockStartDepth = this._depth;
125 this._blockChildren = [];
126 this._blockMeaningAndDesc =
127 comment.value.replace(_I18N_COMMENT_PREFIX_REGEXP, '').trim();
128 this._openTranslatableSection(comment);
129 }
130 }
131 else {
132 if (isClosing) {
133 if (this._depth == this._blockStartDepth) {
134 this._closeTranslatableSection(comment, this._blockChildren);
135 this._inI18nBlock = false;
136 const message = this._addMessage(this._blockChildren, this._blockMeaningAndDesc);
137 // merge attributes in sections
138 const nodes = this._translateMessage(comment, message);
139 return html.visitAll(this, nodes);
140 }
141 else {
142 this._reportError(comment, 'I18N blocks should not cross element boundaries');
143 return;
144 }
145 }
146 }
147 }
148 }
149 visitText(text, context) {
150 if (this._isInTranslatableSection) {
151 this._mayBeAddBlockChildren(text);
152 }
153 return text;
154 }
155 visitElement(el, context) {
156 this._mayBeAddBlockChildren(el);
157 this._depth++;
158 const wasInI18nNode = this._inI18nNode;
159 const wasInImplicitNode = this._inImplicitNode;
160 let childNodes = [];
161 let translatedChildNodes = undefined;
162 // Extract:
163 // - top level nodes with the (implicit) "i18n" attribute if not already in a section
164 // - ICU messages
165 const i18nAttr = _getI18nAttr(el);
166 const i18nMeta = i18nAttr ? i18nAttr.value : '';
167 const isImplicit = this._implicitTags.some(tag => el.name === tag) && !this._inIcu &&
168 !this._isInTranslatableSection;
169 const isTopLevelImplicit = !wasInImplicitNode && isImplicit;
170 this._inImplicitNode = wasInImplicitNode || isImplicit;
171 if (!this._isInTranslatableSection && !this._inIcu) {
172 if (i18nAttr || isTopLevelImplicit) {
173 this._inI18nNode = true;
174 const message = this._addMessage(el.children, i18nMeta);
175 translatedChildNodes = this._translateMessage(el, message);
176 }
177 if (this._mode == _VisitorMode.Extract) {
178 const isTranslatable = i18nAttr || isTopLevelImplicit;
179 if (isTranslatable)
180 this._openTranslatableSection(el);
181 html.visitAll(this, el.children);
182 if (isTranslatable)
183 this._closeTranslatableSection(el, el.children);
184 }
185 }
186 else {
187 if (i18nAttr || isTopLevelImplicit) {
188 this._reportError(el, 'Could not mark an element as translatable inside a translatable section');
189 }
190 if (this._mode == _VisitorMode.Extract) {
191 // Descend into child nodes for extraction
192 html.visitAll(this, el.children);
193 }
194 }
195 if (this._mode === _VisitorMode.Merge) {
196 const visitNodes = translatedChildNodes || el.children;
197 visitNodes.forEach(child => {
198 const visited = child.visit(this, context);
199 if (visited && !this._isInTranslatableSection) {
200 // Do not add the children from translatable sections (= i18n blocks here)
201 // They will be added later in this loop when the block closes (i.e. on `<!-- /i18n -->`)
202 childNodes = childNodes.concat(visited);
203 }
204 });
205 }
206 this._visitAttributesOf(el);
207 this._depth--;
208 this._inI18nNode = wasInI18nNode;
209 this._inImplicitNode = wasInImplicitNode;
210 if (this._mode === _VisitorMode.Merge) {
211 const translatedAttrs = this._translateAttributes(el);
212 return new html.Element(el.name, translatedAttrs, childNodes, el.sourceSpan, el.startSourceSpan, el.endSourceSpan);
213 }
214 return null;
215 }
216 visitAttribute(attribute, context) {
217 throw new Error('unreachable code');
218 }
219 _init(mode, interpolationConfig) {
220 this._mode = mode;
221 this._inI18nBlock = false;
222 this._inI18nNode = false;
223 this._depth = 0;
224 this._inIcu = false;
225 this._msgCountAtSectionStart = undefined;
226 this._errors = [];
227 this._messages = [];
228 this._inImplicitNode = false;
229 this._createI18nMessage = createI18nMessageFactory(interpolationConfig);
230 }
231 // looks for translatable attributes
232 _visitAttributesOf(el) {
233 const explicitAttrNameToValue = {};
234 const implicitAttrNames = this._implicitAttrs[el.name] || [];
235 el.attrs.filter(attr => attr.name.startsWith(_I18N_ATTR_PREFIX))
236 .forEach(attr => explicitAttrNameToValue[attr.name.slice(_I18N_ATTR_PREFIX.length)] =
237 attr.value);
238 el.attrs.forEach(attr => {
239 if (attr.name in explicitAttrNameToValue) {
240 this._addMessage([attr], explicitAttrNameToValue[attr.name]);
241 }
242 else if (implicitAttrNames.some(name => attr.name === name)) {
243 this._addMessage([attr]);
244 }
245 });
246 }
247 // add a translatable message
248 _addMessage(ast, msgMeta) {
249 if (ast.length == 0 ||
250 ast.length == 1 && ast[0] instanceof html.Attribute && !ast[0].value) {
251 // Do not create empty messages
252 return null;
253 }
254 const { meaning, description, id } = _parseMessageMeta(msgMeta);
255 const message = this._createI18nMessage(ast, meaning, description, id);
256 this._messages.push(message);
257 return message;
258 }
259 // Translates the given message given the `TranslationBundle`
260 // This is used for translating elements / blocks - see `_translateAttributes` for attributes
261 // no-op when called in extraction mode (returns [])
262 _translateMessage(el, message) {
263 if (message && this._mode === _VisitorMode.Merge) {
264 const nodes = this._translations.get(message);
265 if (nodes) {
266 return nodes;
267 }
268 this._reportError(el, `Translation unavailable for message id="${this._translations.digest(message)}"`);
269 }
270 return [];
271 }
272 // translate the attributes of an element and remove i18n specific attributes
273 _translateAttributes(el) {
274 const attributes = el.attrs;
275 const i18nParsedMessageMeta = {};
276 attributes.forEach(attr => {
277 if (attr.name.startsWith(_I18N_ATTR_PREFIX)) {
278 i18nParsedMessageMeta[attr.name.slice(_I18N_ATTR_PREFIX.length)] =
279 _parseMessageMeta(attr.value);
280 }
281 });
282 const translatedAttributes = [];
283 attributes.forEach((attr) => {
284 if (attr.name === _I18N_ATTR || attr.name.startsWith(_I18N_ATTR_PREFIX)) {
285 // strip i18n specific attributes
286 return;
287 }
288 if (attr.value && attr.value != '' && i18nParsedMessageMeta.hasOwnProperty(attr.name)) {
289 const { meaning, description, id } = i18nParsedMessageMeta[attr.name];
290 const message = this._createI18nMessage([attr], meaning, description, id);
291 const nodes = this._translations.get(message);
292 if (nodes) {
293 if (nodes.length == 0) {
294 translatedAttributes.push(new html.Attribute(attr.name, '', attr.sourceSpan, undefined /* keySpan */, undefined /* valueSpan */, undefined /* valueTokens */, undefined /* i18n */));
295 }
296 else if (nodes[0] instanceof html.Text) {
297 const value = nodes[0].value;
298 translatedAttributes.push(new html.Attribute(attr.name, value, attr.sourceSpan, undefined /* keySpan */, undefined /* valueSpan */, undefined /* valueTokens */, undefined /* i18n */));
299 }
300 else {
301 this._reportError(el, `Unexpected translation for attribute "${attr.name}" (id="${id || this._translations.digest(message)}")`);
302 }
303 }
304 else {
305 this._reportError(el, `Translation unavailable for attribute "${attr.name}" (id="${id || this._translations.digest(message)}")`);
306 }
307 }
308 else {
309 translatedAttributes.push(attr);
310 }
311 });
312 return translatedAttributes;
313 }
314 /**
315 * Add the node as a child of the block when:
316 * - we are in a block,
317 * - we are not inside a ICU message (those are handled separately),
318 * - the node is a "direct child" of the block
319 */
320 _mayBeAddBlockChildren(node) {
321 if (this._inI18nBlock && !this._inIcu && this._depth == this._blockStartDepth) {
322 this._blockChildren.push(node);
323 }
324 }
325 /**
326 * Marks the start of a section, see `_closeTranslatableSection`
327 */
328 _openTranslatableSection(node) {
329 if (this._isInTranslatableSection) {
330 this._reportError(node, 'Unexpected section start');
331 }
332 else {
333 this._msgCountAtSectionStart = this._messages.length;
334 }
335 }
336 /**
337 * A translatable section could be:
338 * - the content of translatable element,
339 * - nodes between `<!-- i18n -->` and `<!-- /i18n -->` comments
340 */
341 get _isInTranslatableSection() {
342 return this._msgCountAtSectionStart !== void 0;
343 }
344 /**
345 * Terminates a section.
346 *
347 * If a section has only one significant children (comments not significant) then we should not
348 * keep the message from this children:
349 *
350 * `<p i18n="meaning|description">{ICU message}</p>` would produce two messages:
351 * - one for the <p> content with meaning and description,
352 * - another one for the ICU message.
353 *
354 * In this case the last message is discarded as it contains less information (the AST is
355 * otherwise identical).
356 *
357 * Note that we should still keep messages extracted from attributes inside the section (ie in the
358 * ICU message here)
359 */
360 _closeTranslatableSection(node, directChildren) {
361 if (!this._isInTranslatableSection) {
362 this._reportError(node, 'Unexpected section end');
363 return;
364 }
365 const startIndex = this._msgCountAtSectionStart;
366 const significantChildren = directChildren.reduce((count, node) => count + (node instanceof html.Comment ? 0 : 1), 0);
367 if (significantChildren == 1) {
368 for (let i = this._messages.length - 1; i >= startIndex; i--) {
369 const ast = this._messages[i].nodes;
370 if (!(ast.length == 1 && ast[0] instanceof i18n.Text)) {
371 this._messages.splice(i, 1);
372 break;
373 }
374 }
375 }
376 this._msgCountAtSectionStart = undefined;
377 }
378 _reportError(node, msg) {
379 this._errors.push(new I18nError(node.sourceSpan, msg));
380 }
381}
382function _isOpeningComment(n) {
383 return !!(n instanceof html.Comment && n.value && n.value.startsWith('i18n'));
384}
385function _isClosingComment(n) {
386 return !!(n instanceof html.Comment && n.value && n.value === '/i18n');
387}
388function _getI18nAttr(p) {
389 return p.attrs.find(attr => attr.name === _I18N_ATTR) || null;
390}
391function _parseMessageMeta(i18n) {
392 if (!i18n)
393 return { meaning: '', description: '', id: '' };
394 const idIndex = i18n.indexOf(ID_SEPARATOR);
395 const descIndex = i18n.indexOf(MEANING_SEPARATOR);
396 const [meaningAndDesc, id] = (idIndex > -1) ? [i18n.slice(0, idIndex), i18n.slice(idIndex + 2)] : [i18n, ''];
397 const [meaning, description] = (descIndex > -1) ?
398 [meaningAndDesc.slice(0, descIndex), meaningAndDesc.slice(descIndex + 1)] :
399 ['', meaningAndDesc];
400 return { meaning, description, id: id.trim() };
401}
402//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXh0cmFjdG9yX21lcmdlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvbXBpbGVyL3NyYy9pMThuL2V4dHJhY3Rvcl9tZXJnZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsT0FBTyxLQUFLLElBQUksT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STE4bkF0dHIocDogaHRtbC5FbGVtZW50KTogaHRtbC5BdHRyaWJ1dGV8bnVsbCB7XG4gIHJldHVybiBwLmF0dHJzLmZpbmQoYXR0ciA9PiBhdHRyLm5hbWUgPT09IF9JMThOX0FUVFIpIHx8IG51bGw7XG59XG5cbmZ1bmN0aW9uIF9wYXJzZU1lc3NhZ2VNZXRhKGkxOG4/OiBzdHJpbmcpOiB7bWVhbmluZzogc3RyaW5nLCBkZXNjcmlwdGlvbjogc3RyaW5nLCBpZDogc3RyaW5nfSB7XG4gIGlmICghaTE4bikgcmV0dXJuIHttZWFuaW5nOiAnJywgZGVzY3JpcHRpb246ICcnLCBpZDogJyd9O1xuXG4gIGNvbnN0IGlkSW5kZXggPSBpMThuLmluZGV4T2YoSURfU0VQQVJBVE9SKTtcbiAgY29uc3QgZGVzY0luZGV4ID0gaTE4bi5pbmRleE9mKE1FQU5JTkdfU0VQQVJBVE9SKTtcbiAgY29uc3QgW21lYW5pbmdBbmREZXNjLCBpZF0gPVxuICAgICAgKGlkSW5kZXggPiAtMSkgPyBbaTE4bi5zbGljZSgwLCBpZEluZGV4KSwgaTE4bi5zbGljZShpZEluZGV4ICsgMildIDogW2kxOG4sICcnXTtcbiAgY29uc3QgW21lYW5pbmcsIGRlc2NyaXB0aW9uXSA9IChkZXNjSW5kZXggPiAtMSkgP1xuICAgICAgW21lYW5pbmdBbmREZXNjLnNsaWNlKDAsIGRlc2NJbmRleCksIG1lYW5pbmdBbmREZXNjLnNsaWNlKGRlc2NJbmRleCArIDEpXSA6XG4gICAgICBbJycsIG1lYW5pbmdBbmREZXNjXTtcblxuICByZXR1cm4ge21lYW5pbmcsIGRlc2NyaXB0aW9uLCBpZDogaWQudHJpbSgpfTtcbn1cbiJdfQ==
Note: See TracBrowser for help on using the repository browser.