#!/bin/sh

set -e
set -x

CURDIR=`pwd`
#cd horizon
${CURDIR}/manage.py extract_messages -v 0 --traceback
# Babel always embeds the current build time as POT-Creation-Date in the
# freshly generated .pot files, which makes the shipped python3-horizon
# unreproducible. Strip that header after extraction:
# https://bugs.debian.org/1149638
for pot in horizon/locale/*.pot openstack_dashboard/locale/*.pot openstack_auth/locale/*.pot ; do
	[ -f ${pot} ] && sed -i '/^"POT-Creation-Date:/d' ${pot}
done
${CURDIR}/manage.py compilemessages -v 0 --traceback
#cd ..
#cd openstack_dashboard
#${CURDIR}/manage.py extract_messages -v 0 --traceback
#${CURDIR}/manage.py compilemessages -v 0 --traceback
#cd ..
rm -vf horizon/locale/en/LC_MESSAGES/django*.mo
rm -vf openstack_dashboard/locale/en/LC_MESSAGES/django.mo
