aboutsummaryrefslogtreecommitdiffstats
path: root/devtools
diff options
context:
space:
mode:
Diffstat (limited to 'devtools')
-rwxr-xr-xdevtools/compile_translations.sh46
-rw-r--r--devtools/pootle-exclude.txt2
-rwxr-xr-xdevtools/update_extlib.sh41
-rwxr-xr-xdevtools/update_translations.sh20
4 files changed, 92 insertions, 17 deletions
diff --git a/devtools/compile_translations.sh b/devtools/compile_translations.sh
new file mode 100755
index 00000000..fa84e9a7
--- /dev/null
+++ b/devtools/compile_translations.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+# GNU MediaGoblin -- federated, autonomous media hosting
+# Copyright (C) 2015 GNU MediaGoblin contributors. See AUTHORS.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# exit if anything fails
+set -e
+
+if [ -f "./bin/pybabel" ]; then
+ PYBABEL="./bin/pybabel";
+else
+ PYBABEL=pybabel;
+fi
+
+
+## This used to be a lot simpler...
+##
+## 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/mediagoblin.po" ] && \
+ [ "$file" != "mediagoblin/i18n/templates/en/mediagoblin.po" ]; then
+ mkdir -p `dirname $file`/LC_MESSAGES/;
+ $PYBABEL compile -i $file \
+ -o `dirname $file`/LC_MESSAGES/mediagoblin.mo \
+ -l `echo $file | awk -F / '{ print $3 }'`;
+ else
+ echo "Skipping $file which pybabel can't compile :(";
+ fi;
+done
diff --git a/devtools/pootle-exclude.txt b/devtools/pootle-exclude.txt
new file mode 100644
index 00000000..e830d157
--- /dev/null
+++ b/devtools/pootle-exclude.txt
@@ -0,0 +1,2 @@
+.translation_index
+LC_MESSAGES/
diff --git a/devtools/update_extlib.sh b/devtools/update_extlib.sh
new file mode 100755
index 00000000..b94f0076
--- /dev/null
+++ b/devtools/update_extlib.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+# GNU MediaGoblin -- federated, autonomous media hosting
+# Copyright (C) 2015 GNU MediaGoblin Contributors. See AUTHORS.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+set -e
+
+# Make sure we have npm available
+
+if ! which npm > /dev/null; then
+ echo "Can't find npm, no way to install extlib :(";
+ exit 1;
+fi
+
+# Install bower if need be
+if which bower > /dev/null; then
+ BOWER=`which bower`;
+elif [ -f ./node_modules/.bin/bower ]; then
+ BOWER="./node_modules/.bin/bower";
+else
+ echo "Bower not found, installing via npm!";
+ npm install bower;
+ BOWER="./node_modules/.bin/bower";
+fi
+
+# Do package/file installs
+$BOWER install
diff --git a/devtools/update_translations.sh b/devtools/update_translations.sh
index 29743f94..58e4e11d 100755
--- a/devtools/update_translations.sh
+++ b/devtools/update_translations.sh
@@ -26,27 +26,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
+./bin/pybabel extract -F babel.ini -o mediagoblin/i18n/templates/mediagoblin.pot .
echo "==> Compiling .mo files"
-./bin/pybabel compile -D mediagoblin -d mediagoblin/i18n/
+./devtools/compile_translations.sh
echo "==> Committing to git"
git add mediagoblin/i18n/