Sha256: d1bf2064185e72b3549fcf2abc35aefb06b9b78f8cc3616408327baf76c2d704
Contents?: true
Size: 547 Bytes
Versions: 9
Compression:
Stored size: 547 Bytes
Contents
module Refinery module TranslationHelper # 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. def t(key, options = {}) if (val = super) =~ /class.+?translation_missing/ val = val.to_s.gsub(/<span[^>]*>/, 'i18n: ').gsub('</span>', '').gsub(', ', '.') end val end def translated_field(record, field) Refinery::TranslatedFieldPresenter.new(record).call(field) end end end
Version data entries
9 entries across 9 versions & 1 rubygems