#!/bin/bash

FILES=$(find . -regex ".*py$" | grep -v -e "./plugins/.*/" -e "./web/.*")
LANGUAGES=$(ls i18n)

for i in $LANGUAGES
do
    directory=i18n/$i/LC_MESSAGES
    if [ ! -d $directory ]; then mkdir $directory; fi
    if [ ! -f $directory/messages.po ]; then touch $directory/messages.po; fi
    xgettext -j -d messages -o $directory/messages.po --from-code=utf-8 -L  Python $FILES templates/*.html
done
