2016-06-01 17:58:11 -04:00
|
|
|
// Only needed to satisfy the check in core/src/util/decorators.ts
|
|
|
|
// TODO(alexeagle): maybe remove that check?
|
|
|
|
require('reflect-metadata');
|
2016-06-14 22:16:18 -04:00
|
|
|
|
|
|
|
require('@angular/platform-server/src/parse5_adapter.js').Parse5DomAdapter.makeCurrent();
|
2016-06-01 17:58:11 -04:00
|
|
|
require('zone.js/dist/zone-node.js');
|
|
|
|
require('zone.js/dist/long-stack-trace-zone.js');
|
|
|
|
let serializer = require('@angular/compiler/src/i18n/xmb_serializer.js');
|
|
|
|
|
|
|
|
import * as fs from 'fs';
|
|
|
|
import * as path from 'path';
|
|
|
|
|
2016-06-08 19:38:52 -04:00
|
|
|
describe('template i18n extraction output', () => {
|
2016-06-01 17:58:11 -04:00
|
|
|
const outDir = '';
|
|
|
|
|
2016-06-08 19:38:52 -04:00
|
|
|
it('should extract i18n messages', () => {
|
2016-06-01 17:58:11 -04:00
|
|
|
const xmbOutput = path.join(outDir, 'messages.xmb');
|
|
|
|
expect(fs.existsSync(xmbOutput)).toBeTruthy();
|
|
|
|
const xmb = fs.readFileSync(xmbOutput, {encoding: 'utf-8'});
|
|
|
|
const res = serializer.deserializeXmb(xmb);
|
|
|
|
const keys = Object.keys(res.messages);
|
|
|
|
expect(keys.length).toEqual(1);
|
|
|
|
expect(res.errors.length).toEqual(0);
|
|
|
|
expect(res.messages[keys[0]][0].value).toEqual('translate me');
|
|
|
|
});
|
|
|
|
});
|