source: trip-planner-front/node_modules/@angular/compiler/src/i18n/serializers/xliff.js@ b738035

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

initial commit

  • Property mode set to 100644
File size: 45.2 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/serializers/xliff", ["require", "exports", "tslib", "@angular/compiler/src/ml_parser/ast", "@angular/compiler/src/ml_parser/xml_parser", "@angular/compiler/src/i18n/digest", "@angular/compiler/src/i18n/i18n_ast", "@angular/compiler/src/i18n/parse_util", "@angular/compiler/src/i18n/serializers/serializer", "@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.Xliff = void 0;
20 var tslib_1 = require("tslib");
21 var ml = require("@angular/compiler/src/ml_parser/ast");
22 var xml_parser_1 = require("@angular/compiler/src/ml_parser/xml_parser");
23 var digest_1 = require("@angular/compiler/src/i18n/digest");
24 var i18n = require("@angular/compiler/src/i18n/i18n_ast");
25 var parse_util_1 = require("@angular/compiler/src/i18n/parse_util");
26 var serializer_1 = require("@angular/compiler/src/i18n/serializers/serializer");
27 var xml = require("@angular/compiler/src/i18n/serializers/xml_helper");
28 var _VERSION = '1.2';
29 var _XMLNS = 'urn:oasis:names:tc:xliff:document:1.2';
30 // TODO(vicb): make this a param (s/_/-/)
31 var _DEFAULT_SOURCE_LANG = 'en';
32 var _PLACEHOLDER_TAG = 'x';
33 var _MARKER_TAG = 'mrk';
34 var _FILE_TAG = 'file';
35 var _SOURCE_TAG = 'source';
36 var _SEGMENT_SOURCE_TAG = 'seg-source';
37 var _ALT_TRANS_TAG = 'alt-trans';
38 var _TARGET_TAG = 'target';
39 var _UNIT_TAG = 'trans-unit';
40 var _CONTEXT_GROUP_TAG = 'context-group';
41 var _CONTEXT_TAG = 'context';
42 // https://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html
43 // https://docs.oasis-open.org/xliff/v1.2/xliff-profile-html/xliff-profile-html-1.2.html
44 var Xliff = /** @class */ (function (_super) {
45 tslib_1.__extends(Xliff, _super);
46 function Xliff() {
47 return _super !== null && _super.apply(this, arguments) || this;
48 }
49 Xliff.prototype.write = function (messages, locale) {
50 var visitor = new _WriteVisitor();
51 var transUnits = [];
52 messages.forEach(function (message) {
53 var _a;
54 var contextTags = [];
55 message.sources.forEach(function (source) {
56 var contextGroupTag = new xml.Tag(_CONTEXT_GROUP_TAG, { purpose: 'location' });
57 contextGroupTag.children.push(new xml.CR(10), new xml.Tag(_CONTEXT_TAG, { 'context-type': 'sourcefile' }, [new xml.Text(source.filePath)]), new xml.CR(10), new xml.Tag(_CONTEXT_TAG, { 'context-type': 'linenumber' }, [new xml.Text("" + source.startLine)]), new xml.CR(8));
58 contextTags.push(new xml.CR(8), contextGroupTag);
59 });
60 var transUnit = new xml.Tag(_UNIT_TAG, { id: message.id, datatype: 'html' });
61 (_a = transUnit.children).push.apply(_a, tslib_1.__spreadArray([new xml.CR(8), new xml.Tag(_SOURCE_TAG, {}, visitor.serialize(message.nodes))], tslib_1.__read(contextTags)));
62 if (message.description) {
63 transUnit.children.push(new xml.CR(8), new xml.Tag('note', { priority: '1', from: 'description' }, [new xml.Text(message.description)]));
64 }
65 if (message.meaning) {
66 transUnit.children.push(new xml.CR(8), new xml.Tag('note', { priority: '1', from: 'meaning' }, [new xml.Text(message.meaning)]));
67 }
68 transUnit.children.push(new xml.CR(6));
69 transUnits.push(new xml.CR(6), transUnit);
70 });
71 var body = new xml.Tag('body', {}, tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(transUnits)), [new xml.CR(4)]));
72 var file = new xml.Tag('file', {
73 'source-language': locale || _DEFAULT_SOURCE_LANG,
74 datatype: 'plaintext',
75 original: 'ng2.template',
76 }, [new xml.CR(4), body, new xml.CR(2)]);
77 var xliff = new xml.Tag('xliff', { version: _VERSION, xmlns: _XMLNS }, [new xml.CR(2), file, new xml.CR()]);
78 return xml.serialize([
79 new xml.Declaration({ version: '1.0', encoding: 'UTF-8' }), new xml.CR(), xliff, new xml.CR()
80 ]);
81 };
82 Xliff.prototype.load = function (content, url) {
83 // xliff to xml nodes
84 var xliffParser = new XliffParser();
85 var _a = xliffParser.parse(content, url), locale = _a.locale, msgIdToHtml = _a.msgIdToHtml, errors = _a.errors;
86 // xml nodes to i18n nodes
87 var i18nNodesByMsgId = {};
88 var converter = new XmlToI18n();
89 Object.keys(msgIdToHtml).forEach(function (msgId) {
90 var _a = converter.convert(msgIdToHtml[msgId], url), i18nNodes = _a.i18nNodes, e = _a.errors;
91 errors.push.apply(errors, tslib_1.__spreadArray([], tslib_1.__read(e)));
92 i18nNodesByMsgId[msgId] = i18nNodes;
93 });
94 if (errors.length) {
95 throw new Error("xliff parse errors:\n" + errors.join('\n'));
96 }
97 return { locale: locale, i18nNodesByMsgId: i18nNodesByMsgId };
98 };
99 Xliff.prototype.digest = function (message) {
100 return digest_1.digest(message);
101 };
102 return Xliff;
103 }(serializer_1.Serializer));
104 exports.Xliff = Xliff;
105 var _WriteVisitor = /** @class */ (function () {
106 function _WriteVisitor() {
107 }
108 _WriteVisitor.prototype.visitText = function (text, context) {
109 return [new xml.Text(text.value)];
110 };
111 _WriteVisitor.prototype.visitContainer = function (container, context) {
112 var _this = this;
113 var nodes = [];
114 container.children.forEach(function (node) { return nodes.push.apply(nodes, tslib_1.__spreadArray([], tslib_1.__read(node.visit(_this)))); });
115 return nodes;
116 };
117 _WriteVisitor.prototype.visitIcu = function (icu, context) {
118 var _this = this;
119 var nodes = [new xml.Text("{" + icu.expressionPlaceholder + ", " + icu.type + ", ")];
120 Object.keys(icu.cases).forEach(function (c) {
121 nodes.push.apply(nodes, tslib_1.__spreadArray(tslib_1.__spreadArray([new xml.Text(c + " {")], tslib_1.__read(icu.cases[c].visit(_this))), [new xml.Text("} ")]));
122 });
123 nodes.push(new xml.Text("}"));
124 return nodes;
125 };
126 _WriteVisitor.prototype.visitTagPlaceholder = function (ph, context) {
127 var ctype = getCtypeForTag(ph.tag);
128 if (ph.isVoid) {
129 // void tags have no children nor closing tags
130 return [new xml.Tag(_PLACEHOLDER_TAG, { id: ph.startName, ctype: ctype, 'equiv-text': "<" + ph.tag + "/>" })];
131 }
132 var startTagPh = new xml.Tag(_PLACEHOLDER_TAG, { id: ph.startName, ctype: ctype, 'equiv-text': "<" + ph.tag + ">" });
133 var closeTagPh = new xml.Tag(_PLACEHOLDER_TAG, { id: ph.closeName, ctype: ctype, 'equiv-text': "</" + ph.tag + ">" });
134 return tslib_1.__spreadArray(tslib_1.__spreadArray([startTagPh], tslib_1.__read(this.serialize(ph.children))), [closeTagPh]);
135 };
136 _WriteVisitor.prototype.visitPlaceholder = function (ph, context) {
137 return [new xml.Tag(_PLACEHOLDER_TAG, { id: ph.name, 'equiv-text': "{{" + ph.value + "}}" })];
138 };
139 _WriteVisitor.prototype.visitIcuPlaceholder = function (ph, context) {
140 var equivText = "{" + ph.value.expression + ", " + ph.value.type + ", " + Object.keys(ph.value.cases).map(function (value) { return value + ' {...}'; }).join(' ') + "}";
141 return [new xml.Tag(_PLACEHOLDER_TAG, { id: ph.name, 'equiv-text': equivText })];
142 };
143 _WriteVisitor.prototype.serialize = function (nodes) {
144 var _this = this;
145 return [].concat.apply([], tslib_1.__spreadArray([], tslib_1.__read(nodes.map(function (node) { return node.visit(_this); }))));
146 };
147 return _WriteVisitor;
148 }());
149 // TODO(vicb): add error management (structure)
150 // Extract messages as xml nodes from the xliff file
151 var XliffParser = /** @class */ (function () {
152 function XliffParser() {
153 this._locale = null;
154 }
155 XliffParser.prototype.parse = function (xliff, url) {
156 this._unitMlString = null;
157 this._msgIdToHtml = {};
158 var xml = new xml_parser_1.XmlParser().parse(xliff, url);
159 this._errors = xml.errors;
160 ml.visitAll(this, xml.rootNodes, null);
161 return {
162 msgIdToHtml: this._msgIdToHtml,
163 errors: this._errors,
164 locale: this._locale,
165 };
166 };
167 XliffParser.prototype.visitElement = function (element, context) {
168 switch (element.name) {
169 case _UNIT_TAG:
170 this._unitMlString = null;
171 var idAttr = element.attrs.find(function (attr) { return attr.name === 'id'; });
172 if (!idAttr) {
173 this._addError(element, "<" + _UNIT_TAG + "> misses the \"id\" attribute");
174 }
175 else {
176 var id = idAttr.value;
177 if (this._msgIdToHtml.hasOwnProperty(id)) {
178 this._addError(element, "Duplicated translations for msg " + id);
179 }
180 else {
181 ml.visitAll(this, element.children, null);
182 if (typeof this._unitMlString === 'string') {
183 this._msgIdToHtml[id] = this._unitMlString;
184 }
185 else {
186 this._addError(element, "Message " + id + " misses a translation");
187 }
188 }
189 }
190 break;
191 // ignore those tags
192 case _SOURCE_TAG:
193 case _SEGMENT_SOURCE_TAG:
194 case _ALT_TRANS_TAG:
195 break;
196 case _TARGET_TAG:
197 var innerTextStart = element.startSourceSpan.end.offset;
198 var innerTextEnd = element.endSourceSpan.start.offset;
199 var content = element.startSourceSpan.start.file.content;
200 var innerText = content.slice(innerTextStart, innerTextEnd);
201 this._unitMlString = innerText;
202 break;
203 case _FILE_TAG:
204 var localeAttr = element.attrs.find(function (attr) { return attr.name === 'target-language'; });
205 if (localeAttr) {
206 this._locale = localeAttr.value;
207 }
208 ml.visitAll(this, element.children, null);
209 break;
210 default:
211 // TODO(vicb): assert file structure, xliff version
212 // For now only recurse on unhandled nodes
213 ml.visitAll(this, element.children, null);
214 }
215 };
216 XliffParser.prototype.visitAttribute = function (attribute, context) { };
217 XliffParser.prototype.visitText = function (text, context) { };
218 XliffParser.prototype.visitComment = function (comment, context) { };
219 XliffParser.prototype.visitExpansion = function (expansion, context) { };
220 XliffParser.prototype.visitExpansionCase = function (expansionCase, context) { };
221 XliffParser.prototype._addError = function (node, message) {
222 this._errors.push(new parse_util_1.I18nError(node.sourceSpan, message));
223 };
224 return XliffParser;
225 }());
226 // Convert ml nodes (xliff syntax) to i18n nodes
227 var XmlToI18n = /** @class */ (function () {
228 function XmlToI18n() {
229 }
230 XmlToI18n.prototype.convert = function (message, url) {
231 var xmlIcu = new xml_parser_1.XmlParser().parse(message, url, { tokenizeExpansionForms: true });
232 this._errors = xmlIcu.errors;
233 var i18nNodes = this._errors.length > 0 || xmlIcu.rootNodes.length == 0 ?
234 [] : [].concat.apply([], tslib_1.__spreadArray([], tslib_1.__read(ml.visitAll(this, xmlIcu.rootNodes))));
235 return {
236 i18nNodes: i18nNodes,
237 errors: this._errors,
238 };
239 };
240 XmlToI18n.prototype.visitText = function (text, context) {
241 return new i18n.Text(text.value, text.sourceSpan);
242 };
243 XmlToI18n.prototype.visitElement = function (el, context) {
244 if (el.name === _PLACEHOLDER_TAG) {
245 var nameAttr = el.attrs.find(function (attr) { return attr.name === 'id'; });
246 if (nameAttr) {
247 return new i18n.Placeholder('', nameAttr.value, el.sourceSpan);
248 }
249 this._addError(el, "<" + _PLACEHOLDER_TAG + "> misses the \"id\" attribute");
250 return null;
251 }
252 if (el.name === _MARKER_TAG) {
253 return [].concat.apply([], tslib_1.__spreadArray([], tslib_1.__read(ml.visitAll(this, el.children))));
254 }
255 this._addError(el, "Unexpected tag");
256 return null;
257 };
258 XmlToI18n.prototype.visitExpansion = function (icu, context) {
259 var caseMap = {};
260 ml.visitAll(this, icu.cases).forEach(function (c) {
261 caseMap[c.value] = new i18n.Container(c.nodes, icu.sourceSpan);
262 });
263 return new i18n.Icu(icu.switchValue, icu.type, caseMap, icu.sourceSpan);
264 };
265 XmlToI18n.prototype.visitExpansionCase = function (icuCase, context) {
266 return {
267 value: icuCase.value,
268 nodes: ml.visitAll(this, icuCase.expression),
269 };
270 };
271 XmlToI18n.prototype.visitComment = function (comment, context) { };
272 XmlToI18n.prototype.visitAttribute = function (attribute, context) { };
273 XmlToI18n.prototype._addError = function (node, message) {
274 this._errors.push(new parse_util_1.I18nError(node.sourceSpan, message));
275 };
276 return XmlToI18n;
277 }());
278 function getCtypeForTag(tag) {
279 switch (tag.toLowerCase()) {
280 case 'br':
281 return 'lb';
282 case 'img':
283 return 'image';
284 default:
285 return "x-" + tag;
286 }
287 }
288});
289//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoieGxpZmYuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9jb21waWxlci9zcmMvaTE4bi9zZXJpYWxpemVycy94bGlmZi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7Ozs7Ozs7Ozs7Ozs7O0lBRUgsd0RBQTBDO0lBQzFDLHlFQUFxRDtJQUNyRCw0REFBaUM7SUFDakMsMERBQW9DO0lBQ3BDLG9FQUF3QztJQUV4QyxnRkFBd0M7SUFDeEMsdUVBQW9DO0lBRXBDLElBQU0sUUFBUSxHQUFHLEtBQUssQ0FBQztJQUN2QixJQUFNLE1BQU0sR0FBRyx1Q0FBdUMsQ0FBQztJQUN2RCx5Q0FBeUM7SUFDekMsSUFBTSxvQkFBb0IsR0FBRyxJQUFJLENBQUM7SUFDbEMsSUFBTSxnQkFBZ0IsR0FBRyxHQUFHLENBQUM7SUFDN0IsSUFBTSxXQUFXLEdBQUcsS0FBSyxDQUFDO0lBRTFCLElBQU0sU0FBUyxHQUFHLE1BQU0sQ0FBQztJQUN6QixJQUFNLFdBQVcsR0FBRyxRQUFRLENBQUM7SUFDN0IsSUFBTSxtQkFBbUIsR0FBRyxZQUFZLENBQUM7SUFDekMsSUFBTSxjQUFjLEdBQUcsV0FBVyxDQUFDO0lBQ25DLElBQU0sV0FBVyxHQUFHLFFBQVEsQ0FBQztJQUM3QixJQUFNLFNBQVMsR0FBRyxZQUFZLENBQUM7SUFDL0IsSUFBTSxrQkFB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ZS5zb3VyY2VTcGFuLCBtZXNzYWdlKSk7XG4gIH1cbn1cblxuZnVuY3Rpb24gZ2V0Q3R5cGVGb3JUYWcodGFnOiBzdHJpbmcpOiBzdHJpbmcge1xuICBzd2l0Y2ggKHRhZy50b0xvd2VyQ2FzZSgpKSB7XG4gICAgY2FzZSAnYnInOlxuICAgICAgcmV0dXJuICdsYic7XG4gICAgY2FzZSAnaW1nJzpcbiAgICAgIHJldHVybiAnaW1hZ2UnO1xuICAgIGRlZmF1bHQ6XG4gICAgICByZXR1cm4gYHgtJHt0YWd9YDtcbiAgfVxufVxuIl19
Note: See TracBrowser for help on using the repository browser.