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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Masao Mutoh
2006-Aug-28 12:44 UTC
Re: Localizing an engine with gettext .. what and where ?
Hi, On Sun, 27 Aug 2006 19:33:07 +0200 Kad Kerforn <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> 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 Mutoh<mutoh-+e5RZkbjevhHfZP73Gtkiw@public.gmane.org> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---