#!/bin/bash

# make bash sane
set -eu -o pipefail
DIR=$(basename "$PWD")
if [[ "$DIR" != "locale" ]]; then
    echo "You are not inside the 'locale' directory"
    echo "ABORTING."
    exit 0
fi

echo "Generating .mo files"

msgfmt translations-ca.po -o ca_ES/LC_MESSAGES/translations.mo
msgfmt translations-es.po -o es_ES/LC_MESSAGES/translations.mo
msgfmt translations-eu.po -o eu_ES/LC_MESSAGES/translations.mo
msgfmt translations-fr.po -o fr_FR/LC_MESSAGES/translations.mo
msgfmt translations-ga.po -o ga_IE/LC_MESSAGES/translations.mo
msgfmt translations-gd.po -o gd_GB/LC_MESSAGES/translations.mo
msgfmt translations-gl.po -o gl_ES/LC_MESSAGES/translations.mo
msgfmt translations-hu.po -o hu_HU/LC_MESSAGES/translations.mo
msgfmt translations-it.po -o it_IT/LC_MESSAGES/translations.mo
msgfmt translations-nl.po -o nl_NL/LC_MESSAGES/translations.mo
msgfmt translations-de.po -o de_DE/LC_MESSAGES/translations.mo
msgfmt translations-pt_BR.po -o pt_BR/LC_MESSAGES/translations.mo
msgfmt translations-ru.po -o ru_RU/LC_MESSAGES/translations.mo
msgfmt translations-id.po -o id_ID/LC_MESSAGES/translations.mo
msgfmt translations-zh_TW.po -o zh_TW/LC_MESSAGES/translations.mo

echo "DONE"
