From 46f95be62c81879bb65a88c2771394dfc6a1dc44 Mon Sep 17 00:00:00 2001 From: Timur Sufiev Date: Mon, 1 Jun 2015 14:35:54 +0300 Subject: [PATCH] Compile l10n strings at post-install phase Doing this should enable changing language in Horizon. Closes-Bug: #1460613 Change-Id: I961a0b527ab100b334a4f2ef0db8fad31573835f --- rpm/SPECS/python-django-horizon.spec | 16 ++++++++++++++-- trusty/debian/changelog | 6 ++++++ trusty/debian/control | 1 + trusty/debian/openstack-dashboard.postinst | 9 +++++++++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/rpm/SPECS/python-django-horizon.spec b/rpm/SPECS/python-django-horizon.spec index d3128c4..5fd3030 100644 --- a/rpm/SPECS/python-django-horizon.spec +++ b/rpm/SPECS/python-django-horizon.spec @@ -75,6 +75,7 @@ instance VNC console, etc.) Summary: Openstack web user interface reference implementation Group: Applications/System +Requires: gettext Requires: httpd Requires: mod_wsgi Requires: python-django-horizon >= %{version} @@ -316,6 +317,15 @@ mkdir -p %{buildroot}%{_sharedstatedir}/openstack-dashboard # create /var/log/horizon and own it mkdir -p %{buildroot}%{_var}/log/horizon +%post -n openstack-dashboard +# make sure the l10n strings are compiled +if [ -d /usr/share/openstack-dashboard/openstack_dashboard/locale -a -e /usr/share/openstack-dashboard/manage.py ] ; then + pushd /usr/share/openstack-dashboard/openstack_dashboard + %{__python} ../manage.py compilemessages + popd +else + echo "Couldn't compile Django l10n strings (.mo files)" +fi %check # don't run tests on rhel @@ -406,6 +416,10 @@ mkdir -p %{buildroot}%{_var}/log/horizon %doc html %changelog +* Mon Jun 01 2015 Timur Sufiev 2014.2.b3 +- Update requirements +- Compile l10n strings at post-install + * Mon Apr 24 2015 Vasyl Saienko 2014.2.2 - added {python_sitelib}/horizon/backends to files section (LP #1367767) @@ -415,10 +429,8 @@ mkdir -p %{buildroot}%{_var}/log/horizon * Mon Apr 06 2015 Ivan Berezovskiy 2014.2.2 - Fix netaddr in requirements.txt (LP #1439079) - * Mon Mar 02 2015 Mikhail Ivanov 2014.2.2 - Update requirements - * Tue Sep 23 2014 Ivan Berezovskiy 2014.2.b3 - Update requirements - Add simple tests diff --git a/trusty/debian/changelog b/trusty/debian/changelog index 6616521..1d685eb 100644 --- a/trusty/debian/changelog +++ b/trusty/debian/changelog @@ -1,3 +1,9 @@ +horizon (1:2014.2.2-1~u14.04+mos2) mos6.1; urgency=medium + + * Compile l10n strings at post-install + + -- Vasyl Saienko Wed, 02 Jun 2015 22:27:30 +0200 + horizon (1:2014.2.2-1~u14.04+mos1) mos6.1; urgency=medium * Fix version according to Fuel versioning policy: diff --git a/trusty/debian/control b/trusty/debian/control index a841cc2..b98c010 100644 --- a/trusty/debian/control +++ b/trusty/debian/control @@ -84,6 +84,7 @@ Pre-Depends: dpkg (>= 1.15.7.2) Depends: adduser, apache2 | httpd, + gettext, libapache2-mod-wsgi (>= 2.3), python-django-horizon (= ${source:Version}), ${misc:Depends}, diff --git a/trusty/debian/openstack-dashboard.postinst b/trusty/debian/openstack-dashboard.postinst index ea10944..77dcd20 100644 --- a/trusty/debian/openstack-dashboard.postinst +++ b/trusty/debian/openstack-dashboard.postinst @@ -41,6 +41,15 @@ if [ "$1" = "configure" ]; then /usr/share/openstack-dashboard/openstack_dashboard/static fi + if [ -d /usr/share/openstack-dashboard/openstack_dashboard/locale -a -e /usr/share/openstack-dashboard/manage.py ] ; then + curdir="`pwd`" + cd /usr/share/openstack-dashboard/openstack_dashboard + python ../manage.py compilemessages + cd "$curdir" + else + echo "Couldn't compile Django l10n strings (.mo files)" + fi + if [ -d /etc/openstack-dashboard/ ] ; then chown horizon:horizon /etc/openstack-dashboard/ fi -- 2.45.2