diff --git a/modules/@angular/compiler/src/i18n/serializers/xmb.ts b/modules/@angular/compiler/src/i18n/serializers/xmb.ts
index 3834ee3938..1df69b7ad1 100644
--- a/modules/@angular/compiler/src/i18n/serializers/xmb.ts
+++ b/modules/@angular/compiler/src/i18n/serializers/xmb.ts
@@ -119,11 +119,11 @@ class _Visitor implements i18n.Visitor {
}
visitPlaceholder(ph: i18n.Placeholder, context?: any): xml.Node[] {
- return [new xml.Tag(_PLACEHOLDER_TAG, {name: ph.name})];
+ return [new xml.Tag(_PLACEHOLDER_TAG, {name: ph.name}, [], false)];
}
visitIcuPlaceholder(ph: i18n.IcuPlaceholder, context?: any): xml.Node[] {
- return [new xml.Tag(_PLACEHOLDER_TAG, {name: ph.name})];
+ return [new xml.Tag(_PLACEHOLDER_TAG, {name: ph.name}, [], false)];
}
serialize(nodes: i18n.Node[]): xml.Node[] {
diff --git a/modules/@angular/compiler/src/i18n/serializers/xml_helper.ts b/modules/@angular/compiler/src/i18n/serializers/xml_helper.ts
index e7cbc8bbcb..cf01674b5e 100644
--- a/modules/@angular/compiler/src/i18n/serializers/xml_helper.ts
+++ b/modules/@angular/compiler/src/i18n/serializers/xml_helper.ts
@@ -18,7 +18,8 @@ class _Visitor implements IVisitor {
const strAttrs = this._serializeAttributes(tag.attrs);
if (tag.children.length == 0) {
- return `<${tag.name}${strAttrs}/>`;
+ return tag.canSelfClose ? `<${tag.name}${strAttrs}/>` :
+ `<${tag.name}${strAttrs}>${tag.name}>`;
}
const strChildren = tag.children.map(node => node.visit(this));
@@ -71,8 +72,8 @@ export class Tag implements Node {
public attrs: {[k: string]: string} = {};
constructor(
- public name: string, unescapedAttrs: {[k: string]: string} = {},
- public children: Node[] = []) {
+ public name: string, unescapedAttrs: {[k: string]: string} = {}, public children: Node[] = [],
+ public canSelfClose: boolean = true) {
Object.keys(unescapedAttrs).forEach((k: string) => {
this.attrs[k] = _escapeXml(unescapedAttrs[k]);
});
diff --git a/modules/@angular/compiler/test/i18n/integration_spec.ts b/modules/@angular/compiler/test/i18n/integration_spec.ts
index ade32405dd..1f725c4e34 100644
--- a/modules/@angular/compiler/test/i18n/integration_spec.ts
+++ b/modules/@angular/compiler/test/i18n/integration_spec.ts
@@ -200,9 +200,9 @@ const XMB = `
{VAR_SELECT, select, m {male} f {female} }
-
- sex =
-
+
+ sex = >
+
in a translatable section
<h1>Markers in html comments</h1>
diff --git a/modules/@angular/compiler/test/i18n/serializers/xmb_spec.ts b/modules/@angular/compiler/test/i18n/serializers/xmb_spec.ts
index 319370102e..390164f4d0 100644
--- a/modules/@angular/compiler/test/i18n/serializers/xmb_spec.ts
+++ b/modules/@angular/compiler/test/i18n/serializers/xmb_spec.ts
@@ -43,7 +43,7 @@ export function main(): void {
]>
- translatable element <b>with placeholders</b>
+ translatable element <b>with placeholders</b>
{VAR_PLURAL, plural, =0 {<p>test</p>} }
foo
{VAR_PLURAL, plural, =0 {{VAR_SELECT, select, other {<p>deeply nested</p>} } } }