I had an idea, just wondering what your thoughts on it are.
Short introduction: ActiveSupport 3 introduces the #presence method,
which returns nil if #present? returns false, otherwise it returns
Can we define a singleton method on the strings that are returned when
the translation is not found?
foo = I18n.t(:foo)
=> “translation missing: en, foo”
So, although it is a string (of some sort), it reacts as if its an
empty string, since there is no translation.
I know this is kinda counter-intuative, but it allows you to write:
I18n.t(:foo).presence || I18n.t(:hello)
Implementation wise, we could define some extra methods on this string
object, or we could make a MissingTranslation class that inherits from
So, what are your opinions on this? Does anyone know of a gem that
already does something like this?