Hi,
In my project I need to customize the output of translate/t method
when there is no translation found. I''ve follow the rails guide about
I18n API section 6.2 and made a custom exception handler in an
initializer file.
module I18n
def custom_handler(exception, key, locale, options)
case exception
when I18n::MissingTranslationData
I18n.normalize_keys(locale, key,
options[:scope]).join(''.'')
else
raise exception
end
end
end
I18n.exception_handler = :custom_handler
But this has no effect. I think I''ve found the code responsible for
this in actionpack-3.0.0/lib/action_view/helpers/translation_helper.rb
line 27. The option raise is forced to true and the translate methods
keeps the exception for itself with no possibility to replace the
exception handler nor customize the output.
In my opinion rails should not force raise option to true and make a
default exception handler. Thus it would be possible to declare a
custom handler to make whatever we wants in response to exceptions.
But may be I''m missing something...
Thanks in advance.
Titinux.
Thanks in advance.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to
rubyonrails-core+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en.