source: trip-planner-front/node_modules/@angular/compiler/src/i18n/message_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: 15.7 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 */
8(function (factory) {
9 if (typeof module === "object" && typeof module.exports === "object") {
10 var v = factory(require, exports);
11 if (v !== undefined) module.exports = v;
12 }
13 else if (typeof define === "function" && define.amd) {
14 define("@angular/compiler/src/i18n/message_bundle", ["require", "exports", "tslib", "@angular/compiler/src/i18n/extractor_merger", "@angular/compiler/src/i18n/i18n_ast"], factory);
15 }
16})(function (require, exports) {
17 "use strict";
18 Object.defineProperty(exports, "__esModule", { value: true });
19 exports.MessageBundle = void 0;
20 var tslib_1 = require("tslib");
21 var extractor_merger_1 = require("@angular/compiler/src/i18n/extractor_merger");
22 var i18n = require("@angular/compiler/src/i18n/i18n_ast");
23 /**
24 * A container for message extracted from the templates.
25 */
26 var MessageBundle = /** @class */ (function () {
27 function MessageBundle(_htmlParser, _implicitTags, _implicitAttrs, _locale) {
28 if (_locale === void 0) { _locale = null; }
29 this._htmlParser = _htmlParser;
30 this._implicitTags = _implicitTags;
31 this._implicitAttrs = _implicitAttrs;
32 this._locale = _locale;
33 this._messages = [];
34 }
35 MessageBundle.prototype.updateFromTemplate = function (html, url, interpolationConfig) {
36 var _a;
37 var htmlParserResult = this._htmlParser.parse(html, url, { tokenizeExpansionForms: true, interpolationConfig: interpolationConfig });
38 if (htmlParserResult.errors.length) {
39 return htmlParserResult.errors;
40 }
41 var i18nParserResult = extractor_merger_1.extractMessages(htmlParserResult.rootNodes, interpolationConfig, this._implicitTags, this._implicitAttrs);
42 if (i18nParserResult.errors.length) {
43 return i18nParserResult.errors;
44 }
45 (_a = this._messages).push.apply(_a, tslib_1.__spreadArray([], tslib_1.__read(i18nParserResult.messages)));
46 return [];
47 };
48 // Return the message in the internal format
49 // The public (serialized) format might be different, see the `write` method.
50 MessageBundle.prototype.getMessages = function () {
51 return this._messages;
52 };
53 MessageBundle.prototype.write = function (serializer, filterSources) {
54 var messages = {};
55 var mapperVisitor = new MapPlaceholderNames();
56 // Deduplicate messages based on their ID
57 this._messages.forEach(function (message) {
58 var _a;
59 var id = serializer.digest(message);
60 if (!messages.hasOwnProperty(id)) {
61 messages[id] = message;
62 }
63 else {
64 (_a = messages[id].sources).push.apply(_a, tslib_1.__spreadArray([], tslib_1.__read(message.sources)));
65 }
66 });
67 // Transform placeholder names using the serializer mapping
68 var msgList = Object.keys(messages).map(function (id) {
69 var mapper = serializer.createNameMapper(messages[id]);
70 var src = messages[id];
71 var nodes = mapper ? mapperVisitor.convert(src.nodes, mapper) : src.nodes;
72 var transformedMessage = new i18n.Message(nodes, {}, {}, src.meaning, src.description, id);
73 transformedMessage.sources = src.sources;
74 if (filterSources) {
75 transformedMessage.sources.forEach(function (source) { return source.filePath = filterSources(source.filePath); });
76 }
77 return transformedMessage;
78 });
79 return serializer.write(msgList, this._locale);
80 };
81 return MessageBundle;
82 }());
83 exports.MessageBundle = MessageBundle;
84 // Transform an i18n AST by renaming the placeholder nodes with the given mapper
85 var MapPlaceholderNames = /** @class */ (function (_super) {
86 tslib_1.__extends(MapPlaceholderNames, _super);
87 function MapPlaceholderNames() {
88 return _super !== null && _super.apply(this, arguments) || this;
89 }
90 MapPlaceholderNames.prototype.convert = function (nodes, mapper) {
91 var _this = this;
92 return mapper ? nodes.map(function (n) { return n.visit(_this, mapper); }) : nodes;
93 };
94 MapPlaceholderNames.prototype.visitTagPlaceholder = function (ph, mapper) {
95 var _this = this;
96 var startName = mapper.toPublicName(ph.startName);
97 var closeName = ph.closeName ? mapper.toPublicName(ph.closeName) : ph.closeName;
98 var children = ph.children.map(function (n) { return n.visit(_this, mapper); });
99 return new i18n.TagPlaceholder(ph.tag, ph.attrs, startName, closeName, children, ph.isVoid, ph.sourceSpan, ph.startSourceSpan, ph.endSourceSpan);
100 };
101 MapPlaceholderNames.prototype.visitPlaceholder = function (ph, mapper) {
102 return new i18n.Placeholder(ph.value, mapper.toPublicName(ph.name), ph.sourceSpan);
103 };
104 MapPlaceholderNames.prototype.visitIcuPlaceholder = function (ph, mapper) {
105 return new i18n.IcuPlaceholder(ph.value, mapper.toPublicName(ph.name), ph.sourceSpan);
106 };
107 return MapPlaceholderNames;
108 }(i18n.CloneVisitor));
109});
110//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWVzc2FnZV9idW5kbGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9jb21waWxlci9zcmMvaTE4bi9tZXNzYWdlX2J1bmRsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7Ozs7Ozs7Ozs7Ozs7O0lBTUgsZ0ZBQW1EO0lBQ25ELDBEQUFtQztJQUluQzs7T0FFRztJQUNIO1FBR0UsdUJBQ1ksV0FBdUIsRUFBVSxhQUF1QixFQUN4RCxjQUF1QyxFQUFVLE9BQTJCO1lBQTNCLHdCQUFBLEVBQUEsY0FBMkI7WUFENUUsZ0JBQVcsR0FBWCxXQUFXLENBQVk7WUFBVSxrQkFBYSxHQUFiLGFBQWEsQ0FBVTtZQUN4RCxtQkFBYyxHQUFkLGNBQWMsQ0FBeUI7WUFBVSxZQUFPLEdBQVAsT0FBTyxDQUFvQjtZQUpoRixjQUFTLEdBQW1CLEVBQUUsQ0FBQztRQUlvRCxDQUFDO1FBRTVGLDBDQUFrQixHQUFsQixVQUFtQixJQUFZLEVBQUUsR0FBVyxFQUFFLG1CQUF3Qzs7WUFFcEYsSUFBTSxnQkFBZ0IsR0FDbEIsSUFBSSxDQUFDLFdBQVcsQ0FBQyxLQUFLLENBQUMsSUFBSSxFQUFFLEdBQUcsRUFBRSxFQUFDLHNC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