Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added localize helper method

  • Loading branch information...
commit cf5d6ab9a849d19ac683180cc7b603ca94b13ed7 1 parent 2949918
Luca Guidi authored
View
4 actionpack/lib/action_view/helpers/translation_helper.rb
@@ -11,6 +11,10 @@ def translate(*args)
keys = I18n.send :normalize_translation_keys, e.locale, e.key, e.options[:scope]
content_tag('span', keys.join(', '), :class => 'translation_missing')
end
+
+ def localize(*args)
+ I18n.l *args
+ end
end
end
end
View
6 actionpack/test/template/translation_helper_test.rb
@@ -39,4 +39,10 @@ def test_returns_missing_translation_message_wrapped_into_span
# error_messages_for(:object => @object, :locale => 'en-US')
# end
end
+
+ def test_delegates_localize_to_i18n
+ @time = Time.utc(2008, 7, 8, 12, 18, 38)
+ assert_equal "Tue, 08 Jul 2008 12:18:38 +0100", localize(@time)
+ assert_equal "08 Jul 12:18", localize(@time, :format => :short)
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.