fix(XmlHelper): declaration

This commit is contained in:
Victor Berchet 2016-08-12 21:26:03 -07:00 committed by Vikram Subramanian
parent 72bb38f83b
commit 96bf42261b
5 changed files with 6 additions and 6 deletions

View File

@ -15,7 +15,7 @@ describe('template i18n extraction output', () => {
const outDir = ''; const outDir = '';
it('should extract i18n messages', () => { it('should extract i18n messages', () => {
const EXPECTED = `<? xml version="1.0" encoding="UTF-8" ?> const EXPECTED = `<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE messagebundle [ <!DOCTYPE messagebundle [
<!ELEMENT messagebundle (msg)*> <!ELEMENT messagebundle (msg)*>
<!ATTLIST messagebundle class CDATA #IMPLIED> <!ATTLIST messagebundle class CDATA #IMPLIED>

View File

@ -28,7 +28,7 @@ class _Visitor implements IVisitor {
visitText(text: Text): string { return text.value; } visitText(text: Text): string { return text.value; }
visitDeclaration(decl: Declaration): string { visitDeclaration(decl: Declaration): string {
return `<? xml${this._serializeAttributes(decl.attrs)} ?>`; return `<?xml${this._serializeAttributes(decl.attrs)} ?>`;
} }
private _serializeAttributes(attrs: {[k: string]: string}) { private _serializeAttributes(attrs: {[k: string]: string}) {

View File

@ -22,7 +22,7 @@ export function main(): void {
<p i18n="m|d">foo</p> <p i18n="m|d">foo</p>
<p i18n>{ count, plural, =0 { { sex, gender, other {<p>deeply nested</p>}} }}</p>`; <p i18n>{ count, plural, =0 { { sex, gender, other {<p>deeply nested</p>}} }}</p>`;
const XMB = `<? xml version="1.0" encoding="UTF-8" ?> const XMB = `<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE messagebundle [ <!DOCTYPE messagebundle [
<!ELEMENT messagebundle (msg)*> <!ELEMENT messagebundle (msg)*>
<!ATTLIST messagebundle class CDATA #IMPLIED> <!ATTLIST messagebundle class CDATA #IMPLIED>

View File

@ -14,7 +14,7 @@ export function main(): void {
describe('XML helper', () => { describe('XML helper', () => {
it('should serialize XML declaration', () => { it('should serialize XML declaration', () => {
expect(xml.serialize([new xml.Declaration({version: '1.0'})])) expect(xml.serialize([new xml.Declaration({version: '1.0'})]))
.toEqual('<? xml version="1.0" ?>'); .toEqual('<?xml version="1.0" ?>');
}); });
it('should serialize text node', it('should serialize text node',

View File

@ -84,7 +84,7 @@ export function main(): void {
it('should replace ICU placeholders with their translations', () => { it('should replace ICU placeholders with their translations', () => {
const HTML = `<div i18n>-{ count, plural, =0 {<p>bar</p>}}-</div>`; const HTML = `<div i18n>-{ count, plural, =0 {<p>bar</p>}}-</div>`;
const XTB = `<? xml version="1.0" encoding="UTF-8" ?> const XTB = `<?xml version="1.0" encoding="UTF-8" ?>
<translationbundle> <translationbundle>
<translation id="eb404e202fed4846e25e7d9ac1fcb719fe4da257">*<ph name="ICU"/>*</translation> <translation id="eb404e202fed4846e25e7d9ac1fcb719fe4da257">*<ph name="ICU"/>*</translation>
<translation id="fc92b9b781194a02ab773129c8c5a7fc0735efd7">{ count, plural, =1 {<ph name="START_PARAGRAPH"/>rab<ph name="CLOSE_PARAGRAPH"/>}}</translation> <translation id="fc92b9b781194a02ab773129c8c5a7fc0735efd7">{ count, plural, =1 {<ph name="START_PARAGRAPH"/>rab<ph name="CLOSE_PARAGRAPH"/>}}</translation>
@ -103,7 +103,7 @@ export function main(): void {
<div i18n="m|d">foo</div> <div i18n="m|d">foo</div>
<div i18n>{ count, plural, =0 {{ sex, gender, other {<p>bar</p>}} }}</div>`; <div i18n>{ count, plural, =0 {{ sex, gender, other {<p>bar</p>}} }}</div>`;
const XTB = `<? xml version="1.0" encoding="UTF-8" ?> const XTB = `<?xml version="1.0" encoding="UTF-8" ?>
<translationbundle> <translationbundle>
<translation id="7103b4b13b616270a0044efade97d8b4f96f2ca6"><ph name="INTERPOLATION"/><ph name="START_BOLD_TEXT"/>rab<ph name="CLOSE_BOLD_TEXT"/> oof</translation> <translation id="7103b4b13b616270a0044efade97d8b4f96f2ca6"><ph name="INTERPOLATION"/><ph name="START_BOLD_TEXT"/>rab<ph name="CLOSE_BOLD_TEXT"/> oof</translation>
<translation id="fc92b9b781194a02ab773129c8c5a7fc0735efd7">{ count, plural, =1 {<ph name="START_PARAGRAPH"/>rab<ph name="CLOSE_PARAGRAPH"/>}}</translation> <translation id="fc92b9b781194a02ab773129c8c5a7fc0735efd7">{ count, plural, =1 {<ph name="START_PARAGRAPH"/>rab<ph name="CLOSE_PARAGRAPH"/>}}</translation>