diff options
author | Antonio Tapiador del Dujo <atapiador@dit.upm.es> | 2009-03-24 14:49:47 +0100 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-08-30 13:36:22 -0700 |
commit | cf4846c6ae991143afaef987a63c3ad9a3a2546b (patch) | |
tree | 79dcc28149ac974aab94b48ae429aa6071d39afb /railties/lib/rails/plugin.rb | |
parent | 0efedf2a30a12cdaa261556e3684c630690afe0f (diff) | |
download | rails-cf4846c6ae991143afaef987a63c3ad9a3a2546b.tar.gz rails-cf4846c6ae991143afaef987a63c3ad9a3a2546b.tar.bz2 rails-cf4846c6ae991143afaef987a63c3ad9a3a2546b.zip |
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 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'railties/lib/rails/plugin.rb')
-rw-r--r-- | railties/lib/rails/plugin.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb index 49ec5c7fba..1c0af6411a 100644 --- a/railties/lib/rails/plugin.rb +++ b/railties/lib/rails/plugin.rb @@ -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 |