Sha256: 5fc02a361c40760f8f18544560935c88a03e172c4b23fdaf9ee21a68914a7791

Contents?: true

Size: 477 Bytes

Versions: 41

Compression:

Stored size: 477 Bytes

Contents

module Refinery
  module Helpers
    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

    end
  end
end

Version data entries

41 entries across 41 versions & 2 rubygems

Version Path
refinerycms-0.9.8.1 vendor/refinerycms/core/lib/refinery/helpers/translation_helper.rb