What does everybody think about this ticket? https://rails.lighthouseapp.com/projects/8994/tickets/2325-i18n-support-for-engines Basically the question is: Should Rails as a framework automatically try to load any translations supplied by plugins and/or gems? Or should the developer be responsible for adding these manually? I personally tend to solutions that give the developer more control by just requiring himself to do the right thing. I can see though that - as Rails loads the application''s translations automatically - one would want the plugin translations to be loaded as well. Any opinions?
With engines being able to add functionality, I believe that this functionality will also need to be translated and it should be the responsibility of those providing the functionality, not the developer of the application. 2009/8/26 Sven Fuchs <svenfuchs@artweb-design.de>> > What does everybody think about this ticket? > > > https://rails.lighthouseapp.com/projects/8994/tickets/2325-i18n-support-for-engines > > Basically the question is: Should Rails as a framework automatically > try to load any translations supplied by plugins and/or gems? Or > should the developer be responsible for adding these manually? > > I personally tend to solutions that give the developer more control by > just requiring himself to do the right thing. I can see though that - > as Rails loads the application''s translations automatically - one > would want the plugin translations to be loaded as well. > > Any opinions? > > > >-- Ryan Bigg --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Sure :) The question remains ... should an Engine dev be expected add something like this to their code? # init.rb I18n.load_path += Dir[''/path/to/translations/**/*.{yml,rb}''] Or should Rails do that automagically for everybody''s plugins/gems? On 26.08.2009, at 13:28, Ryan Bigg (Radar) wrote:> With engines being able to add functionality, I believe that this > functionality will also need to be translated and it should be the > responsibility of those providing the functionality, not the > developer of the application. > > 2009/8/26 Sven Fuchs <svenfuchs@artweb-design.de> > > What does everybody think about this ticket? > > https://rails.lighthouseapp.com/projects/8994/tickets/2325-i18n-support-for-engines > > Basically the question is: Should Rails as a framework automatically > try to load any translations supplied by plugins and/or gems? Or > should the developer be responsible for adding these manually? > > I personally tend to solutions that give the developer more control by > just requiring himself to do the right thing. I can see though that - > as Rails loads the application''s translations automatically - one > would want the plugin translations to be loaded as well. > > Any opinions? > > > > > > -- > Ryan Bigg > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On Aug 26, 1:38 pm, Sven Fuchs <svenfu...@artweb-design.de> wrote:> The question remains ... should an Engine dev be expected add > something like this to their code?> # init.rb > I18n.load_path += Dir[''/path/to/translations/**/*.{yml,rb}'']In my opinion yes. Why not load automagically the translations path when Rails is doing so with the routes. With this what we achieve is that all engines will have the same structure, so it will be easier for people to know where to look for the translation files. In the case of the engine I''ve been working on, I store the translations using the same structure Rails does. vendor/plugins/typus/lib/locales/typus/es.yml At this moment, without supporting it, the developer has to manage what to do when the engine is a gem. if plugin? I18n.load_path += Dir[File.join(root, ''config'', ''locales'', ''**'', ''*.{rb,yml}'')] else Gem.path.each { |g| I18n.load_path += Dir[File.join("#{g}/gems/ *typus-#{version}/config/locales/**/*.{rb,yml}")] } end
Agree with Francesc -- lucaguidi.com twitter.com/jodosha
On 26-Aug-09, at 7:23 AM, Sven Fuchs wrote:> > What does everybody think about this ticket? > > https://rails.lighthouseapp.com/projects/8994/tickets/2325-i18n-support-for-engines > > Basically the question is: Should Rails as a framework automatically > try to load any translations supplied by plugins and/or gems?Yes, I think it should> I personally tend to solutions that give the developer more control by > just requiring himself to do the right thing.Sure, but I''m not sure what the benefit would be in this case; and they could always put the in a non standard place and load them manually if they really want to
2009/8/26 Sven Fuchs <svenfuchs@artweb-design.de>> Sure :) > The question remains ... should an Engine dev be expected add something > like this to their code? > > # init.rb > I18n.load_path += Dir[''/path/to/translations/**/*.{yml,rb}''] > > Or should Rails do that automagically for everybody''s plugins/gems? >Automagically, with the file kept in the I18n.load_path (inside the engine) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Alright, that''s a clear vote of 4:0 :) I''ll have a look at a patch. I assume this can go into 2.3.x? On 26.08.2009, at 22:23, Ryan Bigg (Radar) wrote:> > > 2009/8/26 Sven Fuchs <svenfuchs@artweb-design.de> > Sure :) > > The question remains ... should an Engine dev be expected add > something like this to their code? > > # init.rb > I18n.load_path += Dir[''/path/to/translations/**/*.{yml,rb}''] > > Or should Rails do that automagically for everybody''s plugins/gems? > > Automagically, with the file kept in the I18n.load_path (inside the > engine) > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
> I''ll have a look at a patch. I assume this can go into 2.3.x?Let''s start with master and look at backporting if it''s simple and ''purely additive''. -- Cheers Koz
On 30.08.2009, at 20:00, Michael Koziarski wrote:>> I''ll have a look at a patch. I assume this can go into 2.3.x? > > Let''s start with master and look at backporting if it''s simple and > ''purely additive''.I guess it is :) Here are two patches for master and 2-3-stable: https://rails.lighthouseapp.com/projects/8994/tickets/2325/a/256496/0001_master_i18n-load_path-support-for-engines.patch https://rails.lighthouseapp.com/projects/8994/tickets/2325/a/256522/0001_2-3-stable_i18n-load_path-support-for-engines.patch Ticket: https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/2325-i18n-support-for-engines
El Domingo, 30 de Agosto de 2009 20:24:16 Sven Fuchs escribió:> On 30.08.2009, at 20:00, Michael Koziarski wrote: > >> I''ll have a look at a patch. I assume this can go into 2.3.x? > > > > Let''s start with master and look at backporting if it''s simple and > > ''purely additive''. > > I guess it is :) > > Here are two patches for master and 2-3-stable: > > https://rails.lighthouseapp.com/projects/8994/tickets/2325/a/256496/0001_ma > ster_i18n-load_path-support-for-engines.patch > https://rails.lighthouseapp.com/projects/8994/tickets/2325/a/256522/0001_2 > -3-stable_i18n-load_path-support-for-engines.patch > > Ticket: > > https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/2325-i1 > 8n-support-for-enginesThanks Sven for pushing this. I''m afraid it was incomplete. Engine translations are added at the end of the I18n.load_path, so they take precedence over application translations. I think application developers should be able to overwrite engine translations, so here is a patch for it: https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/3537- prioritize-application-i18n-above-engine-i18n http://github.com/atd/rails/commit/6161e719012e856a59248fe338ff1c014ed344b3 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.