aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n.rb
diff options
context:
space:
mode:
authorSven Fuchs <svenfuchs@artweb-design.de>2008-09-15 10:26:50 +0200
committerPratik Naik <pratiknaik@gmail.com>2008-09-20 19:26:16 +0100
commita3b7fa78bfdc33e45e39c095b67e02d50a2c7bea (patch)
tree0de20fad9f3a7ce2e49d660d1243b5b02a32e290 /activesupport/lib/active_support/vendor/i18n-0.0.1/i18n.rb
parent8cb7d460439a9b20a80a77b6370c1107233d1cbd (diff)
downloadrails-a3b7fa78bfdc33e45e39c095b67e02d50a2c7bea.tar.gz
rails-a3b7fa78bfdc33e45e39c095b67e02d50a2c7bea.tar.bz2
rails-a3b7fa78bfdc33e45e39c095b67e02d50a2c7bea.zip
I18n: Introduce I18n.load_path in favor of I18n.load_translations and change Simple backend to load translations lazily. [#1048 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activesupport/lib/active_support/vendor/i18n-0.0.1/i18n.rb')
-rwxr-xr-xactivesupport/lib/active_support/vendor/i18n-0.0.1/i18n.rb27
1 files changed, 17 insertions, 10 deletions
diff --git a/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n.rb b/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n.rb
index 0988ea8f44..344c77aecf 100755
--- a/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n.rb
+++ b/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n.rb
@@ -10,7 +10,8 @@ require 'i18n/exceptions'
module I18n
@@backend = nil
- @@default_locale = 'en-US'
+ @@load_path = nil
+ @@default_locale = :'en-US'
@@exception_handler = :default_exception_handler
class << self
@@ -49,14 +50,22 @@ module I18n
@@exception_handler = exception_handler
end
- # Allows client libraries to pass arguments that specify a source for
- # translation data to be loaded by the backend. The backend defines
- # acceptable sources.
+ # Allow clients to register paths providing translation data sources. The
+ # backend defines acceptable sources.
+ #
# E.g. the provided SimpleBackend accepts a list of paths to translation
# files which are either named *.rb and contain plain Ruby Hashes or are
- # named *.yml and contain YAML data.)
- def load_translations(*args)
- backend.load_translations(*args)
+ # named *.yml and contain YAML data. So for the SimpleBackend clients may
+ # register translation files like this:
+ # I18n.load_path << 'path/to/locale/en-US.yml'
+ def load_path
+ @@load_path ||= []
+ end
+
+ # Sets the load path instance. Custom implementations are expected to
+ # behave like a Ruby Array.
+ def load_path=(load_path)
+ @@load_path = load_path
end
# Translates, pluralizes and interpolates a given key using a given locale,
@@ -175,6 +184,4 @@ module I18n
keys.flatten.map{|k| k.to_sym}
end
end
-end
-
-
+end \ No newline at end of file