#!/bin/sh

if [ "$#" != 1 ]; then
	cat << HERE
Usage: 'make-mo <LANG>'
Eg:    'make-mo fr' to compile the French translation, fr.po, ready for use.
HERE
	exit 1
fi

OUT=../../Messages/$1.gmo

# This code converts to UTF-8 format. Needed by Gtk+-2.0 at
# least, and may help with other versions.
charset=`grep "charset=" $1.po | head -1 | sed 's/^.*charset=\(.*\)\\\n.*/\1/'`
echo Using charset \'$charset\'
iconv -f $charset -t utf-8 $1.po | \
	sed 's/; charset=\(.*\)\\n"/; charset=utf-8\\n"/' | \
	msgfmt - -o $OUT && echo Created file $OUT OK
