Reputation: 6645
If I just do
= t('.foo')
in a view file and I have no this translate in locale, it just capitalize the key and the result will be Foo
But why it's not happens in other places such as input attributes? This example show translate missing error:
= f.submit t('.foo')
Upvotes: 0
Views: 463
Reputation: 116
t is a view helper (see doc here : http://api.rubyonrails.org/classes/ActionView/Helpers/TranslationHelper.html#method-i-translate)
If the key exists, it will just output the translated string, but the value returned for a missing translation key will be <span class=“translation_missing” title=“translation missing: .foo”> Foo </span>
.
In the = t('.foo')
case, you don't see anything special, because the span is inline with your text, and you don't have any dedicated formatting (but have a look, the span will be there in case of missing translation). But in the = f.submit t('.foo')
case, this becomes the text on the button, so you notice it.
Upvotes: 1