diff options
Diffstat (limited to 'devtools')
-rwxr-xr-x | devtools/compile_translations.sh | 49 | ||||
-rwxr-xr-x | devtools/make_example_database.sh | 2 | ||||
-rwxr-xr-x | devtools/maketarball.sh | 2 | ||||
-rw-r--r-- | devtools/pootle-exclude.txt | 2 | ||||
-rwxr-xr-x | devtools/update_extlib.sh | 41 | ||||
-rwxr-xr-x | devtools/update_translations.sh | 28 |
6 files changed, 104 insertions, 20 deletions
diff --git a/devtools/compile_translations.sh b/devtools/compile_translations.sh new file mode 100755 index 00000000..787a4554 --- /dev/null +++ b/devtools/compile_translations.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +# 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 several translations 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. +## +## List of uncompilable translations: Lojban (jbo), Interlingua (ia) + +for file in `find mediagoblin/i18n/ -name "*.po"`; do + if [ "$file" != "mediagoblin/i18n/jbo/mediagoblin.po" ] && \ + [ "$file" != "mediagoblin/i18n/ia/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/make_example_database.sh b/devtools/make_example_database.sh index 7e857f53..6d025ade 100755 --- a/devtools/make_example_database.sh +++ b/devtools/make_example_database.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # GNU MediaGoblin -- federated, autonomous media hosting # Copyright (C) 2011, 2012 GNU MediaGoblin Contributors. See AUTHORS. diff --git a/devtools/maketarball.sh b/devtools/maketarball.sh index c6c2bc2b..05442475 100755 --- a/devtools/maketarball.sh +++ b/devtools/maketarball.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # GNU MediaGoblin -- federated, autonomous media hosting # Copyright (C) 2011, 2012 GNU MediaGoblin Contributors. See AUTHORS. 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..bc39a3cf --- /dev/null +++ b/devtools/update_extlib.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +# 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 2>&1; then + echo "Can't find npm, no way to install extlib :("; + exit 1; +fi + +# Install bower if need be +if which bower > /dev/null 2>&1; 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..69313b53 100755 --- a/devtools/update_translations.sh +++ b/devtools/update_translations.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # GNU MediaGoblin -- federated, autonomous media hosting # Copyright (C) 2011, 2012 GNU MediaGoblin contributors. See AUTHORS. @@ -19,6 +19,12 @@ # 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,27 +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" -./bin/pybabel compile -D mediagoblin -d mediagoblin/i18n/ +./devtools/compile_translations.sh echo "==> Committing to git" git add mediagoblin/i18n/ |