Bug 1086247

Summary: Ensure translations are installed correctly and picked up at runtime
Product: [Community] RDO Reporter: Nikola Dipanov <ndipanov>
Component: openstack-novaAssignee: Sven Anderson <svanders>
Status: CLOSED CURRENTRELEASE QA Contact: Shai Revivo <srevivo>
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: apevec, eglynn, lars, markmc, rbryant, sgordon, srevivo, svanders
Target Milestone: ---Keywords: Triaged
Target Release: trunk   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 892602
: 1334797 (view as bug list) Environment:
Last Closed: 2016-10-18 16:28:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 892602, 978541, 1026156    

Description Nikola Dipanov 2014-04-10 12:58:25 UTC
+++ This bug was initially created as a clone of Bug #892602 +++

This probably applies to all services, but let's start with Nova ...

Firstly, we don't include compiled message catalogs in our packages (i.e. .mo files) - we should be able to do e.g. 'python setup.py compile_catalog' to help with this. To understand what's going on here, read docs about babel and look at setup.cfg.

Secondly, at runtime, we do:

  gettext.install('nova', unicode=1)

which means that gettext looks for message catalogs in e.g.

  /usr/share/locale/$LANG/LC_MESSAGES/nova.mo

so, we either need to install them there or use the 'localedir' argument to gettext.install() to tell gettext where they are

--- Additional comment from RHEL Product and Program Management on 2013-01-07 06:45:16 EST ---

Since this issue was entered in bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

--- Additional comment from Alan Pevec on 2013-11-18 13:20:36 EST ---

Please implement in Fedora/RDO first.

Comment 3 Lars Kellogg-Stedman 2015-03-26 19:22:04 UTC
Nikola, is this task still something we want to complete?  It looks like compiling the binary catalogs saves us about 30% in space over the .po file, but are there other advantages?

Comment 5 Sven Anderson 2016-01-27 20:36:24 UTC
The spec files don't call "setup.py compile_catalog", so the .mo files have never been created.

I'm just working upstream to fix https://bugs.launchpad.net/openstack-i18n/+bug/1536226 so that all .mo files are generated.

Then I will add the missing "setup.py compile_catalog" to the spec file in order to create the mo. files and let it remove the .po files as well.

Comment 6 Alan Pevec 2016-02-01 17:37:02 UTC
Looks like upstream fix is in PBR so we need to rebase/backport that in separate BZ against python-pbr ?

Comment 7 Sven Anderson 2016-02-03 11:23:22 UTC
No, I landed a feature in babel directly upstream: https://github.com/python-babel/babel/pull/335

There will be a babel release soon, and then we just need that version during packaging time (or whenever setup.py compile_catalog is called).

The setup.cfg will be adapted upstream as soon as the release is out.

Comment 11 Alan Pevec 2016-05-10 14:26:13 UTC
(In reply to Sven Anderson from comment #7)
> No, I landed a feature in babel directly upstream:
> https://github.com/python-babel/babel/pull/335

This is included in Babel 2.3.4
https://github.com/python-babel/babel/commit/9edb9a0309270e23a9a8f62d226ef8e8ef04fe26

> There will be a babel release soon, and then we just need that version
> during packaging time (or whenever setup.py compile_catalog is called).

We have 2.3.4 available in RDO buildroot, please propose changes to rpm-master.

> The setup.cfg will be adapted upstream as soon as the release is out.

Has that happened?

Comment 12 Alan Pevec 2016-05-10 14:30:06 UTC
> > The setup.cfg will be adapted upstream as soon as the release is out.
> Has that happened?

Answering to myself, linking to upstream review in External Trackers.

Comment 13 Alan Pevec 2016-05-11 10:36:38 UTC
The only package currently doing compile_catalog is python-django-openstack-auth

https://github.com/search?q=org%3Ardo-packages+compile_catalog&ref=searchresults&type=Code

Comment 14 Sven Anderson 2016-10-18 16:16:09 UTC
I proposed changes to include all catalogs into setup.cfg for all components that used several catalogs. Most got merged, only glance and newton is missing: https://review.openstack.org/#/q/topic:bug/1536226

BUT: that is not a requirement for adding `setup.py compile_catalog` to the spec files. So, we can do that right away. I also talked to the translations people in Austin and they said, these additional catalogs are empty anyways, but they wanted to keep them for reasons I was unable to understand. So this all is a lot of fuss about nothing. :-/

Comment 15 Sven Anderson 2016-10-18 16:28:40 UTC
Apparently the missing commands have been added already for most components, see 
https://github.com/search?q=org%3Ardo-packages+compile_catalog&ref=searchresults&type=Code

Here the change for nova:

https://github.com/rdo-packages/nova-distgit/commit/4bd3bb8f1417df106f457deadbcc62c0dd84d53a

Setting status to modified.

Comment 16 Sven Anderson 2016-10-18 16:29:35 UTC
Apparently the missing commands have been added already for most components, see 
https://github.com/search?q=org%3Ardo-packages+compile_catalog&ref=searchresults&type=Code

Here the change for nova:

https://github.com/rdo-packages/nova-distgit/commit/4bd3bb8f1417df106f457deadbcc62c0dd84d53a

Setting status to CLOSED.