diff options
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/core_ext/array/conversions.rb | 2 | ||||
m--------- | activesupport/lib/active_support/vendor/i18n-0.0.1 | 0 | ||||
-rw-r--r-- | activesupport/test/core_ext/i18n_test.rb | 75 | ||||
-rw-r--r-- | activesupport/test/i18n_test.rb | 75 |
4 files changed, 76 insertions, 76 deletions
diff --git a/activesupport/lib/active_support/core_ext/array/conversions.rb b/activesupport/lib/active_support/core_ext/array/conversions.rb index 80d91a6cbd..80bf1404de 100644 --- a/activesupport/lib/active_support/core_ext/array/conversions.rb +++ b/activesupport/lib/active_support/core_ext/array/conversions.rb @@ -13,7 +13,7 @@ module ActiveSupport #:nodoc: locale = options[:locale] locale ||= self.locale if respond_to?(:locale) - default = :'support.array.sentence_connector'.t(locale) + default = I18n.translate(:'support.array.sentence_connector', locale) options.reverse_merge! :connector => default, :skip_last_comma => false options[:connector] = "#{options[:connector]} " unless options[:connector].nil? || options[:connector].strip == '' diff --git a/activesupport/lib/active_support/vendor/i18n-0.0.1 b/activesupport/lib/active_support/vendor/i18n-0.0.1 -Subproject 20c331666b3b6a21791d4cded53c3d8654fba71 +Subproject 970bc7ab5faa94e41ee4a56bc8913c144c1cdd1 diff --git a/activesupport/test/core_ext/i18n_test.rb b/activesupport/test/core_ext/i18n_test.rb deleted file mode 100644 index a67b6a5d8c..0000000000 --- a/activesupport/test/core_ext/i18n_test.rb +++ /dev/null @@ -1,75 +0,0 @@ -require 'abstract_unit' - -class I18nTest < Test::Unit::TestCase - def setup - @date = Date.parse("2008-7-2") - @time = Time.utc(2008, 7, 2, 16, 47, 1) - end - - uses_mocha 'I18nTimeZoneTest' do - def test_time_zone_localization_with_default_format - Time.zone.stubs(:now).returns Time.local(2000) - assert_equal "Sat, 01 Jan 2000 00:00:00 +0100", Time.zone.now.l - end - end - - def test_date_localization_should_use_default_format - assert_equal "2008-07-02", @date.l - end - - def test_date_localization_with_default_format - assert_equal "2008-07-02", @date.l(nil, :default) - end - - def test_date_localization_with_short_format - assert_equal "Jul 02", @date.l(nil, :short) - end - - def test_date_localization_with_long_format - assert_equal "July 02, 2008", @date.l(nil, :long) - end - - def test_time_localization_should_use_default_format - assert_equal "Wed, 02 Jul 2008 16:47:01 +0100", @time.l - end - - def test_time_localization_with_default_format - assert_equal "Wed, 02 Jul 2008 16:47:01 +0100", @time.l(nil, :default) - end - - def test_time_localization_with_short_format - assert_equal "02 Jul 16:47", @time.l(nil, :short) - end - - def test_time_localization_with_long_format - assert_equal "July 02, 2008 16:47", @time.l(nil, :long) - end - - def test_day_names - assert_equal Date::DAYNAMES, :'date.day_names'.t - end - - def test_abbr_day_names - assert_equal Date::ABBR_DAYNAMES, :'date.abbr_day_names'.t - end - - def test_month_names - assert_equal Date::MONTHNAMES, :'date.month_names'.t - end - - def test_abbr_month_names - assert_equal Date::ABBR_MONTHNAMES, :'date.abbr_month_names'.t - end - - def test_date_order - assert_equal [:year, :month, :day], :'date.order'.t - end - - def test_time_am - assert_equal 'am', :'time.am'.t - end - - def test_time_pm - assert_equal 'pm', :'time.pm'.t - end -end diff --git a/activesupport/test/i18n_test.rb b/activesupport/test/i18n_test.rb new file mode 100644 index 0000000000..e6d90f09c1 --- /dev/null +++ b/activesupport/test/i18n_test.rb @@ -0,0 +1,75 @@ +require 'abstract_unit' + +class I18nTest < Test::Unit::TestCase + def setup + @date = Date.parse("2008-7-2") + @time = Time.utc(2008, 7, 2, 16, 47, 1) + end + + uses_mocha 'I18nTimeZoneTest' do + def test_time_zone_localization_with_default_format + Time.zone.stubs(:now).returns Time.local(2000) + assert_equal "Sat, 01 Jan 2000 00:00:00 +0100", I18n.localize(Time.zone.now) + end + end + + def test_date_localization_should_use_default_format + assert_equal "2008-07-02", I18n.localize(@date) + end + + def test_date_localization_with_default_format + assert_equal "2008-07-02", I18n.localize(@date, nil, :default) + end + + def test_date_localization_with_short_format + assert_equal "Jul 02", I18n.localize(@date, nil, :short) + end + + def test_date_localization_with_long_format + assert_equal "July 02, 2008", I18n.localize(@date, nil, :long) + end + + def test_time_localization_should_use_default_format + assert_equal "Wed, 02 Jul 2008 16:47:01 +0100", I18n.localize(@time) + end + + def test_time_localization_with_default_format + assert_equal "Wed, 02 Jul 2008 16:47:01 +0100", I18n.localize(@time, nil, :default) + end + + def test_time_localization_with_short_format + assert_equal "02 Jul 16:47", I18n.localize(@time, nil, :short) + end + + def test_time_localization_with_long_format + assert_equal "July 02, 2008 16:47", I18n.localize(@time, nil, :long) + end + + def test_day_names + assert_equal Date::DAYNAMES, I18n.translate(:'date.day_names') + end + + def test_abbr_day_names + assert_equal Date::ABBR_DAYNAMES, I18n.translate(:'date.abbr_day_names') + end + + def test_month_names + assert_equal Date::MONTHNAMES, I18n.translate(:'date.month_names') + end + + def test_abbr_month_names + assert_equal Date::ABBR_MONTHNAMES, I18n.translate(:'date.abbr_month_names') + end + + def test_date_order + assert_equal [:year, :month, :day], I18n.translate(:'date.order') + end + + def test_time_am + assert_equal 'am', I18n.translate(:'time.am') + end + + def test_time_pm + assert_equal 'pm', I18n.translate(:'time.pm') + end +end |