diff options
author | Sven Fuchs <svenfuchs@artweb-design.de> | 2008-06-20 09:13:20 +0200 |
---|---|---|
committer | Sven Fuchs <svenfuchs@artweb-design.de> | 2008-06-20 09:13:20 +0200 |
commit | 585c8c17c303fc46fcf014a644a541eae6cb5ffd (patch) | |
tree | b53e4531f2374e56c10e69a4127054573ad6a17b | |
parent | b09c6e7444cf05f986e601bcc22cf17ede7b63bd (diff) | |
download | rails-585c8c17c303fc46fcf014a644a541eae6cb5ffd.tar.gz rails-585c8c17c303fc46fcf014a644a541eae6cb5ffd.tar.bz2 rails-585c8c17c303fc46fcf014a644a541eae6cb5ffd.zip |
rename Backend::Simple#add_translations to set_translations
because it overwrites existing translations
-rw-r--r-- | actionpack/lib/action_view/helpers/form_options_helper.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/lang/en-US.rb | 2 | ||||
-rw-r--r-- | actionpack/test/template/number_helper_i18n_test.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/lang/en-US.rb | 2 | ||||
-rwxr-xr-x | activerecord/lib/active_record/validations.rb | 2 | ||||
-rw-r--r-- | activerecord/test/cases/validations_i18n_test.rb | 80 | ||||
-rw-r--r-- | activesupport/lib/active_support/lang/en-US.rb | 2 | ||||
m--------- | activesupport/lib/active_support/vendor/i18n-0.0.1 | 0 |
8 files changed, 46 insertions, 46 deletions
diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb index c782c0a816..a6b9e65a77 100644 --- a/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -349,7 +349,7 @@ module ActionView end # All the countries included in the country_options output. - # only included for backwards compatibility, please use the I18n interface + # deprecated. please use :'countries.names'.t directly COUNTRIES = :'countries.names'.t 'en-US' unless const_defined?("COUNTRIES") end diff --git a/actionpack/lib/action_view/lang/en-US.rb b/actionpack/lib/action_view/lang/en-US.rb index 659f96a5f3..70eb1b79de 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.add_translations :'en-US', { +I18n.backend.set_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 47cb035f56..d002ad4a2f 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.add_translations 'en-US', :currency => {:format => @defaults} + I18n.backend.set_translations 'en-US', :currency => {:format => @defaults} end def test_number_to_currency_given_a_locale_it_does_not_check_request_for_locale diff --git a/activerecord/lib/active_record/lang/en-US.rb b/activerecord/lib/active_record/lang/en-US.rb index 7c3bcfd85e..f307f40f1a 100644 --- a/activerecord/lib/active_record/lang/en-US.rb +++ b/activerecord/lib/active_record/lang/en-US.rb @@ -1,4 +1,4 @@ -I18n.backend.add_translations :'en-US', { +I18n.backend.set_translations :'en-US', { :active_record => { :error_messages => { :inclusion => "is not included in the list", diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb index 0ca68989d2..bcb204f1ba 100755 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -21,7 +21,7 @@ module ActiveRecord class << self def default_error_messages - # TODO deprecate this? + # ActiveSupport::Deprecation.warn("ActiveRecord::Errors.default_error_messages has been deprecated. Please use :'active_record.error_messages'.t.") :'active_record.error_messages'.t end end diff --git a/activerecord/test/cases/validations_i18n_test.rb b/activerecord/test/cases/validations_i18n_test.rb index eb454fca20..8f8574c242 100644 --- a/activerecord/test/cases/validations_i18n_test.rb +++ b/activerecord/test/cases/validations_i18n_test.rb @@ -6,7 +6,7 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase def setup reset_callbacks Topic @topic = Topic.new - I18n.backend.add_translations('en-US', :active_record => {:error_messages => {:custom => nil}}) + I18n.backend.set_translations('en-US', :active_record => {:error_messages => {:custom => nil}}) end def teardown @@ -113,8 +113,8 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase end def test_validates_confirmation_of_finds_custom_model_key_translation - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:confirmation => 'custom message'}}}}} - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:confirmation => 'global message'}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:confirmation => 'custom message'}}}}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:confirmation => 'global message'}} Topic.validates_confirmation_of :title @topic.title_confirmation = 'foo' @@ -123,7 +123,7 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase end def test_validates_confirmation_of_finds_global_default_translation - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:confirmation => 'global message'}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:confirmation => 'global message'}} Topic.validates_confirmation_of :title @topic.title_confirmation = 'foo' @@ -147,8 +147,8 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase end def test_validates_acceptance_of_finds_custom_model_key_translation - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:accepted => 'custom message'}}}}} - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:accepted => 'global message'}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:accepted => 'custom message'}}}}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:accepted => 'global message'}} Topic.validates_acceptance_of :title, :allow_nil => false @topic.valid? @@ -156,7 +156,7 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase end def test_validates_acceptance_of_finds_global_default_translation - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:accepted => 'global message'}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:accepted => 'global message'}} Topic.validates_acceptance_of :title, :allow_nil => false @topic.valid? @@ -179,8 +179,8 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase end def test_validates_presence_of_finds_custom_model_key_translation - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:blank => 'custom message'}}}}} - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:blank => 'global message'}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:blank => 'custom message'}}}}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:blank => 'global message'}} Topic.validates_presence_of :title @topic.valid? @@ -188,7 +188,7 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase end def test_validates_presence_of_finds_global_default_translation - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:blank => 'global message'}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:blank => 'global message'}} Topic.validates_presence_of :title @topic.valid? @@ -211,8 +211,8 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase end def test_validates_length_of_within_finds_custom_model_key_translation - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:too_short => 'custom message'}}}}} - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:too_short => 'global message'}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:too_short => 'custom message'}}}}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:too_short => 'global message'}} Topic.validates_length_of :title, :within => 3..5 @topic.valid? @@ -220,7 +220,7 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase end def test_validates_length_of_within_finds_global_default_translation - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:too_short => 'global message'}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:too_short => 'global message'}} Topic.validates_length_of :title, :within => 3..5 @topic.valid? @@ -243,8 +243,8 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase end def test_validates_length_of_within_finds_custom_model_key_translation - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:wrong_length => 'custom message'}}}}} - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:wrong_length => 'global message'}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:wrong_length => 'custom message'}}}}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:wrong_length => 'global message'}} Topic.validates_length_of :title, :is => 5 @topic.valid? @@ -252,7 +252,7 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase end def test_validates_length_of_within_finds_global_default_translation - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:wrong_length => 'global message'}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:wrong_length => 'global message'}} Topic.validates_length_of :title, :is => 5 @topic.valid? @@ -277,8 +277,8 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase end def test_validates_length_of_within_finds_custom_model_key_translation - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:wrong_length => 'custom message'}}}}} - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:wrong_length => 'global message'}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:wrong_length => 'custom message'}}}}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:wrong_length => 'global message'}} Topic.validates_length_of :title, :is => 5 @topic.valid? @@ -286,7 +286,7 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase end def test_validates_length_of_within_finds_global_default_translation - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:wrong_length => 'global message'}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:wrong_length => 'global message'}} Topic.validates_length_of :title, :is => 5 @topic.valid? @@ -311,8 +311,8 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase end def test_validates_format_of_finds_custom_model_key_translation - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:invalid => 'custom message'}}}}} - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:invalid => 'global message'}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:invalid => 'custom message'}}}}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:invalid => 'global message'}} Topic.validates_format_of :title, :with => /^[1-9][0-9]*$/ @topic.valid? @@ -320,7 +320,7 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase end def test_validates_format_of_finds_global_default_translation - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:invalid => 'global message'}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:invalid => 'global message'}} Topic.validates_format_of :title, :with => /^[1-9][0-9]*$/ @topic.valid? @@ -345,8 +345,8 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase end def test_validates_inclusion_of_finds_custom_model_key_translation - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:inclusion => 'custom message'}}}}} - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:inclusion => 'global message'}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:inclusion => 'custom message'}}}}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:inclusion => 'global message'}} Topic.validates_inclusion_of :title, :in => %w(a b c) @topic.valid? @@ -354,7 +354,7 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase end def test_validates_inclusion_of_finds_global_default_translation - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:inclusion => 'global message'}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:inclusion => 'global message'}} Topic.validates_inclusion_of :title, :in => %w(a b c) @topic.valid? @@ -379,8 +379,8 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase end def test_validates_exclusion_of_finds_custom_model_key_translation - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:exclusion => 'custom message'}}}}} - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:exclusion => 'global message'}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:exclusion => 'custom message'}}}}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:exclusion => 'global message'}} Topic.validates_exclusion_of :title, :in => %w(a b c) @topic.title = 'a' @@ -389,7 +389,7 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase end def test_validates_exclusion_of_finds_global_default_translation - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:exclusion => 'global message'}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:exclusion => 'global message'}} Topic.validates_exclusion_of :title, :in => %w(a b c) @topic.title = 'a' @@ -415,8 +415,8 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase end def test_validates_numericality_of_only_integer_finds_custom_model_key_translation - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:not_a_number => 'custom message'}}}}} - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:not_a_number => 'global message'}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:not_a_number => 'custom message'}}}}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:not_a_number => 'global message'}} Topic.validates_numericality_of :title, :only_integer => true @topic.title = 'a' @@ -425,7 +425,7 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase end def test_validates_numericality_of_only_integer_finds_global_default_translation - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:not_a_number => 'global message'}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:not_a_number => 'global message'}} Topic.validates_numericality_of :title, :only_integer => true @topic.title = 'a' @@ -451,8 +451,8 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase end def test_validates_numericality_of_odd_finds_custom_model_key_translation - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:odd => 'custom message'}}}}} - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:odd => 'global message'}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:odd => 'custom message'}}}}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:odd => 'global message'}} Topic.validates_numericality_of :title, :only_integer => true, :odd => true @topic.title = 0 @@ -461,7 +461,7 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase end def test_validates_numericality_of_odd_finds_global_default_translation - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:odd => 'global message'}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:odd => 'global message'}} Topic.validates_numericality_of :title, :only_integer => true, :odd => true @topic.title = 0 @@ -487,8 +487,8 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase end def test_validates_numericality_of_less_than_finds_custom_model_key_translation - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:less_than => 'custom message'}}}}} - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:less_than => 'global message'}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:less_than => 'custom message'}}}}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:less_than => 'global message'}} Topic.validates_numericality_of :title, :only_integer => true, :less_than => 0 @topic.title = 1 @@ -497,7 +497,7 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase end def test_validates_numericality_of_less_than_finds_global_default_translation - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:less_than => 'global message'}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:less_than => 'global message'}} Topic.validates_numericality_of :title, :only_integer => true, :less_than => 0 @topic.title = 1 @@ -521,8 +521,8 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase end def test_validates_associated_finds_custom_model_key_translation - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:replies => {:invalid => 'custom message'}}}}} - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:invalid => 'global message'}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:replies => {:invalid => 'custom message'}}}}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:invalid => 'global message'}} Topic.validates_associated :replies replied_topic.valid? @@ -530,7 +530,7 @@ class ActiveRecordValidationsI18nTests < Test::Unit::TestCase end def test_validates_associated_finds_global_default_translation - I18n.backend.add_translations 'en-US', :active_record => {:error_messages => {:invalid => 'global message'}} + I18n.backend.set_translations 'en-US', :active_record => {:error_messages => {:invalid => 'global message'}} Topic.validates_associated :replies replied_topic.valid? diff --git a/activesupport/lib/active_support/lang/en-US.rb b/activesupport/lib/active_support/lang/en-US.rb index 8732927f48..5b8e04363e 100644 --- a/activesupport/lib/active_support/lang/en-US.rb +++ b/activesupport/lib/active_support/lang/en-US.rb @@ -1,4 +1,4 @@ -I18n.backend.add_translations :'en-US', { +I18n.backend.set_translations :'en-US', { :support => { :array => { :sentence_connector => 'and' diff --git a/activesupport/lib/active_support/vendor/i18n-0.0.1 b/activesupport/lib/active_support/vendor/i18n-0.0.1 -Subproject 70ab0f3cc5921cc67e09741939a08b2582d707c +Subproject 1af3435539b4a0729c13d21c5df037a635fe98c |