Plugin translations

I have a foreman plugin [1] for which translation .po files already exist.
The plugin is an isolated rails engine with most of the UI implemented in
angularjs. I have no problems with translations for the angular portion of
the UI , but cannot get the (non-angular) menus translations to work.

Looking at the instructions at [2] - I figured simply copying my existing
po files to <plugin_root>/locale/<lang>/redhat_acess.po should also
translate my menus as along as they are marked for translation in engine.rb
[3] , but this does not seem to work. Am I missing something?
I am testing against foreman 1.6.

Lindani

[1] https://github.com/redhataccess/foreman-plugin/tree/master/redhat-access
[2]
How to Create a Plugin - Foreman
[3]
https://github.com/redhataccess/foreman-plugin/blob/master/redhat-access/lib/redhat_access/engine.rb

It appears you're missing an engine initialiser to register your new
i18n "domain" ("redhat_access").

https://github.com/theforeman/foreman_plugin_template/pull/4/files#diff-4

Then when Foreman receives a _() method call, it'll iterate through
known i18n domains to find the translation.

Your gem and plugin should also include .mo files, which will be used
when running in production mode. In development, a plain text .po file
is sufficient.

··· On 03/11/14 21:39, Lindani Phiri wrote: > I have a foreman plugin [1] for which translation .po files already > exist. The plugin is an isolated rails engine with most of the UI > implemented in angularjs. I have no problems with translations for the > angular portion of the UI , but cannot get the (non-angular) menus > translations to work. > > Looking at the instructions at [2] - I figured simply copying my > existing po files to /locale//redhat_acess.po > should also translate my menus as along as they are marked for > translation in engine.rb [3] , but this does not seem to work. Am I > missing something? > I am testing against foreman 1.6.


Dominic Cleal
Red Hat Engineering

Thanks Dominic!

That did the trick.
I was not aware that there was an updated plugin template - I created my
plugin using an older template.
I think it would be useful to explicitly mention the i18n domain
initializer in the 'How to Create a Plugin' translation section.

Lindani

··· On Tuesday, November 4, 2014 2:29:24 AM UTC-5, Dominic Cleal wrote: > > On 03/11/14 21:39, Lindani Phiri wrote: > > I have a foreman plugin [1] for which translation .po files already > > exist. The plugin is an isolated rails engine with most of the UI > > implemented in angularjs. I have no problems with translations for the > > angular portion of the UI , but cannot get the (non-angular) menus > > translations to work. > > > > Looking at the instructions at [2] - I figured simply copying my > > existing po files to /locale//redhat_acess.po > > should also translate my menus as along as they are marked for > > translation in engine.rb [3] , but this does not seem to work. Am I > > missing something? > > I am testing against foreman 1.6. > > It appears you're missing an engine initialiser to register your new > i18n "domain" ("redhat_access"). > > https://github.com/theforeman/foreman_plugin_template/pull/4/files#diff-4 > > https://github.com/theforeman/foreman_bootdisk/blob/master/lib/foreman_bootdisk/engine.rb#L45-L49 > > Then when Foreman receives a _() method call, it'll iterate through > known i18n domains to find the translation. > > Your gem and plugin should also include .mo files, which will be used > when running in production mode. In development, a plain text .po file > is sufficient. > > -- > Dominic Cleal > Red Hat Engineering >