Browse files

add the full missing key as a title attribute to the error message span

  • Loading branch information...
1 parent 197dace commit 4cf8570ff8181bf72c6f33e5cb3ff8a8cc82e5aa @svenfuchs committed Nov 5, 2010
Showing with 4 additions and 4 deletions.
  1. +1 −1 lib/i18n/exceptions.rb
  2. +3 −3 test/i18n_exceptions_test.rb
View
2 lib/i18n/exceptions.rb
@@ -52,7 +52,7 @@ def initialize(locale, key, opts = nil)
def html_message
key = keys.last.to_s.gsub('_', ' ').gsub(/\b('?[a-z])/) { $1.capitalize }
- %(<span class="translation_missing">#{key}</span>)
+ %(<span class="translation_missing" title="translation missing: #{keys.join('.')}">#{key}</span>)
end
def keys
View
6 test/i18n_exceptions_test.rb
@@ -33,12 +33,12 @@ def test_missing_translation_data_message
def test_missing_translation_data_html_message
force_missing_translation_data
rescue I18n::ArgumentError => e
- assert_equal '<span class="translation_missing">Foo</span>', e.html_message
+ assert_equal '<span class="translation_missing" title="translation missing: de.bar.foo">Foo</span>', e.html_message
end
- def test_missing_translation_data_html_message
+ def test_missing_translation_data_rescue_format_html
message = force_missing_translation_data(:rescue_format => :html)
- assert_equal '<span class="translation_missing">Foo</span>', message
+ assert_equal '<span class="translation_missing" title="translation missing: de.bar.foo">Foo</span>', message
end
def test_invalid_pluralization_data_stores_entry_and_count

0 comments on commit 4cf8570

Please sign in to comment.