Provide an update_extlib.sh alternative for Guix.
[mediagoblin.git] / devtools / update_translations.sh
index abc96be6f70f011ee1eb8c148e77f4e256526841..69313b5367f4c952e1be66a29c19a89323f759fe 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 # GNU MediaGoblin -- federated, autonomous media hosting
 # Copyright (C) 2011, 2012 GNU MediaGoblin contributors.  See AUTHORS.
 # exit if anything fails
 set -e
 
+if [ -f "./bin/pybabel" ]; then
+    PYBABEL="./bin/pybabel";
+else
+    PYBABEL=pybabel;
+fi
+
 echo "==> checking out master"
 git checkout master
 
@@ -26,44 +32,13 @@ echo "==> pulling git master"
 git pull
 
 echo "==> pulling present translations"
-./bin/tx pull -a
-
-git add mediagoblin/i18n/
-git commit -m "Committing present MediaGoblin translations before pushing extracted messages" \
-    || true  # Don't fail if nothing to commit
+rsync --exclude-from="devtools/pootle-exclude.txt" -vaz chapters.gnu.org::pootle/mediagoblin/ mediagoblin/i18n/
 
 echo "==> Extracting translations"
-./bin/pybabel extract -F babel.ini -o mediagoblin/i18n/en/LC_MESSAGES/mediagoblin.po .
-
-echo "==> Pushing extracted translations to Transifex"
-./bin/tx push -s
-
-echo "==> Waiting 5 seconds, so the server can process the new stuff (hopefully)"
-sleep 5
-
-# gets the new strings added to all files
-echo "==> Re-Pulling translations from Transifex"
-./bin/tx pull -a
+$PYBABEL extract -F babel.ini -o mediagoblin/i18n/templates/mediagoblin.pot .
 
 echo "==> Compiling .mo files"
-
-## This used to be a lot simpler:
-# ./bin/pybabel compile -D mediagoblin -d mediagoblin/i18n/
-
-## But now we have a Lojban translation that we can't compile
-## currently.  We don't want to get rid of it because we want it... see 
-## https://issues.mediagoblin.org/ticket/1070
-## to track progress.
-
-for file in `find mediagoblin/i18n/ -name "*.po"`; do
-    if [ "$file" != "mediagoblin/i18n/jbo/LC_MESSAGES/mediagoblin.po" ]; then 
-        ./bin/pybabel compile -i $file \
-                      -d mediagoblin/i18n/ \
-                      -l `echo $file | awk -F / '{ print $3 }'`;
-    else
-        echo "Skipping $file which pybabel can't compile :("; 
-    fi;
-done
+./devtools/compile_translations.sh
 
 echo "==> Committing to git"
 git add mediagoblin/i18n/