Skip to content

Commit

Permalink
Merge pull request #1556 from ikedas/support/sync_translation by ikedas
Browse files Browse the repository at this point in the history
Update support/sync_translation.sh
  • Loading branch information
ikedas authored Feb 3, 2023
2 parents 9e1c674 + d143288 commit 12b1b07
Showing 1 changed file with 27 additions and 8 deletions.
35 changes: 27 additions & 8 deletions support/sync_translation.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -x
#!/bin/bash
set -Ceu
SET_X="$(set +o | grep xtrace)"

Expand Down Expand Up @@ -56,14 +56,16 @@ test -r "$TRANS_DIRECTORY"
test -w "$TRANS_DIRECTORY"

# Confirm that remote repository has been cloned using the Deploy Key.
# Checkout "main" branch.
# Confirm that any branches in remote origin may be fetched.

git config --get remote.origin.url
git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
git fetch --quiet --depth 50

# Export recent translations under TRANS_DIRECTORY.
# "pootle sync_stores" is the command to export them.

pootle sync_stores -v 2 --traceback
pootle sync_stores -v 2 --traceback |& grep -v Running:

# Update translation catalog according to changes in source code.
# This needs autoconf, automake and gettext packages.
Expand Down Expand Up @@ -134,12 +136,15 @@ for project in $TRANS_PROJECTS; do
cd ../..
done

if git diff --quiet HEAD; then
if git diff HEAD \
| grep -E -v '^(---|\+\+\+|[-+]"POT-Creation-Date:)' \
| grep -q '^[-+]'; then
git commit -a \
-m '[-feature] Committing latest translations from translate.sympa.community'
else
echo 'Nothing to update.'
exit 0
fi
git commit -a \
-m '[-feature] Committing latest translations from translate.sympa.community'

# Typo fixes: If en_US.po is updated, update translated messages in
# po files and source code. "correct_msgid" will do it.
Expand Down Expand Up @@ -192,7 +197,21 @@ fi

# Push the changes
#XXXexit 0
git push -q -f origin "$SYMPA_PUSH_BRANCH"

# Clenaup
if git branch -r | grep -q ' origin/'"$SYMPA_PUSH_BRANCH"'$'; then
if git diff origin/"$SYMPA_PUSH_BRANCH" -- po \
| grep -E -v '^(---|\+\+\+|[-+]"POT-Creation-Date:)' \
| grep -q '^[-+]'; then
do_push="yes"
else
do_push="no"
fi
else
do_push="yes"
fi
if [ "$do_push" = "yes" ]; then
git push -f origin "$SYMPA_PUSH_BRANCH"
else
echo 'Nothing to push.'
fi

0 comments on commit 12b1b07

Please sign in to comment.