Moving compilepo and mergepo files from locale/ to po/ where they make
[squirrelmail.git] / po / compilepo
diff --git a/po/compilepo b/po/compilepo
new file mode 100755 (executable)
index 0000000..c9e2ceb
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+# **
+# ** This script compiles locale PO files
+# **
+# ** Usage:   compilepo <locale id>
+# ** Example: compilepo es
+# **
+# ** Philipe Mingo <mingo@rotedic.com>
+# ** Konstantin Riabitsev <icon@duke.edu>
+# **
+# **  $Id$
+
+if [ -z "$1" ]; then
+ echo "USAGE: compilepo [localename]"
+ exit 1
+fi
+
+WORKDIR=../locale
+LOCALEDIR=$WORKDIR/$1
+
+if [ ! -d $LOCALEDIR ]; then
+ # lessee if it's been renamed.
+ DCOUNT=`find $WORKDIR/ -name $1* | wc -l` 
+ if [ $DCOUNT -eq 1 ]; then 
+  # aha
+  LOCALEDIR=`find $WORKDIR/ -name $1*`
+ elif [ $DCOUNT -gt 1 ]; then
+  # err out
+  echo "More than one locale matching this name found:"
+  find $WORKDIR/ -name $1*
+  echo "You have to be more specific."
+  exit 1
+ fi
+fi
+
+echo "Compiling $LOCALEDIR/LC_MESSAGES/squirrelmail.po"
+msgfmt -o $LOCALEDIR/LC_MESSAGES/squirrelmail.mo \
+     $LOCALEDIR/LC_MESSAGES/squirrelmail.po
+