From ee97046824d1b1ed4ec5c98aa27a6c4752b4f8d3 Mon Sep 17 00:00:00 2001 From: Zhicheng Wang Date: Fri, 2 Mar 2018 08:08:39 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=B5=8B=E8=AF=95=E6=96=AD=E8=A8=80?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E4=B8=AD=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aio/tools/translator/checker.spec.ts | 10 +++++----- aio/tools/translator/extractor.spec.ts | 14 +++++++------- aio/tools/translator/translate.spec.ts | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/aio/tools/translator/checker.spec.ts b/aio/tools/translator/checker.spec.ts index 3d4a736624..7ebccdefb4 100644 --- a/aio/tools/translator/checker.spec.ts +++ b/aio/tools/translator/checker.spec.ts @@ -3,24 +3,24 @@ import { DictEntry } from './dict-entry'; import { dirs } from './dirs'; import { gatherFromMarkdownFiles, isTranslation } from './extractor'; -describe('auto check translations', function () { +describe('自动检查翻译结果', function () { const entries = gatherFromMarkdownFiles(dirs.content) .filter(isNotCheatSheet) .filter(isNotMarketingDocs) .filter(isNotCnPages); - it('should not have in translation', function () { + it('译文里不应该出现 ', function () { const codeExamples = entries.filter(entry => entry.translation.indexOf(' isTranslation(entry.original)) .filter(isNotImg); expect(lines).eql([]); }); - it('should have same head level', function () { + it('原文和译文应该有相同的标题等级', function () { const lines = entries .filter(entry => isHead(entry.original) && isHead(entry.translation)) .filter(entry => { @@ -32,7 +32,7 @@ describe('auto check translations', function () { expect(lines).eql([]); }); - it('english should not be
/^ * { - it('should split empty string to empty array', function () { +describe('从对照翻译文件中采集生成字典', () => { + it('空字符串应该拆分成空数组', function () { expect(splitAndTrim()).eql([]); }); - it('should should break by double line break', function () { + it('按照双行(忽略空格)拆分对照文本', function () { const result = splitAndTrim(`a @@ -19,7 +19,7 @@ describe('gather to dictionary', () => { c`); }); - it('build map of original and translation', () => { + it('生成原文和译文的对照表', () => { const result = gatherTranslations(` a @@ -30,18 +30,18 @@ describe('gather to dictionary', () => { expect(result).eql([{original: 'a', translation: '一'}]); }); - it('should gather from real file', function () { + it('从真实的文件中采集', function () { const fs = require('fs'); const content = fs.readFileSync(dirs.content + 'guide/forms.md', 'utf-8'); const result = gatherTranslations(content); expect(result[0]).eql({original: '# Forms', translation: '# 表单'}); }); - it('should list files recursive', function () { + it('递归查找所有 markdown 文件', function () { expect(listMarkdownFiles(dirs.content).length).greaterThan(10); }); - it('should gather from directory', () => { + it('从对照文本的文件夹中采集生成字典(非测试)', () => { const entries = gatherFromMarkdownFiles(dirs.content); const dict = JSON.stringify(entries, null, 2); const fs = require('fs'); diff --git a/aio/tools/translator/translate.spec.ts b/aio/tools/translator/translate.spec.ts index 3bb52e6099..c6fcb0d5de 100644 --- a/aio/tools/translator/translate.spec.ts +++ b/aio/tools/translator/translate.spec.ts @@ -3,15 +3,15 @@ import { dirs } from './dirs'; import { dict, lookup, translate } from './translate'; -describe('translate with dict', () => { - it('should ignore wrong entry', function () { +describe('根据字典进行翻译', () => { + it('忽略明显错误的条目', function () { expect(dict.filter(entry => /^
{ + it('查字典', () => { expect(lookup('# Forms')[0].translation).eql('# 表单'); }); - it('should auto translate based on dict', function () { + it('自动根据字典翻译单个文件', function () { const fs = require('fs'); const content = fs.readFileSync(dirs.content + 'guide/forms.md', 'utf-8'); const result = translate(content);