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 (32 sloc) 0.875 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"
mkdir -p $2/${lang}
echo "I am working in "
pwd
echo "and 1 is $1 and 2 is $2"
echo -n ";var json_locale_data = " > $jsonfile
./node_modules/.bin/po2json.js -p $pofile >> $jsonfile
echo ";" >> $jsonfile
done
rm $lockfile
Jump to Line
Something went wrong with that request. Please try again.