diff options
author | Sven Fuchs <svenfuchs@artweb-design.de> | 2008-06-21 11:27:19 +0200 |
---|---|---|
committer | Sven Fuchs <svenfuchs@artweb-design.de> | 2008-06-21 11:27:19 +0200 |
commit | c1e2506494107892a0962b8491cd234f77949c08 (patch) | |
tree | aa333cb3d8a6ff05088b6a524e30f04169aaf5f5 /actionpack | |
parent | 585c8c17c303fc46fcf014a644a541eae6cb5ffd (diff) | |
download | rails-c1e2506494107892a0962b8491cd234f77949c08.tar.gz rails-c1e2506494107892a0962b8491cd234f77949c08.tar.bz2 rails-c1e2506494107892a0962b8491cd234f77949c08.zip |
Changed process of storing translations from the
client libraries to the backend: clients now can pass a block to
backend#populate which can contain code to load and register translations.
This makes sense for backends that persist their translations (e.g. to db)
so the repeated loading and passing of translations throughout the server
startup would be wasted resources.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_view.rb | 4 | ||||
-rw-r--r-- | actionpack/lib/action_view/lang/en-US.rb | 2 | ||||
-rw-r--r-- | actionpack/test/template/number_helper_i18n_test.rb | 2 |
3 files changed, 5 insertions, 3 deletions
diff --git a/actionpack/lib/action_view.rb b/actionpack/lib/action_view.rb index 33d50a61c4..dff487377f 100644 --- a/actionpack/lib/action_view.rb +++ b/actionpack/lib/action_view.rb @@ -32,7 +32,9 @@ require 'action_view/base' require 'action_view/partials' require 'action_view/template_error' -require 'action_view/lang/en-US.rb' +I18n.backend.populate do + require 'action_view/lang/en-US.rb' +end ActionView::Base.class_eval do include ActionView::Partials diff --git a/actionpack/lib/action_view/lang/en-US.rb b/actionpack/lib/action_view/lang/en-US.rb index 70eb1b79de..6b5345ed90 100644 --- a/actionpack/lib/action_view/lang/en-US.rb +++ b/actionpack/lib/action_view/lang/en-US.rb @@ -1,4 +1,4 @@ -I18n.backend.set_translations :'en-US', { +I18n.backend.store_translations :'en-US', { :date => { :formats => { :default => "%Y-%m-%d", diff --git a/actionpack/test/template/number_helper_i18n_test.rb b/actionpack/test/template/number_helper_i18n_test.rb index d002ad4a2f..b75af03378 100644 --- a/actionpack/test/template/number_helper_i18n_test.rb +++ b/actionpack/test/template/number_helper_i18n_test.rb @@ -7,7 +7,7 @@ class NumberHelperI18nTests < Test::Unit::TestCase def setup @request = mock @defaults = {:separator => ".", :unit => "$", :format => "%u%n", :delimiter => ",", :precision => 2} - I18n.backend.set_translations 'en-US', :currency => {:format => @defaults} + I18n.backend.store_translations 'en-US', :currency => {:format => @defaults} end def test_number_to_currency_given_a_locale_it_does_not_check_request_for_locale |