From c1dbb13eacf0e579f351a46c9ee2ec845ae0cc2d Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Tue, 1 Dec 2015 19:19:44 +0330 Subject: debug_missing_translation configuration added to action_view `I18n.translate` helper will wrap the missing translation keys in a tag only if `debug_missing_translation` configuration has a truthy value. Default value is `true`. For example in `application.rb`: # in order to turn off missing key wrapping config.action_view.debug_missing_translation = false --- actionview/test/template/translation_helper_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'actionview/test') diff --git a/actionview/test/template/translation_helper_test.rb b/actionview/test/template/translation_helper_test.rb index 631bceadd8..597936d7ae 100644 --- a/actionview/test/template/translation_helper_test.rb +++ b/actionview/test/template/translation_helper_test.rb @@ -54,6 +54,16 @@ class TranslationHelperTest < ActiveSupport::TestCase end end + def test_returns_missing_tranlation_message_without_span_wrap + old_value = ActionView::Base.debug_missing_translation + ActionView::Base.debug_missing_translation = false + + expected = 'translation missing: en.translations.missing' + assert_equal expected, translate(:"translations.missing") + ensure + ActionView::Base.debug_missing_translation = old_value + end + def test_returns_missing_translation_message_wrapped_into_span expected = 'Missing' assert_equal expected, translate(:"translations.missing") -- cgit v1.2.3