My co-workers and I are often tripped up by the slight differences between [ActionView::TranslationHelper#translate][1] and [AbstractController::Translation#translate][2]. Many people assume these are the same method, but they are not. There are some differences that likely make sense -- It's not safe to assume that I want missing translations decorated with HTML in a controller -- but other differences that are surprising and confusing:
1. The controller helper will not automatically mark `.html` or `_html` suffixed keys as HTML safe, but the view helper will.
2. The controller helper is not impacted by ActionView::Base.raise_on_missing_translations
Additionally, there's some duplication in the helpers to handle automatic prefixing of keys that start with a `.`.
I'd like to explore extracting a centralized rails translation helper, i18n-rails, that both ActionPack and ActionView can depend on. Their respective translation helpers would become thin wrappers around i18n-rails, itself a wrapper around i18n. Assuming I do the necessary legwork here, is this something worth exploring? Anyone have any potential landmines they'd like to point out?
[1]:
https://github.com/rails/rails/blob/master/actionview/lib/action_view/helpers/translation_helper.rb[2]:
https://github.com/rails/rails/blob/master/actionpack/lib/abstract_controller/translation.rbThanks,
Derek