平常开发中,咱们常常会在Github上发现一些好用的新框架, 如何对这些项目文档进行翻译, 其实这个问题困扰了我好久. 这里,我总结了一些不一样状况下所谓的最佳实践, 供你们参考:vue
举例: https://github.com/graphql/gr...git
GraphQL文档的网站, 是一个独立的项目, source分支是源码目录, master分支(能够理解为gh-pages分支)是静态站点.github
直接Fork
该项目, 示例: https://github.com/willin/gra...vue-router
Fork以后能够给该项目更名, 如我换到了 graphql.js.cool
域名, 并以该域名进行命名.bash
而后, 将项目Clone
至本地.框架
git clone git@github.com:willin/graphql.js.cool.git cd graphql.js.cool # 默认源码的分支是source, 能够新建一个分支用于翻译 git checkout -b cn git push -u origin cn
至此, 能够开始翻译工做了.fetch
# 一次性添加 git remote add remote git@github.com:graphql/graphql.github.io.git # 每次更新源站最新代码 git pull remote source
.git/config
文件参考:网站
[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true ignorecase = true precomposeunicode = true [remote "origin"] url = git@github.com:willin/graphql.js.cool.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "cn"] remote = origin merge = refs/heads/cn [travis] slug = willin/graphql.js.cool [remote "remote"] url = git@github.com:graphql/graphql.github.io.git fetch = +refs/heads/*:refs/remotes/remote/*
多是一个一个单独的分支, 或者只是某个分支的一个目录.url
以vue-router
项目为例, 文档位于dev
分支的docs
目录: https://github.com/vuejs/vue-...翻译
git init git remote add origin xxx # 你的项目路径 git remote add remote git@github.com:vuejs/vue-router.git # 拉取源站代码 git pull remote dev
# 每次更新源站最新代码 git pull remote dev
CNAME
等配置文件须要替换pull
后可能会有冲突. 解决后再提交代码.优秀的中文翻译项目及推荐的未翻译项目汇总: Awesome-CN