make-mo fix: No need to use rm -rf, simply use rm -f
[rox-filer.git] / ROX-Filer / src / po / make-mo
blobb796b02567c83bd50446ce746c23a50aad33624f
1 #!/bin/sh
3 if [ "$#" != 1 ]; then
4 cat << HERE
5 Usage: 'make-mo <LANG>'
6 Eg: 'make-mo fr' to compile the French translation, fr.po, ready for use.
7 HERE
8 exit 1
9 fi
11 OUT_DIR=../../Messages
12 LOCALE_DIR=$OUT_DIR/$1/LC_MESSAGES
13 OUT=$OUT_DIR/$1.gmo
15 # This code converts to UTF-8 format. Needed by Gtk+-2.0 at
16 # least, and may help with other versions.
17 charset=`grep "charset=" $1.po | head -1 | sed 's/^.*charset=\(.*\)\\\n.*/\1/'`
18 echo Using charset \'$charset\'
19 iconv -f $charset -t utf-8 $1.po | \
20 sed 's/; charset=\(.*\)\\n"/; charset=utf-8\\n"/' | \
21 msgfmt --statistics - -o $OUT && echo Created file $OUT OK
23 # Create the $APP_DIR/Messages/<LANG>/LC_MESSAGES/ROX-Filer.mo link
24 # (or remove it when the translation (.gmo) is not available)
25 if [ -f "$OUT" ]; then
26 mkdir -p "$LOCALE_DIR"
27 ln -sf "../../$1.gmo" "$LOCALE_DIR/ROX-Filer.mo"
28 else
29 rm -f "$LOCALE_DIR/ROX-Filer.mo"