開源項目翻譯正確姿式

平常開發中,咱們常常會在Github上發現一些好用的新框架, 如何對這些項目文檔進行翻譯, 其實這個問題困擾了我好久. 這裏,我總結了一些不一樣狀況下所謂的最佳實踐, 供你們參考:vue

獨立文檔項目

舉例: https://github.com/graphql/gr...git

GraphQL文檔的網站, 是一個獨立的項目, source分支是源碼目錄, master分支(能夠理解爲gh-pages分支)是靜態站點.github

1. 初始化翻譯項目

直接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

2. 從源站更新內容

# 一次性添加
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-...翻譯

1. 初始化翻譯項目

git init
git remote add origin xxx # 你的項目路徑
git remote add remote git@github.com:vuejs/vue-router.git
# 拉取源站代碼
git pull remote dev

2. 從源站更新內容

# 每次更新源站最新代碼
git pull remote dev

注意事項

  • CNAME等配置文件須要替換
  • pull後可能會有衝突. 解決後再提交代碼.

p.s.

優秀的中文翻譯項目及推薦的未翻譯項目彙總: Awesome-CN

相關文章
相關標籤/搜索