Ensure to compile translation catalogs

A working directory in DevStack is not sahara-dashboard directory,
so the directory path must be specified by an absolute path.

In addition, django manage.py works if 'locale' directory exists.
This commit uses django manage.py to simplify the command.

When I tested the devstack plugin for translation previously,
it seems compiled message catalogs existed and I didn't notice it.

Change-Id: I8dde297976faf01a6dbe1f70ec5cd3be4ba3f160
This commit is contained in:
Akihiro Motoki 2016-02-23 22:53:30 +09:00
parent 63c9a10315
commit e208986b3f

View File

@ -8,15 +8,10 @@ function install_sahara_dashboard {
function configure_sahara_dashboard {
cp -a ${SAHARA_DASH_DIR}/sahara_dashboard/enabled/* ${DEST}/horizon/openstack_dashboard/local/enabled/
# compile message catalogs
# NOTE: "python manage.py compilemessages does not work"
# so we compile translation catalogs directly.
if [ -d sahara_dashboard/locale ]; then
for domain in django djangojs; do
if find sahara_dashboard/locale -type f | grep -q "${domain}.po$"; then
pybabel compile -D ${domain} -d sahara_dashboard/locale
fi
done
# NOTE: If locale directory does not exist, compilemessages will fail,
# so check for an existence of locale directory is required.
if [ -d ${SAHARA_DASH_DIR}/sahara_dashboard/locale ]; then
(cd ${SAHARA_DASH_DIR}/sahara_dashboard; DJANGO_SETTINGS_MODULE=openstack_dashboard.settings ../manage.py compilemessages)
fi
}