[Ironic] [i18n] Testing translations

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Ironic] [i18n] Testing translations

Devananda van der Veen
For those interested in translations, I'd like to jot down a few notes from the last few days' work to get i18n'd strings into Ironic before our RC. Hopefully some of this will be helpful to someone out there -- it's been a learning experience for me :)

Quick background:
- the project was set up with transifex a while back
- folks have been translating our strings on transifex
- jenkins has been regularly proposing updates to ironic, which we've accepted

However, late last week I noticed that none of the ironic/locale/*/LC_MESSAGES/ironic.po files had any actual translated strings in them. Some digging revealed that there were two problems:
* most of the .po files had somehow gotten malformatted (duplicate blank messages). We now have a tox check to prevent this.
* the file timestamps were newer than the translations on transifex. Easy work around is "pull --force".
Manual fixes for both of these have landed in Ironic, and longer-term fixes have gone up for infra and some other projects.

To determine whether or not this was successful in enabling translated strings in Ironic, I had to learn a few things about babel and gettextutils, but there's still a lot more catching up on the whole i18n discussion that I need to do. This morning, I confirmed, in fact, our LOG messages are getting translated based on the system language, if the correct locale's .mo file is found in the appropriate system path, or that path is overridden with the IRONIC_LOCALEDIR env var. At the moment, Ironic's API strings will also be translated based on the system language, not on the Accept-Language header. 

I've jotted down some notes on how to recreate an environment which reproduces this without needing to package and install ironic.

It also seems that we're not programatically testing whether translation works or not. Maybe there's a good reason this hasn't been done yet... but after spending a couple days getting it to work in Ironic, I would like to add a test to our gate so that I know it stays working. I'm not sure the best way to go about that, but I hope someone who knows more about tx/msgfmt/babel/etc can look at my notes above and suggest or get something going from that.

Cheers,
Devananda

_______________________________________________
OpenStack-dev mailing list
[hidden email]
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev