Smart localisation

Hi,

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:

Oh an to be complete about the first thing: I know I can get the controller/action translations by doing t('controller.action.translation'), but I'd like to integrate my localisation more into my application. Of course I could write a method to extend t(), but I've done stuff like that before only to find out Rails already has functionality for it. I just don't know where it is.

If I should believe the things I find on the internet, this is the correct approach for form labels:

Hi,

If I should believe the things I find on the internet, this is the correct approach for form labels: --- en: activerecord:    attributes:      user:        last_name: Surname --- And then:

<% form_for @user do |f| %> <%= f.label :last_name %> <%= f.text_field :last_name %> <% end %>

However, this results in a form label "Last name" instead of "Surname". What am I doing wrong? I'm on Rails 2.3.5.

For the moment I think this is the normal behavior but it will be available with Rails3:

For the moment, what I do is :

<% form_for @user do |f| %> <%= f.label t('activerecord.attributes.user.last_name') %> <%= f.text_field :last_name %> <% end %>

Not so clean but it works...

@+ @lex

For the label problem I have been using the I18n-label plugin in the past: http://github.com/iain/i18n_label This functionality may be integrated into the latest version of I18n, I dont know.

Hmmm, thank you both. A fix for the labels appears to be in the latest version of the Rails 2-3-stable branch. Is there any way to integrate that version of Rails into my application? Please mind that I won't have access to the Rails installation on the target server, so I need to overwrite the Rails library locally somehow.