#!/bin/sh

# Set to 'yes' if you want UTF-8 strings, then run 'dist'.
utf=no

if [ $# = 1 ]; then
	OUT=../../Messages/$1.gmo
	
	if [ "$utf" == "yes" ]; then
		# 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 | msgfmt - -o $OUT &&
				echo Created file $OUT OK
	else
		# This does not convert to UTF-8. Use this to get the old
		# behaviour.  Gtk+-1.2.6 at least can't handle UTF-8 :-(
		msgfmt $1.po -o $OUT && echo Created file $OUT OK
	fi
	exit 0
fi

cat << HERE
Usage: 'make-mo <LANG>'
Eg:    'make-mo fr'
	to compile the French translation, fr.po, ready for use.
HERE
