jcasimir/draper — Issue #109: I18n translate helper with automatic scope
Author: Odaeus
Created: 2012-01-05 01:08:49+00:00
State: open

In my views I almost always use the auto-scoped syntax of I18n.translate:

t(".my_account")

Putting this in a decorator method fails with `Cannot use t(".my_account") shortcut because path is not available`.

Should I scope all my keys explicitly from within Decorators or should Draper support automatic scoping based on the current view?

The latter seems to be slightly tricky to implement as the key is derived from an instance variable, `@virtual_path`, in [the ActionView TranslationHelper](https://github.com/rails/rails/blob/master/actionpack/lib/action_view/helpers/translation_helper.rb#L71) which seems to be set in [the Template](https://github.com/rails/rails/blob/master/actionpack/lib/action_view/template.rb#L123). I'm not sure how the variable is shared between them or how it could be accessed from Draper.