Giter Site home page Giter Site logo

node-doc-cn's Introduction

Node.js API 中文版在线翻译系统

安装

系统环境要求:

  • MySQL 5.x
  • Node.js >= 0.8
git clone https://github.com/leizongmin/node-doc-cn.git
cd node-doc-cn
cp config.default.js config.js
  • tables.sql 导入数据库中
  • 修改配置文件 config.js
npm install
node app

工作原理

Node.js 的 API 文档是使用 Markdown 格式来编写的,这种文档有一个共同特征:每个 段落都是通过一个空行来分割的。

在翻译之前,先通过程序 tool/import_origin.js 来读取 origin/api 目录下的所有 .markdown 文件,并分割为多个段落,存储到数据库中。

每个段落都会根据其内容,用 md5() 来生成一个 hash 属性,翻译的时候,每条翻译 结果也对应与该段落的 hash

当 Node.js API有更新时,重新分割文档的 markdown 文件即可,大多数的段落内容没有 更改,那么仍然能使用旧的翻译结果。

授权

MIT

node-doc-cn's People

Contributors

kaiyuan avatar leizongmin avatar xingrz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-doc-cn's Issues

待翻译完成后,需要人工整理

  • 处理段落类型识别不准确问题:
    • 有些代码块是 ``` 开头的,而导入的时候是根据4个空格来判断的
    • 在代码段中有空行时,被拆分了,需要合并
  • 翻译结果页面,中英文对照

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper App’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.

在文档页面中显示“纠错”和“翻译”按钮

对于还没有翻译的段落,应该在旁边显示“翻译”按钮,方便直接提交翻译。
对于已经翻译的锻炼,在旁边显示“纠错”按钮,以便于发现错误后提交更正,同时可以选择不同的翻译结果

代码块缺失问题

smalloc章节的代码块有缺失,需要检查一下合并相邻代码块的程序是否有问题

再次导入API原文档时,可能会丢失部分已翻译的数据

翻译结果是按照段落内容的md5值来区分的,当使用不同的的设定从git中导入代码、或者使用了不同的编辑器编辑后,可能会导致换行符改变了(比如原来是 \n ,修改后变成了 \r\n ),这样虽然看起来内容是一样的,但是md5值却不同了。

待翻译完后,需要修正一下数据库内容:

  • 把换行符统一转换为 \n
  • 对相邻的代块进行合并

示例代码丢失严重,如:http模块的http.request(options, [callback])的示例代码

URL:http://nodeapi.ucdok.com/api/http.html#http_http_request_options_callback_3163
中文版的只有:
// write data to request body
req.write('data\n');
req.write('data\n');
req.end();

英文版的为:
var options = {
hostname: 'www.google.com',
port: 80,
path: '/upload',
method: 'POST'
};

var req = http.request(options, function(res) {
console.log('STATUS: ' + res.statusCode);
console.log('HEADERS: ' + JSON.stringify(res.headers));
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log('BODY: ' + chunk);
});
});

req.on('error', function(e) {
console.log('problem with request: ' + e.message);
});

// write data to request body
req.write('data\n');
req.write('data\n');
req.end();

类似的情况在中文版API里还不少

建议

建议弄成 英中文对照阅读 的格式。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.