angular-cn/aio/tools/translator/translate.spec.ts

23 lines
750 B
TypeScript
Raw Normal View History

import { expect } from 'chai';
2018-03-01 09:52:16 -05:00
import { dirs } from './dirs';
import { kernelText, lookup, translateDirectory, translateFile } from './translate';
2018-03-01 19:08:39 -05:00
describe('根据字典进行翻译', () => {
it('抽取核心字符', function () {
expect(kernelText(' # Forms ABC ')).eql('# Forms ABC');
});
2018-03-01 19:08:39 -05:00
it('查字典', () => {
expect(lookup('# Forms')[0].translation).eql('# 表单');
});
2018-03-01 09:52:16 -05:00
it('自动根据字典翻译单个文件(测试)', function () {
translateFile(__dirname + '/../../../../content-en/' + 'guide/forms.md', dirs.content + 'guide/forms.md');
});
it('自动根据字典翻译所有文件(非测试)', function () {
translateDirectory(__dirname + '/../../../../content-en/', dirs.content);
2018-03-01 09:52:16 -05:00
});
});