/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ (function (factory) { if (typeof module === "object" && typeof module.exports === "object") { var v = factory(require, exports); if (v !== undefined) module.exports = v; } else if (typeof define === "function" && define.amd) { define("@angular/compiler/src/i18n/serializers/xliff2", ["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); } })(function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Xliff2 = void 0; var tslib_1 = require("tslib"); var ml = require("@angular/compiler/src/ml_parser/ast"); var xml_parser_1 = require("@angular/compiler/src/ml_parser/xml_parser"); var digest_1 = require("@angular/compiler/src/i18n/digest"); var i18n = require("@angular/compiler/src/i18n/i18n_ast"); var parse_util_1 = require("@angular/compiler/src/i18n/parse_util"); var serializer_1 = require("@angular/compiler/src/i18n/serializers/serializer"); var xml = require("@angular/compiler/src/i18n/serializers/xml_helper"); var _VERSION = '2.0'; var _XMLNS = 'urn:oasis:names:tc:xliff:document:2.0'; // TODO(vicb): make this a param (s/_/-/) var _DEFAULT_SOURCE_LANG = 'en'; var _PLACEHOLDER_TAG = 'ph'; var _PLACEHOLDER_SPANNING_TAG = 'pc'; var _MARKER_TAG = 'mrk'; var _XLIFF_TAG = 'xliff'; var _SOURCE_TAG = 'source'; var _TARGET_TAG = 'target'; var _UNIT_TAG = 'unit'; // https://docs.oasis-open.org/xliff/xliff-core/v2.0/os/xliff-core-v2.0-os.html var Xliff2 = /** @class */ (function (_super) { tslib_1.__extends(Xliff2, _super); function Xliff2() { return _super !== null && _super.apply(this, arguments) || this; } Xliff2.prototype.write = function (messages, locale) { var visitor = new _WriteVisitor(); var units = []; messages.forEach(function (message) { var unit = new xml.Tag(_UNIT_TAG, { id: message.id }); var notes = new xml.Tag('notes'); if (message.description || message.meaning) { if (message.description) { notes.children.push(new xml.CR(8), new xml.Tag('note', { category: 'description' }, [new xml.Text(message.description)])); } if (message.meaning) { notes.children.push(new xml.CR(8), new xml.Tag('note', { category: 'meaning' }, [new xml.Text(message.meaning)])); } } message.sources.forEach(function (source) { notes.children.push(new xml.CR(8), new xml.Tag('note', { category: 'location' }, [ new xml.Text(source.filePath + ":" + source.startLine + (source.endLine !== source.startLine ? ',' + source.endLine : '')) ])); }); notes.children.push(new xml.CR(6)); unit.children.push(new xml.CR(6), notes); var segment = new xml.Tag('segment'); segment.children.push(new xml.CR(8), new xml.Tag(_SOURCE_TAG, {}, visitor.serialize(message.nodes)), new xml.CR(6)); unit.children.push(new xml.CR(6), segment, new xml.CR(4)); units.push(new xml.CR(4), unit); }); var file = new xml.Tag('file', { 'original': 'ng.template', id: 'ngi18n' }, tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(units)), [new xml.CR(2)])); var xliff = new xml.Tag(_XLIFF_TAG, { version: _VERSION, xmlns: _XMLNS, srcLang: locale || _DEFAULT_SOURCE_LANG }, [new xml.CR(2), file, new xml.CR()]); return xml.serialize([ new xml.Declaration({ version: '1.0', encoding: 'UTF-8' }), new xml.CR(), xliff, new xml.CR() ]); }; Xliff2.prototype.load = function (content, url) { // xliff to xml nodes var xliff2Parser = new Xliff2Parser(); var _a = xliff2Parser.parse(content, url), locale = _a.locale, msgIdToHtml = _a.msgIdToHtml, errors = _a.errors; // xml nodes to i18n nodes var i18nNodesByMsgId = {}; var converter = new XmlToI18n(); Object.keys(msgIdToHtml).forEach(function (msgId) { var _a = converter.convert(msgIdToHtml[msgId], url), i18nNodes = _a.i18nNodes, e = _a.errors; errors.push.apply(errors, tslib_1.__spreadArray([], tslib_1.__read(e))); i18nNodesByMsgId[msgId] = i18nNodes; }); if (errors.length) { throw new Error("xliff2 parse errors:\n" + errors.join('\n')); } return { locale: locale, i18nNodesByMsgId: i18nNodesByMsgId }; }; Xliff2.prototype.digest = function (message) { return digest_1.decimalDigest(message); }; return Xliff2; }(serializer_1.Serializer)); exports.Xliff2 = Xliff2; var _WriteVisitor = /** @class */ (function () { function _WriteVisitor() { } _WriteVisitor.prototype.visitText = function (text, context) { return [new xml.Text(text.value)]; }; _WriteVisitor.prototype.visitContainer = function (container, context) { var _this = this; var nodes = []; container.children.forEach(function (node) { return nodes.push.apply(nodes, tslib_1.__spreadArray([], tslib_1.__read(node.visit(_this)))); }); return nodes; }; _WriteVisitor.prototype.visitIcu = function (icu, context) { var _this = this; var nodes = [new xml.Text("{" + icu.expressionPlaceholder + ", " + icu.type + ", ")]; Object.keys(icu.cases).forEach(function (c) { 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("} ")])); }); nodes.push(new xml.Text("}")); return nodes; }; _WriteVisitor.prototype.visitTagPlaceholder = function (ph, context) { var _this = this; var type = getTypeForTag(ph.tag); if (ph.isVoid) { var tagPh = new xml.Tag(_PLACEHOLDER_TAG, { id: (this._nextPlaceholderId++).toString(), equiv: ph.startName, type: type, disp: "<" + ph.tag + "/>", }); return [tagPh]; } var tagPc = new xml.Tag(_PLACEHOLDER_SPANNING_TAG, { id: (this._nextPlaceholderId++).toString(), equivStart: ph.startName, equivEnd: ph.closeName, type: type, dispStart: "<" + ph.tag + ">", dispEnd: "", }); var nodes = [].concat.apply([], tslib_1.__spreadArray([], tslib_1.__read(ph.children.map(function (node) { return node.visit(_this); })))); if (nodes.length) { nodes.forEach(function (node) { return tagPc.children.push(node); }); } else { tagPc.children.push(new xml.Text('')); } return [tagPc]; }; _WriteVisitor.prototype.visitPlaceholder = function (ph, context) { var idStr = (this._nextPlaceholderId++).toString(); return [new xml.Tag(_PLACEHOLDER_TAG, { id: idStr, equiv: ph.name, disp: "{{" + ph.value + "}}", })]; }; _WriteVisitor.prototype.visitIcuPlaceholder = function (ph, context) { var cases = Object.keys(ph.value.cases).map(function (value) { return value + ' {...}'; }).join(' '); var idStr = (this._nextPlaceholderId++).toString(); return [new xml.Tag(_PLACEHOLDER_TAG, { id: idStr, equiv: ph.name, disp: "{" + ph.value.expression + ", " + ph.value.type + ", " + cases + "}" })]; }; _WriteVisitor.prototype.serialize = function (nodes) { var _this = this; this._nextPlaceholderId = 0; return [].concat.apply([], tslib_1.__spreadArray([], tslib_1.__read(nodes.map(function (node) { return node.visit(_this); })))); }; return _WriteVisitor; }()); // Extract messages as xml nodes from the xliff file var Xliff2Parser = /** @class */ (function () { function Xliff2Parser() { this._locale = null; } Xliff2Parser.prototype.parse = function (xliff, url) { this._unitMlString = null; this._msgIdToHtml = {}; var xml = new xml_parser_1.XmlParser().parse(xliff, url); this._errors = xml.errors; ml.visitAll(this, xml.rootNodes, null); return { msgIdToHtml: this._msgIdToHtml, errors: this._errors, locale: this._locale, }; }; Xliff2Parser.prototype.visitElement = function (element, context) { switch (element.name) { case _UNIT_TAG: this._unitMlString = null; var idAttr = element.attrs.find(function (attr) { return attr.name === 'id'; }); if (!idAttr) { this._addError(element, "<" + _UNIT_TAG + "> misses the \"id\" attribute"); } else { var id = idAttr.value; if (this._msgIdToHtml.hasOwnProperty(id)) { this._addError(element, "Duplicated translations for msg " + id); } else { ml.visitAll(this, element.children, null); if (typeof this._unitMlString === 'string') { this._msgIdToHtml[id] = this._unitMlString; } else { this._addError(element, "Message " + id + " misses a translation"); } } } break; case _SOURCE_TAG: // ignore source message break; case _TARGET_TAG: var innerTextStart = element.startSourceSpan.end.offset; var innerTextEnd = element.endSourceSpan.start.offset; var content = element.startSourceSpan.start.file.content; var innerText = content.slice(innerTextStart, innerTextEnd); this._unitMlString = innerText; break; case _XLIFF_TAG: var localeAttr = element.attrs.find(function (attr) { return attr.name === 'trgLang'; }); if (localeAttr) { this._locale = localeAttr.value; } var versionAttr = element.attrs.find(function (attr) { return attr.name === 'version'; }); if (versionAttr) { var version = versionAttr.value; if (version !== '2.0') { this._addError(element, "The XLIFF file version " + version + " is not compatible with XLIFF 2.0 serializer"); } else { ml.visitAll(this, element.children, null); } } break; default: ml.visitAll(this, element.children, null); } }; Xliff2Parser.prototype.visitAttribute = function (attribute, context) { }; Xliff2Parser.prototype.visitText = function (text, context) { }; Xliff2Parser.prototype.visitComment = function (comment, context) { }; Xliff2Parser.prototype.visitExpansion = function (expansion, context) { }; Xliff2Parser.prototype.visitExpansionCase = function (expansionCase, context) { }; Xliff2Parser.prototype._addError = function (node, message) { this._errors.push(new parse_util_1.I18nError(node.sourceSpan, message)); }; return Xliff2Parser; }()); // Convert ml nodes (xliff syntax) to i18n nodes var XmlToI18n = /** @class */ (function () { function XmlToI18n() { } XmlToI18n.prototype.convert = function (message, url) { var xmlIcu = new xml_parser_1.XmlParser().parse(message, url, { tokenizeExpansionForms: true }); this._errors = xmlIcu.errors; var i18nNodes = this._errors.length > 0 || xmlIcu.rootNodes.length == 0 ? [] : [].concat.apply([], tslib_1.__spreadArray([], tslib_1.__read(ml.visitAll(this, xmlIcu.rootNodes)))); return { i18nNodes: i18nNodes, errors: this._errors, }; }; XmlToI18n.prototype.visitText = function (text, context) { return new i18n.Text(text.value, text.sourceSpan); }; XmlToI18n.prototype.visitElement = function (el, context) { var _this = this; switch (el.name) { case _PLACEHOLDER_TAG: var nameAttr = el.attrs.find(function (attr) { return attr.name === 'equiv'; }); if (nameAttr) { return [new i18n.Placeholder('', nameAttr.value, el.sourceSpan)]; } this._addError(el, "<" + _PLACEHOLDER_TAG + "> misses the \"equiv\" attribute"); break; case _PLACEHOLDER_SPANNING_TAG: var startAttr = el.attrs.find(function (attr) { return attr.name === 'equivStart'; }); var endAttr = el.attrs.find(function (attr) { return attr.name === 'equivEnd'; }); if (!startAttr) { this._addError(el, "<" + _PLACEHOLDER_TAG + "> misses the \"equivStart\" attribute"); } else if (!endAttr) { this._addError(el, "<" + _PLACEHOLDER_TAG + "> misses the \"equivEnd\" attribute"); } else { var startId = startAttr.value; var endId = endAttr.value; var nodes = []; return nodes.concat.apply(nodes, tslib_1.__spreadArray(tslib_1.__spreadArray([new i18n.Placeholder('', startId, el.sourceSpan)], tslib_1.__read(el.children.map(function (node) { return node.visit(_this, null); }))), [new i18n.Placeholder('', endId, el.sourceSpan)])); } break; case _MARKER_TAG: return [].concat.apply([], tslib_1.__spreadArray([], tslib_1.__read(ml.visitAll(this, el.children)))); default: this._addError(el, "Unexpected tag"); } return null; }; XmlToI18n.prototype.visitExpansion = function (icu, context) { var caseMap = {}; ml.visitAll(this, icu.cases).forEach(function (c) { caseMap[c.value] = new i18n.Container(c.nodes, icu.sourceSpan); }); return new i18n.Icu(icu.switchValue, icu.type, caseMap, icu.sourceSpan); }; XmlToI18n.prototype.visitExpansionCase = function (icuCase, context) { return { value: icuCase.value, nodes: [].concat.apply([], tslib_1.__spreadArray([], tslib_1.__read(ml.visitAll(this, icuCase.expression)))), }; }; XmlToI18n.prototype.visitComment = function (comment, context) { }; XmlToI18n.prototype.visitAttribute = function (attribute, context) { }; XmlToI18n.prototype._addError = function (node, message) { this._errors.push(new parse_util_1.I18nError(node.sourceSpan, message)); }; return XmlToI18n; }()); function getTypeForTag(tag) { switch (tag.toLowerCase()) { case 'br': case 'b': case 'i': case 'u': return 'fmt'; case 'img': return 'image'; case 'a': return 'link'; default: return 'other'; } } }); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoieGxpZmYyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvY29tcGlsZXIvc3JjL2kxOG4vc2VyaWFsaXplcnMveGxpZmYyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRzs7Ozs7Ozs7Ozs7Ozs7SUFFSCx3REFBMEM7SUFDMUMseUVBQXFEO0lBQ3JELDREQUF3QztJQUN4QywwREFBb0M7SUFDcE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uZXJUZXh0U3RhcnQsIGlubmVyVGV4dEVuZCk7XG4gICAgICAgIHRoaXMuX3VuaXRNbFN0cmluZyA9IGlubmVyVGV4dDtcbiAgICAgICAgYnJlYWs7XG5cbiAgICAgIGNhc2UgX1hMSUZGX1RBRzpcbiAgICAgICAgY29uc3QgbG9jYWxlQXR0ciA9IGVsZW1lbnQuYXR0cnMuZmluZCgoYXR0cikgPT4gYXR0ci5uYW1lID09PSAndHJnTGFuZycpO1xuICAgICAgICBpZiAobG9jYWxlQXR0cikge1xuICAgICAgICAgIHRoaXMuX2xvY2FsZSA9IGxvY2FsZUF0dHIudmFsdWU7XG4gICAgICAgIH1cblxuICAgICAgICBjb25zdCB2ZXJzaW9uQXR0ciA9IGVsZW1lbnQuYXR0cnMuZmluZCgoYXR0cikgPT4gYXR0ci5uYW1lID09PSAndmVyc2lvbicpO1xuICAgICAgICBpZiAodmVyc2lvbkF0dHIpIHtcbiAgICAgICAgICBjb25zdCB2ZXJzaW9uID0gdmVyc2lvbkF0dHIudmFsdWU7XG4gICAgICAgICAgaWYgKHZlcnNpb24gIT09ICcyLjAnKSB7XG4gICAgICAgICAgICB0aGlzLl9hZGRFcnJvcihcbiAgICAgICAgICAgICAgICBlbGVtZW50LFxuICAgICAgICAgICAgICAgIGBUaGUgWExJRkYgZmlsZSB2ZXJzaW9uICR7dmVyc2lvbn0gaXMgbm90IGNvbXBhdGlibGUgd2l0aCBYTElGRiAyLjAgc2VyaWFsaXplcmApO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBtbC52aXNpdEFsbCh0aGlzLCBlbGVtZW50LmNoaWxkcmVuLCBudWxsKTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgYnJlYWs7XG4gICAgICBkZWZhdWx0OlxuICAgICAgICBtbC52aXNpdEFsbCh0aGlzLCBlbGVtZW50LmNoaWxkcmVuLCBudWxsKTtcbiAgICB9XG4gIH1cblxuICB2aXNpdEF0dHJpYnV0ZShhdH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