Try   HackMD

README | tailwindcss.tw 翻譯工作 Git 簡易操作流程

先加入兔兔教

設定 git

  1. 先申請 github 帳號
  2. 向可樂大申請加入 tailwindcss.tw 組織
  3. 本機切換到要同步 git 的資料夾,將資料 clone 下來

可樂大:clone 下來之後就會預設 pull default branch 了

作業流程

1. 取得 git 文件最新版本

git pull origin tw

2. 開個分支

git checkout -b lang/branch_name

  • lang/ 前綴代表為翻譯文件
  • branch_name 可自訂名稱,例如用自己的 github 帳號當名稱

3. 進行翻譯

翻譯規範

兔兔補充:
屬於 css 原本功能的 是保留英文 (中文在後);可是像核心概念區的、不是css 功能的 就中文在前。

  • 翻譯的原文需保留,將其註解並放在該句中文翻譯的上一行(段)
  • 專有名詞的翻譯用詞參考:
  • Responsive的敘述部份 請參考 Backdrop Sepia 的翻法
  • 常見句子的公版:
    • 原文:For more information about Tailwind's _____ , check out the _____ documentation.
    • 譯文:更多有關 _____ 的資訊,可參考 _____ 文件。
  • Resonsive 的 import (錯誤與正確的例子) :
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
  • "you" 請翻譯成 "你",而不是 "您"
  • 可樂大: 想了一下,技術文件裡面用"你"好了,一來你比較平易近人,二來技術文件不需要有上下位等的關係,有特殊案例覺得用您比較好的話,再提出來大家討論。

4. 翻譯完成後 將檔案推送回 git

(1) 將檔案加入 git 中

git add 檔案名稱 // 可指定特定檔案

git add . // 會一次加入所有變更過的檔案

(2) 撰寫 commit message

git commit

可樂:推薦使用 npx git-cz 代替

commit message 範例

主要描述這個 commit 做了什麼事,例如修改 Home page:
Update: HomePage

(3) 在 rebase 之前先取得最新的 origin

git fetch origin

(4) rebase 一定要記得做!

git rebase origin/tw

此時線圖會長這樣 (lang/optimizingForProduction 是你開出來翻譯的分支),只要該分支尾巴與 origin/tw 分支是接在一起的,就代表 rebase 是成功的

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

(5) 將結果 push 至 git

git push

可樂:

  • 第一次執行應該會出現一行指令叫你打,類似:
    git push --set-upstream origin xxxxxxx 照著打送出即可(這只有第一次要打,以後只要打 git push 即可)
  • 如果同一個 branch 之前有 push 過而需要重新強制 push 的話可以使用 git push -f
    通常容易發生在重新 rebase 之後

補充可樂說的 git push -f:

  • push 過的 branch,git push 的時候,cli 會出現下方(圖一)的提示。
  • (圖二)請看 remote 還有一支 lang/optimizingForProduction,這樣子情況會沒辦法 git push

圖一

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

圖二

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

(5) 輸入 github 帳號密碼,輸入後便會完成 push

5. push 成功之後要上去 github 建立 pull request

(1) 按下Pull Request 再按下new pull request

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

(2) 在 base repository 選 tailwindcss-tw

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

(3) 在 base 再選一次tw

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

(4) 右邊的 compare: 選擇你的分支 lang/xxxxx

(5) 按下create new pull request 就完成了

成功後,過不久就能在 https://tailwindcss.tw 看到成果囉
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

【重要】接下來每次翻譯的步驟:

  1. 切換到 tw
    git checkout tw
  2. 取得最新 tw
    git fetch origin
    git pull
  3. 刪除原先的本地分支 (如果想要用同名的分支開發)
    git branch -d lang/****
  4. 從最新的 tw 開分支出來開發
    git checkout -b lang/**** (自己設的分支)
  5. 重覆「4. 翻譯完成後 將檔案推送回 git」的操作

Remark: code review 後的修改

PR後,如需修改。修改完直接接「4. 翻譯完成後 將檔案推送回 git

其他常用 git 指令

查看目前本機的 git 狀態

git status

查看目前的分支

git branch

放棄本機所有變更(以遠端 git 資料覆蓋本機資料)

git reset --hard origin/tw

MDX

參考資源