Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 39 lines (31 sloc) 0.876 kb
#!/bin/bash
# syntax:
# compile-json.sh locale-dir/ json-dir/
lockfile="/tmp/browserid2012-compile-json.lock"
function usage() {
echo "syntax:"
echo "compile.sh locale-dir/ json-dir"
exit 1
}
# check if the lockfile exists
if [ -e $lockfile ]; then
echo "$lockfile present, exiting"
exit 99
fi
# check if file and dir are there
if [[ ($# -ne 2) || (! -d "$1") || (! -d "$2") ]]; then usage; fi
touch $lockfile
for pofile in `find $1 -type f -name "*.po"`; do
dir=`dirname $pofile`
subdir=`dirname $dir`
lang=`basename $subdir`
stem=`basename $pofile .po`
jsonfile="$2/${lang}/${stem}.json"
jsfile="$2/${lang}/${stem}.js"
mkdir -p $2/${lang}
./node_modules/.bin/po2json.js -p $pofile > $jsonfile
echo -n ";var json_locale_data = " > $jsfile
cat $jsonfile >> $jsfile
echo ";" >> $jsfile
done
rm $lockfile
Jump to Line
Something went wrong with that request. Please try again.