Sha256: 996089599125934fcd46684f86137c7dfbfd04e8883cdcd61ff056813cb7df5d

Contents?: true

Size: 749 Bytes

Versions: 6

Compression:

Stored size: 749 Bytes

Contents

# Make the view translation helper use the :rescue_format => :html option instead
# of rescuing exceptions itself.
#
# See https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/5969-bump-i18n-and-make-translationhelper-use-new-rescue_format-option#ticket-5969-8
Gem.patching('rails', '3.0.3') do
  ActionView::Helpers::TranslationHelper.module_eval do
    def translate(key, options = {})
      options.merge!(:rescue_format => :html) unless options.key?(:rescue_format)
      translation = I18n.translate(scope_key_by_partial(key), options)
      if html_safe_translation_key?(key) && translation.respond_to?(:html_safe)
        translation.html_safe
      else
        translation
      end
    end
    alias :t :translate
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
adva-core-0.0.9 lib/patches/rails/translation_helper.rb
adva-core-0.0.8 lib/patches/rails/translation_helper.rb
adva-core-0.0.7 lib/patches/rails/translation_helper.rb
adva-core-0.0.6 lib/patches/rails/translation_helper.rb
adva-core-0.0.5 lib/patches/rails/translation_helper.rb
adva-core-0.0.4 lib/patches/rails/translation_helper.rb