Blob Blame Raw
#!/bin/sh
# generates .engine files from m17n mim filenames for ibus-m17n

PROG=`basename $0`

if [ $# -le 1 ]; then
    echo "Usage: $PROG <m17n-map.mim> [dir]"
    exit 1
fi

FILE=$1
OUTDIR=${2:-.}

MAP=$(basename $1 .mim)

LANG=$(echo $MAP | sed -e "s/-.*//")
if [ "$LANG" = "latn" ]; then
  LANG=$MAP
fi
if [ "$LANG" = "$MAP" ]; then
  STYLE=$LANG
  LANG=t
else
  STYLE=$(echo $MAP | sed -e "s/^.*-//")
fi
cat > $OUTDIR/m17n-$MAP.engine << EOF
Exec=/usr/bin/ibus-engine-m17n $LANG:$STYLE
Name=$STYLE
Lang=$LANG
Icon=/usr/share/m17n/icons/$MAP.png
Author=
Credits=
EOF