refactor(i18n): rename serialize into serializeXmb

This commit is contained in:
vsavkin 2016-03-27 11:12:48 -07:00 committed by Victor Savkin
parent 506f4ce1e5
commit 66cd84e0d5
3 changed files with 8 additions and 8 deletions

View File

@ -1,7 +1,7 @@
import {isPresent} from 'angular2/src/facade/lang';
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("");
return `<message-bundle>${ms}</message-bundle>`;
}

View File

@ -12,24 +12,24 @@ import {
} from 'angular2/testing_internal';
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() {
describe('Xmb Serialization', () => {
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 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 expected =
`<message-bundle><msg id='${id(m)}' desc='description'>content</msg></message-bundle>`;
expect(serialize([m])).toEqual(expected);
expect(serializeXmb([m])).toEqual(expected);
});
});
}

View File

@ -61,7 +61,7 @@ class I18nMessageExtractor {
I18nMessageExtractor(this.readInput);
String get output => serialize(removeDuplicates(messages));
String get output => serializeXmb(removeDuplicates(messages));
Future processLibrary(LibraryElement el) async {
return Future.wait(el.units.map(processCompilationUnit));