I have some trouble using Il8n. I’ve had these problems for a while
now and always used rough workarounds, but as my productivity needs to
go up another notch, I was wondering whether there was any way of
avoiding these workarounds.
For example: When I’m inside a view (say ‘home/index’) and use
t(‘title’), I’d like Rails to know I’m looking for the last line in
this en.yml file:
I’ve achieved this by using a plugin, but the plugin doesn’t always do
the trick (for example, it can’t be used in a layout file). Is my
piece of YAML above correct? And should it work?
Also, I’d like to be able to set a default title that can be
overridden by defining it in a controller action translation. So there
should also be a “base” title variable.
Furthermore, I’d also like Rails to know that, when I do this:
<% form_for @user do |f| %>
<%= f.label :name %>
<%= f.text_field :name %>
<%- end -%>
It should look for the following translation to use as the label
name: “Full Name”
Why isn’t it doing this? Isn’t that what Il8n was meant to do?
I’m probably making mistakes, so feel free to point out to me where
I’m making them.
Thank you in advance!