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/xmb", ["require", "exports", "tslib", "@angular/compiler/src/i18n/digest", "@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.toPublicName = exports.digest = exports.Xmb = void 0;
|
---|
20 | var tslib_1 = require("tslib");
|
---|
21 | var digest_1 = require("@angular/compiler/src/i18n/digest");
|
---|
22 | var serializer_1 = require("@angular/compiler/src/i18n/serializers/serializer");
|
---|
23 | var xml = require("@angular/compiler/src/i18n/serializers/xml_helper");
|
---|
24 | var _MESSAGES_TAG = 'messagebundle';
|
---|
25 | var _MESSAGE_TAG = 'msg';
|
---|
26 | var _PLACEHOLDER_TAG = 'ph';
|
---|
27 | var _EXAMPLE_TAG = 'ex';
|
---|
28 | var _SOURCE_TAG = 'source';
|
---|
29 | var _DOCTYPE = "<!ELEMENT messagebundle (msg)*>\n<!ATTLIST messagebundle class CDATA #IMPLIED>\n\n<!ELEMENT msg (#PCDATA|ph|source)*>\n<!ATTLIST msg id CDATA #IMPLIED>\n<!ATTLIST msg seq CDATA #IMPLIED>\n<!ATTLIST msg name CDATA #IMPLIED>\n<!ATTLIST msg desc CDATA #IMPLIED>\n<!ATTLIST msg meaning CDATA #IMPLIED>\n<!ATTLIST msg obsolete (obsolete) #IMPLIED>\n<!ATTLIST msg xml:space (default|preserve) \"default\">\n<!ATTLIST msg is_hidden CDATA #IMPLIED>\n\n<!ELEMENT source (#PCDATA)>\n\n<!ELEMENT ph (#PCDATA|ex)*>\n<!ATTLIST ph name CDATA #REQUIRED>\n\n<!ELEMENT ex (#PCDATA)>";
|
---|
30 | var Xmb = /** @class */ (function (_super) {
|
---|
31 | tslib_1.__extends(Xmb, _super);
|
---|
32 | function Xmb() {
|
---|
33 | return _super !== null && _super.apply(this, arguments) || this;
|
---|
34 | }
|
---|
35 | Xmb.prototype.write = function (messages, locale) {
|
---|
36 | var exampleVisitor = new ExampleVisitor();
|
---|
37 | var visitor = new _Visitor();
|
---|
38 | var rootNode = new xml.Tag(_MESSAGES_TAG);
|
---|
39 | messages.forEach(function (message) {
|
---|
40 | var attrs = { id: message.id };
|
---|
41 | if (message.description) {
|
---|
42 | attrs['desc'] = message.description;
|
---|
43 | }
|
---|
44 | if (message.meaning) {
|
---|
45 | attrs['meaning'] = message.meaning;
|
---|
46 | }
|
---|
47 | var sourceTags = [];
|
---|
48 | message.sources.forEach(function (source) {
|
---|
49 | sourceTags.push(new xml.Tag(_SOURCE_TAG, {}, [new xml.Text(source.filePath + ":" + source.startLine + (source.endLine !== source.startLine ? ',' + source.endLine : ''))]));
|
---|
50 | });
|
---|
51 | rootNode.children.push(new xml.CR(2), new xml.Tag(_MESSAGE_TAG, attrs, tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(sourceTags)), tslib_1.__read(visitor.serialize(message.nodes)))));
|
---|
52 | });
|
---|
53 | rootNode.children.push(new xml.CR());
|
---|
54 | return xml.serialize([
|
---|
55 | new xml.Declaration({ version: '1.0', encoding: 'UTF-8' }),
|
---|
56 | new xml.CR(),
|
---|
57 | new xml.Doctype(_MESSAGES_TAG, _DOCTYPE),
|
---|
58 | new xml.CR(),
|
---|
59 | exampleVisitor.addDefaultExamples(rootNode),
|
---|
60 | new xml.CR(),
|
---|
61 | ]);
|
---|
62 | };
|
---|
63 | Xmb.prototype.load = function (content, url) {
|
---|
64 | throw new Error('Unsupported');
|
---|
65 | };
|
---|
66 | Xmb.prototype.digest = function (message) {
|
---|
67 | return digest(message);
|
---|
68 | };
|
---|
69 | Xmb.prototype.createNameMapper = function (message) {
|
---|
70 | return new serializer_1.SimplePlaceholderMapper(message, toPublicName);
|
---|
71 | };
|
---|
72 | return Xmb;
|
---|
73 | }(serializer_1.Serializer));
|
---|
74 | exports.Xmb = Xmb;
|
---|
75 | var _Visitor = /** @class */ (function () {
|
---|
76 | function _Visitor() {
|
---|
77 | }
|
---|
78 | _Visitor.prototype.visitText = function (text, context) {
|
---|
79 | return [new xml.Text(text.value)];
|
---|
80 | };
|
---|
81 | _Visitor.prototype.visitContainer = function (container, context) {
|
---|
82 | var _this = this;
|
---|
83 | var nodes = [];
|
---|
84 | container.children.forEach(function (node) { return nodes.push.apply(nodes, tslib_1.__spreadArray([], tslib_1.__read(node.visit(_this)))); });
|
---|
85 | return nodes;
|
---|
86 | };
|
---|
87 | _Visitor.prototype.visitIcu = function (icu, context) {
|
---|
88 | var _this = this;
|
---|
89 | var nodes = [new xml.Text("{" + icu.expressionPlaceholder + ", " + icu.type + ", ")];
|
---|
90 | Object.keys(icu.cases).forEach(function (c) {
|
---|
91 | 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("} ")]));
|
---|
92 | });
|
---|
93 | nodes.push(new xml.Text("}"));
|
---|
94 | return nodes;
|
---|
95 | };
|
---|
96 | _Visitor.prototype.visitTagPlaceholder = function (ph, context) {
|
---|
97 | var startTagAsText = new xml.Text("<" + ph.tag + ">");
|
---|
98 | var startEx = new xml.Tag(_EXAMPLE_TAG, {}, [startTagAsText]);
|
---|
99 | // TC requires PH to have a non empty EX, and uses the text node to show the "original" value.
|
---|
100 | var startTagPh = new xml.Tag(_PLACEHOLDER_TAG, { name: ph.startName }, [startEx, startTagAsText]);
|
---|
101 | if (ph.isVoid) {
|
---|
102 | // void tags have no children nor closing tags
|
---|
103 | return [startTagPh];
|
---|
104 | }
|
---|
105 | var closeTagAsText = new xml.Text("</" + ph.tag + ">");
|
---|
106 | var closeEx = new xml.Tag(_EXAMPLE_TAG, {}, [closeTagAsText]);
|
---|
107 | // TC requires PH to have a non empty EX, and uses the text node to show the "original" value.
|
---|
108 | var closeTagPh = new xml.Tag(_PLACEHOLDER_TAG, { name: ph.closeName }, [closeEx, closeTagAsText]);
|
---|
109 | return tslib_1.__spreadArray(tslib_1.__spreadArray([startTagPh], tslib_1.__read(this.serialize(ph.children))), [closeTagPh]);
|
---|
110 | };
|
---|
111 | _Visitor.prototype.visitPlaceholder = function (ph, context) {
|
---|
112 | var interpolationAsText = new xml.Text("{{" + ph.value + "}}");
|
---|
113 | // Example tag needs to be not-empty for TC.
|
---|
114 | var exTag = new xml.Tag(_EXAMPLE_TAG, {}, [interpolationAsText]);
|
---|
115 | return [
|
---|
116 | // TC requires PH to have a non empty EX, and uses the text node to show the "original" value.
|
---|
117 | new xml.Tag(_PLACEHOLDER_TAG, { name: ph.name }, [exTag, interpolationAsText])
|
---|
118 | ];
|
---|
119 | };
|
---|
120 | _Visitor.prototype.visitIcuPlaceholder = function (ph, context) {
|
---|
121 | var icuExpression = ph.value.expression;
|
---|
122 | var icuType = ph.value.type;
|
---|
123 | var icuCases = Object.keys(ph.value.cases).map(function (value) { return value + ' {...}'; }).join(' ');
|
---|
124 | var icuAsText = new xml.Text("{" + icuExpression + ", " + icuType + ", " + icuCases + "}");
|
---|
125 | var exTag = new xml.Tag(_EXAMPLE_TAG, {}, [icuAsText]);
|
---|
126 | return [
|
---|
127 | // TC requires PH to have a non empty EX, and uses the text node to show the "original" value.
|
---|
128 | new xml.Tag(_PLACEHOLDER_TAG, { name: ph.name }, [exTag, icuAsText])
|
---|
129 | ];
|
---|
130 | };
|
---|
131 | _Visitor.prototype.serialize = function (nodes) {
|
---|
132 | var _this = this;
|
---|
133 | return [].concat.apply([], tslib_1.__spreadArray([], tslib_1.__read(nodes.map(function (node) { return node.visit(_this); }))));
|
---|
134 | };
|
---|
135 | return _Visitor;
|
---|
136 | }());
|
---|
137 | function digest(message) {
|
---|
138 | return digest_1.decimalDigest(message);
|
---|
139 | }
|
---|
140 | exports.digest = digest;
|
---|
141 | // TC requires at least one non-empty example on placeholders
|
---|
142 | var ExampleVisitor = /** @class */ (function () {
|
---|
143 | function ExampleVisitor() {
|
---|
144 | }
|
---|
145 | ExampleVisitor.prototype.addDefaultExamples = function (node) {
|
---|
146 | node.visit(this);
|
---|
147 | return node;
|
---|
148 | };
|
---|
149 | ExampleVisitor.prototype.visitTag = function (tag) {
|
---|
150 | var _this = this;
|
---|
151 | if (tag.name === _PLACEHOLDER_TAG) {
|
---|
152 | if (!tag.children || tag.children.length == 0) {
|
---|
153 | var exText = new xml.Text(tag.attrs['name'] || '...');
|
---|
154 | tag.children = [new xml.Tag(_EXAMPLE_TAG, {}, [exText])];
|
---|
155 | }
|
---|
156 | }
|
---|
157 | else if (tag.children) {
|
---|
158 | tag.children.forEach(function (node) { return node.visit(_this); });
|
---|
159 | }
|
---|
160 | };
|
---|
161 | ExampleVisitor.prototype.visitText = function (text) { };
|
---|
162 | ExampleVisitor.prototype.visitDeclaration = function (decl) { };
|
---|
163 | ExampleVisitor.prototype.visitDoctype = function (doctype) { };
|
---|
164 | return ExampleVisitor;
|
---|
165 | }());
|
---|
166 | // XMB/XTB placeholders can only contain A-Z, 0-9 and _
|
---|
167 | function toPublicName(internalName) {
|
---|
168 | return internalName.toUpperCase().replace(/[^A-Z0-9_]/g, '_');
|
---|
169 | }
|
---|
170 | exports.toPublicName = toPublicName;
|
---|
171 | });
|
---|
172 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoieG1iLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvY29tcGlsZX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