m17n-db/m17n-gen-ibus-engine
2008-10-20 01:13:21 +00:00

34 lines
589 B
Bash
Executable File

#!/bin/sh
# generates .engine files from m17n .mim files for ibus-m17n
PROG=`basename $0`
if [ $# -le 1 ]; then
echo "Usage: $PROG <m17n-mim-file> [output-dir]"
exit 1
fi
FILE=$1
OUTDIR=${2:-.}
MAP=$(basename $1 .mim)
LANG=$(echo $MAP | sed -e "s/-.*//")
if grep -q "(input-method t " $FILE; 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