diff options
author | Sven Fuchs <svenfuchs@artweb-design.de> | 2008-08-13 11:42:02 +0200 |
---|---|---|
committer | Sven Fuchs <svenfuchs@artweb-design.de> | 2008-08-13 11:42:02 +0200 |
commit | 78677cf6af339a6e23a93a45c905d6d1545ccc33 (patch) | |
tree | 1bf3c9f5b1292d9e2f14505c2148b2164566fc48 /activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend | |
parent | aae9f916590b8ce2c84a9e404584de95b1705766 (diff) | |
download | rails-78677cf6af339a6e23a93a45c905d6d1545ccc33.tar.gz rails-78677cf6af339a6e23a93a45c905d6d1545ccc33.tar.bz2 rails-78677cf6af339a6e23a93a45c905d6d1545ccc33.zip |
update activesupport/vendor i18n gem
Diffstat (limited to 'activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend')
-rw-r--r-- | activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb b/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb index 98c7964b21..ba7e11210a 100644 --- a/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb +++ b/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb @@ -12,7 +12,10 @@ module I18n def populate(&block) yield end - + + # Accepts a list of paths to translation files. Loads translations from + # plain Ruby (*.rb) or YAML files (*.yml). See #load_rb and #load_yml + # for details. def load_translations(*filenames) filenames.each {|filename| load_file filename } end @@ -135,6 +138,10 @@ module I18n s.string end + # Loads a single translations file by delegating to #load_rb or + # #load_yml depending on the file extension and directly merges the + # data to the existing translations. Raises I18n::UnknownFileType + # for all other file extensions. def load_file(filename) type = File.extname(filename).tr('.', '').downcase raise UnknownFileType.new(type, filename) unless respond_to? :"load_#{type}" @@ -144,10 +151,14 @@ module I18n end end + # Loads a plain Ruby translations file. eval'ing the file must yield + # a Hash containing translation data with locales as toplevel keys. def load_rb(filename) eval IO.read(filename), binding, filename end + # Loads a YAML translations file. The data must have locales as + # toplevel keys. def load_yml(filename) YAML::load IO.read(filename) end |