From: HironoriFujimoto Date: Tue, 27 Feb 2018 07:56:08 +0000 (+0900) Subject: initial commit X-Git-Url: http://git.osdn.net/view?p=wesnoth-ja%2Ftransifex_scripts.git;a=commitdiff_plain;h=26bc68951a7f8b0d8bf387d78d2329b6573ab434 initial commit --- 26bc68951a7f8b0d8bf387d78d2329b6573ab434 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6feb271 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +wesnoth/ +transifex/ + +api_token.sh \ No newline at end of file diff --git a/apply_latest_translation.sh b/apply_latest_translation.sh new file mode 100755 index 0000000..de37d51 --- /dev/null +++ b/apply_latest_translation.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# Transifexから最新の翻訳データをダウンロード、wesnothに適用するスクリプト + +set -eu + +source ./variables.sh +source ./api_token.sh +TOP_DIR=${PWD} + +if [ ! -d ${TX_DIR} ]; then + echo 'ローカルのTranisfexプロジェクトを初期化' + mkdir ${TX_DIR} + tx init ${TX_DIR} --token=${TX_TOKEN} --force --no-interactive + + echo "リモートプロジェクトを${TX_PROJECT}に設定" + cd ${TX_DIR} + tx config mapping-remote ${TX_URL}/projects/p/${TX_PROJECT}/ + cd ${TOP_DIR} +fi + +echo 'リモートプロジェクトより翻訳データをローカルプロジェクトにダウンロード' +cd ${TX_DIR} +tx pull -a +cd ${TOP_DIR} + +echo '翻訳データをwesnothに適用' +for RESOURCE in ${WESNOTH_RESOURCES} +do + echo "${RESOURCE}" + msgfmt ${TX_DIR}/translations/${TX_PROJECT}.${RESOURCE}/ja.po -o wesnoth/translations/ja/LC_MESSAGES/${RESOURCE}.mo +done diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..8630ebd --- /dev/null +++ b/build.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# Wesnothのソースコードを最新のものに更新、ビルドを行うスクリプト + +set -eu + +WESNOTH_DIR="wesnoth" +BUILD_DIR="build" + +if [ ! -d ${WESNOTH_DIR} ]; then + echo 'wesnothリポジトリのクローン' + git clone https://github.com/wesnoth/wesnoth.git +fi + +cd ${WESNOTH_DIR} +echo '作業ツリーの変更をリセット' +git stash +git stash clear +echo 'リポジトリの更新・マージ' +git pull origin master + +if [ ! -d ${BUILD_DIR} ]; then + mkdir ${BUILD_DIR} +fi +cd ${BUILD_DIR} +echo 'ビルドの設定' +cmake .. -DENABLE_POT_UPDATE_TARGET=TRUE # potの更新を有効化する +echo 'ビルドの開始' +make -j3 diff --git a/build_and_pot_update.sh b/build_and_pot_update.sh new file mode 100755 index 0000000..d929084 --- /dev/null +++ b/build_and_pot_update.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -eu + +./build.sh +./apply_latest_translation.sh +./transifex_pot_update.sh diff --git a/transifex_pot_update.sh b/transifex_pot_update.sh new file mode 100755 index 0000000..fad8a3b --- /dev/null +++ b/transifex_pot_update.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# ソースコードから翻訳テンプレートファイルを生成、Transifexにアップロードするスクリプト + +set -eu + +source ./variables.sh +source ./api_token.sh +TOP_DIR=${PWD} + +cd wesnoth/build +echo 'ソースコードから翻訳テンプレートファイルを生成' +make pot-update -j3 +cd ${TOP_DIR} + +if [ ! -d ${TX_DIR} ]; then + mkdir ${TX_DIR} + cd ${TX_DIR} + echo 'ローカルのTranisfexプロジェクトを初期化' + tx init ${TX_DIR} --token=${TX_TOKEN} --force --no-interactive + echo "リモートプロジェクトを${TX_PROJECT}に設定" + tx config mapping-remote ${TX_URL}/projects/p/${TXPROJECT}/ + cd ${TOP_DIR} +fi + +if [ ! -d ${TX_DIR}/sources ]; then + mkdir ${TX_DIR}/sources +fi +cp wesnoth/po/*/*.pot ${TX_DIR}/sources/ +cd ${TX_DIR} +echo 'ローカルのTranisfexプロジェクトに翻訳テンプレートファイルを設定' +for RESOURCE in ${WESNOTH_RESOURCES} +do + tx config --source -r ${TX_PROJECT}.${RESOURCE} --type PO -l en sources/${RESOURCE}.pot +done +echo 'リモートプロジェクトに変更を適用' +tx push -s diff --git a/variables.sh b/variables.sh new file mode 100755 index 0000000..0c64b3f --- /dev/null +++ b/variables.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +TX_URL='https://www.transifex.com' +TX_DIR='transifex' +TX_PROJECT='wesnoth-dev-japanese' +WESNOTH_RESOURCES="wesnoth \ + wesnoth-ai \ + wesnoth-anl \ + wesnoth-aoi \ + wesnoth-did \ + wesnoth-dm \ + wesnoth-dw \ + wesnoth-editor \ + wesnoth-ei \ + wesnoth-help \ + wesnoth-httt \ + wesnoth-l \ + wesnoth-lib \ + wesnoth-low \ + wesnoth-manpages \ + wesnoth-manual \ + wesnoth-multiplayer \ + wesnoth-nr \ + wesnoth-sof \ + wesnoth-sota \ + wesnoth-sotbe \ + wesnoth-tb \ + wesnoth-test \ + wesnoth-thot \ + wesnoth-trow \ + wesnoth-tsg \ + wesnoth-tutorial \ + wesnoth-units \ + wesnoth-utbs"