Sha256: fdfed85e14ece41ec4cc481f495461a628b4a230958ca91e4c155fef22ca3832

Contents?: true

Size: 753 Bytes

Versions: 11

Compression:

Stored size: 753 Bytes

Contents

# A simple exception handler that behaves like the default exception handler
# but also raises on missing translations.
#
# Useful for identifying missing translations during testing.
# 
# E.g. 
#
#   require 'globalize/i18n/missing_translations_raise_handler
#   I18n.exception_handler = :missing_translations_raise_handler
module I18n
  class << self
    def missing_translations_raise_handler(exception, locale, key, options)
      raise exception
    end
  end
  
#  self.exception_handler = :missing_translations_raise_handler
end

I18n.exception_handler = :missing_translations_raise_handler

ActionView::Helpers::TranslationHelper.module_eval do
  def translate(key, options = {})
    I18n.translate(key, options)
  end
  alias :t :translate
end

Version data entries

11 entries across 11 versions & 4 rubygems

Version Path
kriss-gettext_i18n-0.2.0 vendor/globalize2/lib/globalize/i18n/missing_translations_raise_handler.rb
kriss-gettext_i18n-0.2.1 vendor/globalize2/lib/globalize/i18n/missing_translations_raise_handler.rb
kriss-gettext_i18n-0.2.2 vendor/globalize2/lib/globalize/i18n/missing_translations_raise_handler.rb
kriss-gettext_i18n-0.2.3 vendor/globalize2/lib/globalize/i18n/missing_translations_raise_handler.rb
simonmenke-globalize2-0.0.1 lib/globalize/i18n/missing_translations_raise_handler.rb
simonmenke-globalize2-0.0.4 lib/globalize/i18n/missing_translations_raise_handler.rb
simonmenke-globalize2-0.0.5 lib/globalize/i18n/missing_translations_raise_handler.rb
simonmenke-globalize2-0.0.6 lib/globalize/i18n/missing_translations_raise_handler.rb
simonmenke-simonmenke-globalize2-0.0.2 lib/globalize/i18n/missing_translations_raise_handler.rb
simonmenke-globalize2-0.0.7 lib/globalize/i18n/missing_translations_raise_handler.rb
globalize2-0.1.0 lib/globalize/i18n/missing_translations_raise_handler.rb