Transifexで翻訳する時のやり方メモ

忘れそうなので、メモ。
web上でも編集できるけど、リソースがロックされるのでローカルで編集した方が楽。

参考ページなど

Transifex Clientのインストール

Pythonで作られているらしく、pipでインストールできます。

$ pip install transifex-client

Transifex Clientの基本的な使い方

TortoiseGitの日本語の翻訳を例に使う。

初期化

$ mkdir tortoisegit
$ cd tortoisegit
$ tx init

プロジェクトの設定

$ tx set --auto-remote https://www.transifex.net/projects/p/tortoisegit/
$ tx pull -l ja

翻訳してpushする

$ vi translations/ja.po
(編集)
$ tx push -t -l ja

実際の翻訳作業

ローカルの作業はgitでバージョン管理した方がいい。
上の例と同じく、TortoiseGitの日本語の翻訳を例を使う。

初期化(上の例と同じ)

$ mkdir tortoisegit
$ cd tortoisegit
$ tx init

プロジェクトの設定(上の例と同じ)

$ tx set --auto-remote https://www.transifex.net/projects/p/tortoisegit/
$ tx pull -l ja

gitリポジトリの初期化

$ git init
$ git commit --allow-empty -m "first commit"

.fx/を無視リストに追加

$ echo ".tx" > .gitignore
$ git add .gitignore
$ git commit -m "ignore .tx directory"

作業前のja.poをコミット

$ git add translations/ja.po
$ git commit -m "first ja.po"

自分の翻訳作業を始める

$ git checkout -b work master
$ vi
(編集)
$ git commit -m "1〜100行目くらいまで翻訳"

tx pushの前に他人の変更を取得・マージする

$ git checkout master
$ tx pull -f
(他人の変更があればコミットする。なければ何もしない)
$ git merge --no-ff work

マージ結果をpushする

$ tx push -t -l ja

ja.poのヘッダにあるPO-Revision-Dateがpush時に更新されるので手元を直す

$ tx pull -f
$ git add translations/ja.po
$ git commit -C HEAD

次の翻訳作業用にブランチを更新する

$ git branch -f work master