Permalink
Browse files

rename load_paths to load_path

  • Loading branch information...
1 parent c4c5649 commit 250c0453c9f3f5cbbec59ecee5fec186df5b2f4f Sven Fuchs committed Sep 14, 2008
Showing with 11 additions and 7 deletions.
  1. +8 −4 lib/i18n.rb
  2. +3 −3 lib/i18n/backend/simple.rb
View
@@ -10,7 +10,7 @@
module I18n
@@backend = nil
- @@load_paths = []
+ @@load_path = []
@@default_locale = :'en-US'
@@exception_handler = :default_exception_handler
@@ -57,9 +57,13 @@ def exception_handler=(exception_handler)
# files which are either named *.rb and contain plain Ruby Hashes or are
# named *.yml and contain YAML data. So for the SimpleBackend clients may
# register translation files like this:
- # I18n.load_paths << 'path/to/locale/en-US.yml'
- def load_paths
- @@load_paths
+ # I18n.load_path << 'path/to/locale/en-US.yml'
+ def load_path
+ @@load_path
+ end
+
+ def load_path=(load_path)
+ @@load_path = load_path
end
# Translates, pluralizes and interpolates a given key using a given locale,
@@ -61,8 +61,8 @@ def localize(locale, object, format = :default)
protected
- def initialize
- load_translations *I18n.load_paths unless I18n.load_paths.empty?
+ def init_translations
+ load_translations(*I18n.load_path)
@initialized = true
end
@@ -77,7 +77,7 @@ def translations
# <tt>%w(currency format)</tt>.
def lookup(locale, key, scope = [])
return unless key
- initialize unless @initialized
+ init_translations unless @initialized
keys = I18n.send :normalize_translation_keys, locale, key, scope
keys.inject(translations){|result, k| result[k.to_sym] or return nil }
end

0 comments on commit 250c045

Please sign in to comment.