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