平常開發中,咱們常常會在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