forked from 0ad/0ad
Simplify the translations maintenance script.
- Removed bashisms - Removed the call to SVN update which is usually done beforehand in CI - Removed the git alternative which is never used - Fixed the call to poediff which seems to fail with latest poediff Tested on Jenkins since the revamp. Reviewed By: Gallaecio Differential Revision: https://code.wildfiregames.com/D2078 This was SVN commit r22690.
This commit is contained in:
parent
9985fcf5bd
commit
5cfef19a06
@ -1,36 +1,11 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
# Regenerates the POT files and uploads them to Transifex, downloads the latest
|
||||
# translations from Transifex, and commits the updated POT and PO files.
|
||||
# Regenerates the POT files, downloads the latest translations from Transifex,
|
||||
# and prepares the commit of the updated POT and PO files.
|
||||
|
||||
SCRIPT_PATH="`dirname \"$0\"`"
|
||||
|
||||
|
||||
# VCS Config ##################################################################
|
||||
|
||||
VCS="svn"
|
||||
VCS_UPDATE="svn update"
|
||||
VCS_REVERT="svn revert %s@"
|
||||
VCS_ADD="svn add %s"
|
||||
VCS_COMMIT_AND_PUSH="svn commit -m '[i18n] Updated POT and PO files.'"
|
||||
git rev-parse &> /dev/null
|
||||
if [[ "$?" = "0" ]]; then
|
||||
VCS="git"
|
||||
VCS_UPDATE="git pull --rebase origin master"
|
||||
VCS_REVERT="git checkout -- %s"
|
||||
VCS_ADD="git add %s"
|
||||
VCS_COMMIT_AND_PUSH="git commit -am '[i18n] Updated POT and PO files.' &&
|
||||
git pull --rebase origin master &&
|
||||
git push origin master"
|
||||
fi
|
||||
|
||||
|
||||
# Source Update ###############################################################
|
||||
|
||||
echo ":: Updating sources…"
|
||||
${VCS_UPDATE}
|
||||
|
||||
|
||||
# POT Generation ##############################################################
|
||||
|
||||
echo ":: Regenerating the translation templates…"
|
||||
@ -54,10 +29,10 @@ python2 "${SCRIPT_PATH}/pullTranslations.py"
|
||||
echo ":: Reverting unnecessary changes…"
|
||||
for FILE_PATH in $(find "${SCRIPT_PATH}/../../../binaries/data" -name "*.pot" -o -name "*.po")
|
||||
do
|
||||
if [[ ! -n "$(poediff -c ${VCS} -rHEAD -qs "${FILE_PATH}")" ]]; then
|
||||
$(printf "${VCS_REVERT}" "${FILE_PATH}")
|
||||
if [ -z "$(poediff -c svn -qs "${FILE_PATH}")" ]; then
|
||||
svn revert "${FILE_PATH}"
|
||||
else
|
||||
$(printf "${VCS_ADD}" ${FILE_PATH}) &> /dev/null
|
||||
svn add "${FILE_PATH}" 2> /dev/null
|
||||
fi
|
||||
done
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user