Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

i18n support for Engines

#2325

Localization files in myplugin/config/locales are added to I18n.load_path

Patch

Reported by Antonio Tapiador · March 24th, 2009 @ 02:00 PM

State: committed
Milestone: 2.3.4
Assigned to: Jeremy Kemper Jeremy Kemper
Importance: High

Activity

  1. Sven Fuchs
    Sven Fuchs
    • Assigned user set to Sven Fuchs

    July 8th, 2009 @ 11:38 PM

  2. Francesc Esplugas
    Francesc Esplugas

    +1 to this. I added support for I18n on Typus about 8 months ago.

    # Load translation files from the plugin or the gem.
    if plugin?
      I18n.load_path += Dir[File.join("#{Rails.root}/vendor/plugins/typus/config/locales/**/*.{rb,yml}")]
    else
      Gem.path.each { |g| I18n.load_path += Dir[File.join("#{g}/gems/*typus-#{version}/config/locales/**/*.{rb,yml}")] }
    end
    

    As with the initializers, this would be a plus for developing engines.

    July 9th, 2009 @ 12:01 AM

  3. Sven Fuchs
  4. Sven Fuchs
    Sven Fuchs
    • Milestone changed from 2.x to 2.3.4
    • State changed from new to open
    • Assigned user changed from Sven Fuchs to Jeremy Kemper

    Ok, people voted clearly 4:0 on this on the rails-core mailinglist. Nobody objected.

    The commit from Antonio's fork does neither apply to current master nor 2-3-stable. Also, it potentially leaves a non-uniq I18n.load_path. I've fixed both issues and expanded the commit message a bit, but preserved Antonio's authorship.

    Attached are two patches that apply to 2-3-stable and master respectively. Tests are passing on both branches.

    Jeremy, I'll forward this ticket to you :)

    August 30th, 2009 @ 02:13 PM

  5. Sven Fuchs
    Sven Fuchs

    Crap. Wrong version of the 2-3-stable patch. Here's the right one. (Apparently I can't delete the previous version.)

    August 30th, 2009 @ 07:21 PM

  6. Sven Fuchs
    Sven Fuchs

    Ah, now it worked. Lighthouse caching issues. Sorry for the noise.

    August 30th, 2009 @ 07:25 PM

  7. Repository
    Repository
    • State changed from open to committed

    (from [cf4846c6ae991143afaef987a63c3ad9a3a2546b]) I18n support for plugins

    Rails will now automatically add locale files found in any engine's locale
    directory to the I18n.load_path (i.e. files that match the glob pattern
    "config/locales/*/.{rb,yml}" relative to engine directories).

    [#2325 i18n support for Engines state:committed]

    Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
    http://github.com/rails/rails/commit/cf4846c6ae991143afaef987a63c3a...

    August 30th, 2009 @ 09:41 PM

  8. Repository
    Repository

    (from [49342d1745dd0e6c4ebebe9e535e374783ac2c10]) I18n support for plugins

    Rails will now automatically add locale files found in any engine's locale
    directory to the I18n.load_path (i.e. files that match the glob pattern
    "config/locales/*/.{rb,yml}" relative to engine directories).

    [#2325 i18n support for Engines state:committed]

    Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
    http://github.com/rails/rails/commit/49342d1745dd0e6c4ebebe9e535e37...

    August 30th, 2009 @ 09:41 PM

  9. Sven Fuchs