Localizing an engine with gettext .. what and where?

I succeeded localizing my app with gettext (good tutorial @
http://www.yotabanana.com/hiki/ruby-gettext-howto-rails.html) BUT… I’d
like to localize an engine (let’s call it jdoe_engine…
it seems more complicated…

In order to get my pot/po’s to generate my mo’s
what should be my rakefile ? where it should be located ? how can I run
it ? any additional lines to be inserted into my app files to take my
mo’s in account ?
could google it anywhere …

masao wrote that , but I don’t actually got it right :

Rails Plugins
You can localized your Rails Plugins easily.

require ‘gettext/rails’
module FooPlugin
include GetText::Rails
bindtextdomain(“foo_plugin”, :path => File.join(RAILS_ROOT,
“vendor/plugins/foo/locale”))
:
:
end
In this example, the FooPlugin module binds “foo_plugin” textdomain.
And the mo files are in
vendor/plugins/foo/locale/#{lang}/LC_MESSGES/foo_plugin.mo.

If you want to use the same textdomain with the application, you can use
ActionController::Base.textdomainname.

Hi,

On Sun, 27 Aug 2006 19:33:07 +0200
Kad K. [email protected] wrote:

I succeeded localizing my app with gettext (good tutorial @
http://www.yotabanana.com/hiki/ruby-gettext-howto-rails.html) BUT… I’d
like to localize an engine (let’s call it jdoe_engine…
it seems more complicated…

In order to get my pot/po’s to generate my mo’s
what should be my rakefile ?

I’ve not test it, but it should be something like this:

require ‘gettext/utils’
desc “Create mo-files for L10n”
task :makemo do
GetText.create_mofiles(true, “po”, “locale”)
end
desc “Update pot/po files to match new version.”
task :updatepo do
GetText.update_pofiles(“jdoe_engine”,
Dir.glob(“{app,lib}/**/*.{rb,rhtml}”),
“jdoe_engine #{version}”)
end

where it should be located ?

vendor/plugins/foo/Rakefile.

how can I run it ? any additional lines to be inserted into my app files to take my
mo’s in account ?

$ cd vendor/plugins/foo
$ rake updatepo

could google it anywhere …

Did you check samples/rails/vendor/plugins/gettext in gettext gem ?

masao wrote that , but I don’t actually got it right :

Rails Plugins
You can localized your Rails Plugins easily.

Engines is not simple plugin as you say.
But recently, I’ve get some questions like yours.
So, with next version of Ruby-GetText, engines will be able to use
GetText easier.
Also I’ll write a tutorial for it after releasing next version of
GetText.

Already, I’ve implemented some code for this on CVS.

You can try it, but there’ve been no sample yet, though.

Anyway, thanks for trying Ruby-GetText.


.:% Masao M.[email protected]