#!/bin/bash

function help () {
    echo "make translations for a plugin:"
    echo "this script will create one .mo file fo each .po file existing"
    echo "insinde <plugindir>/i18n/<LANG> folder. Before run it ensure you"
    echo "have that folder created and you have called to i18n_exctract_plugin.sh"
    echo ""
    echo "usage:"
    echo ""
    echo "$0 <plugindir>"
}

if [ ! $# -eq 1 ]
then
    help
else
    PLUGINDIR=$1
    LANGUAGES=$(ls $PLUGINDIR/i18n)

    for i in $LANGUAGES
    do
        msgfmt -o $PLUGINDIR/i18n/$i/LC_MESSAGES/messages.mo $PLUGINDIR/i18n/$i/LC_MESSAGES/messages.po
    done
fi
