Module: Refinery::Helpers::TranslationHelper

Defined in:
lib/refinery/helpers/translation_helper.rb

Instance Method Summary collapse

Instance Method Details

#t(key, options = {}) ⇒ Object

Overrides Rails’ core I18n.t() function to produce a more helpful error message. The default one wreaks havoc with CSS and makes it hard to understand the problem.



7
8
9
10
11
12
13
# File 'lib/refinery/helpers/translation_helper.rb', line 7

def t(key, options = {})
  if (val = super) =~ /class.+?translation_missing/
    val = val.to_s.gsub(/<span[^>]*>/, 'i18n: ').gsub('</span>', '').gsub(', ', '.')
  end

  val
end