refactor(i18n): rename serialize into serializeXmb
This commit is contained in:
parent
506f4ce1e5
commit
66cd84e0d5
|
@ -1,7 +1,7 @@
|
||||||
import {isPresent} from 'angular2/src/facade/lang';
|
import {isPresent} from 'angular2/src/facade/lang';
|
||||||
import {Message, id} from './message';
|
import {Message, id} from './message';
|
||||||
|
|
||||||
export function serialize(messages: Message[]): string {
|
export function serializeXmb(messages: Message[]): string {
|
||||||
let ms = messages.map((m) => _serializeMessage(m)).join("");
|
let ms = messages.map((m) => _serializeMessage(m)).join("");
|
||||||
return `<message-bundle>${ms}</message-bundle>`;
|
return `<message-bundle>${ms}</message-bundle>`;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,24 +12,24 @@ import {
|
||||||
} from 'angular2/testing_internal';
|
} from 'angular2/testing_internal';
|
||||||
|
|
||||||
import {Message, id} from 'angular2/src/i18n/message';
|
import {Message, id} from 'angular2/src/i18n/message';
|
||||||
import {serialize} from 'angular2/src/i18n/xmb_serializer';
|
import {serializeXmb} from 'angular2/src/i18n/xmb_serializer';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
describe('Xmb Serialization', () => {
|
describe('Xmb Serialization', () => {
|
||||||
it("should return an empty message bundle for an empty list of messages",
|
it("should return an empty message bundle for an empty list of messages",
|
||||||
() => { expect(serialize([])).toEqual("<message-bundle></message-bundle>"); });
|
() => { expect(serializeXmb([])).toEqual("<message-bundle></message-bundle>"); });
|
||||||
|
|
||||||
it("should serialize messages without desc", () => {
|
it("should serializeXmb messages without desc", () => {
|
||||||
let m = new Message("content", "meaning", null);
|
let m = new Message("content", "meaning", null);
|
||||||
let expected = `<message-bundle><msg id='${id(m)}'>content</msg></message-bundle>`;
|
let expected = `<message-bundle><msg id='${id(m)}'>content</msg></message-bundle>`;
|
||||||
expect(serialize([m])).toEqual(expected);
|
expect(serializeXmb([m])).toEqual(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should serialize messages with desc", () => {
|
it("should serializeXmb messages with desc", () => {
|
||||||
let m = new Message("content", "meaning", "description");
|
let m = new Message("content", "meaning", "description");
|
||||||
let expected =
|
let expected =
|
||||||
`<message-bundle><msg id='${id(m)}' desc='description'>content</msg></message-bundle>`;
|
`<message-bundle><msg id='${id(m)}' desc='description'>content</msg></message-bundle>`;
|
||||||
expect(serialize([m])).toEqual(expected);
|
expect(serializeXmb([m])).toEqual(expected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ class I18nMessageExtractor {
|
||||||
|
|
||||||
I18nMessageExtractor(this.readInput);
|
I18nMessageExtractor(this.readInput);
|
||||||
|
|
||||||
String get output => serialize(removeDuplicates(messages));
|
String get output => serializeXmb(removeDuplicates(messages));
|
||||||
|
|
||||||
Future processLibrary(LibraryElement el) async {
|
Future processLibrary(LibraryElement el) async {
|
||||||
return Future.wait(el.units.map(processCompilationUnit));
|
return Future.wait(el.units.map(processCompilationUnit));
|
||||||
|
|
Loading…
Reference in New Issue