missing_translations_log_handler.rb

Path: lib/i18n/missing_translations_log_handler.rb
Last Update: Sat Feb 23 07:18:37 +0000 2019

A simple exception handler that behaves like the default exception handler but additionally logs missing translations to a given log.

Useful for identifying missing translations during testing.

E.g.

  require 'globalize/i18n/missing_translations_log_handler'
  I18n.missing_translations_logger = RAILS_DEFAULT_LOGGER
  I18n.exception_handler = :missing_translations_log_handler

To set up a different log file:

  logger = Logger.new("#{RAILS_ROOT}/log/missing_translations.log")
  I18n.missing_translations_logger = logger

Required files

logger  

[Validate]