t(".key") convenience pollutes global i18n namespace

Considering the Rails guides give an example structure of nesting view translations under “views”, it feels like using the period convenience with the t() helper should by default look to the “views” i18n namespace, or at least provide an ActionView setting for a view namespace. This would bring the behavior of views more in line with that of models and keep from polluting the global i18n namespace with view-specific translations.

Maybe I’m totally off-base—does anyone have opinions on this?

Hi Joshua, I agree with you. I always felt it was some kind of pollution too. It would be nice if t() helper used with period was using a namespace.

Nicolas, for a PR, do you feel like we should:

  1. accept a backwards-incompatible change and begin nesting under “views:”

  2. create a sort of lookup hierarchy like in ActiveRecord model translations that first looks in “views:” then the current path

  3. keep the same default but introduce an ActionView setting for a namespace that folks can opt in to

I think it’s fine adding a default namespace for such lookups, it should be preferred over the non-namespaced version (eg in docs and everywhere), but I don’t think we need to actually break existing functionality.

We could just add this and leave the existing one in place as a fallback, or deprecate it. I’m still not sure deprecating is the best solution right now, so I’d like to hear other thoughts about it, but I’m ok on adding the namespace.