<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>railties/test/fixtures/plugins/engines/engine/config/locales/en.yml</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,7 +1,13 @@
+*2.3.4 (pending)*
+
+* I18n support for plugins.  #2325 [Antonio Tapiador, Sven Fuchs]
+
+
 *2.3.3 (July 12 2009)
 
 * Version bump
 
+
 *2.3.2 [Final] (March 15, 2009)*
 
 * Allow metal to live in plugins #2045 [Matthew Rudy]</diff>
      <filename>railties/CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -71,6 +71,10 @@ module Rails
       File.exist?(routing_file)
     end
 
+    # Returns true if there is any localization file in locale_path
+    def localized?
+      locale_files.any?
+    end
 
     def view_path
       File.join(directory, 'app', 'views')
@@ -87,6 +91,14 @@ module Rails
     def routing_file
       File.join(directory, 'config', 'routes.rb')
     end
+
+    def locale_path
+      File.join(directory, 'config', 'locales')
+    end
+
+    def locale_files
+      Dir[ File.join(locale_path, '*.{rb,yml}') ]
+    end
     
 
     private</diff>
      <filename>railties/lib/rails/plugin.rb</filename>
    </modified>
    <modified>
      <diff>@@ -73,6 +73,7 @@ module Rails
         def configure_engines
           if engines.any?
             add_engine_routing_configurations
+            add_engine_locales
             add_engine_controller_paths
             add_engine_view_paths
           end
@@ -84,6 +85,12 @@ module Rails
           end
         end
 
+        def add_engine_locales
+          # reverse it such that the last engine can overwrite translations from the first, like with routes
+          locale_files = engines.select(&amp;:localized?).collect(&amp;:locale_files).reverse.flatten
+          I18n.load_path += locale_files - I18n.load_path
+        end
+
         def add_engine_controller_paths
           ActionController::Routing.controller_paths += engines.collect(&amp;:controller_path)
         end</diff>
      <filename>railties/lib/rails/plugin/loader.rb</filename>
    </modified>
    <modified>
      <diff>@@ -313,6 +313,8 @@ class InitializerSetupI18nTests &lt; Test::Unit::TestCase
      File.expand_path(File.dirname(__FILE__) + &quot;/../../activesupport/lib/active_support/locale/en.yml&quot;),
      File.expand_path(File.dirname(__FILE__) + &quot;/../../actionpack/lib/action_view/locale/en.yml&quot;),
      File.expand_path(File.dirname(__FILE__) + &quot;/../../activerecord/lib/active_record/locale/en.yml&quot;),
+     # FIXME: should clean I18n.load_path between each test
+     File.expand_path(File.dirname(__FILE__) + &quot;/../../railties/test/fixtures/plugins/engines/engine/config/locales/en.yml&quot;),
      &quot;my/test/locale.yml&quot;,
      &quot;my/other/locale.yml&quot; ], I18n.load_path.collect { |path| path =~ /^\./ ? File.expand_path(path) : path }
   end</diff>
      <filename>railties/test/initializer_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -155,6 +155,14 @@ class TestPluginLoader &lt; Test::Unit::TestCase
     plugin_load_paths.each { |path| assert $LOAD_PATH.include?(path) }
   end
 
+  def test_should_add_locale_files_to_I18n_load_path
+    only_load_the_following_plugins! [:engine]
+
+    @loader.send :add_engine_locales
+
+    assert I18n.load_path.include?(File.join(plugin_fixture_path('engines/engine'), 'config', 'locales', 'en.yml'))
+  end
+
 
   private
     def reset_load_path!</diff>
      <filename>railties/test/plugin_loader_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ff8cb50f25e426c531743fbf918e2a870e60e0e8</id>
    </parent>
  </parents>
  <author>
    <name>Antonio Tapiador del Dujo</name>
    <login>atd</login>
    <email>atapiador@dit.upm.es</email>
  </author>
  <url>http://github.com/rails/rails/commit/49342d1745dd0e6c4ebebe9e535e374783ac2c10</url>
  <id>49342d1745dd0e6c4ebebe9e535e374783ac2c10</id>
  <committed-date>2009-08-30T13:38:10-07:00</committed-date>
  <authored-date>2009-03-24T06:49:47-07:00</authored-date>
  <message>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
&quot;config/locales/**/*.{rb,yml}&quot; relative to engine directories).

[#2325 state:committed]

Signed-off-by: Jeremy Kemper &lt;jeremy@bitsweat.net&gt;</message>
  <tree>59f444ace193517591cea52e941806239a4aa3f8</tree>
  <committer>
    <name>Jeremy Kemper</name>
    <login>jeremy</login>
    <email>jeremy@bitsweat.net</email>
  </committer>
</commit>
