hey,
i tried that plugin, you mentioned before.
when i run script/console and Model.human_attribute_name i get the
translated attribute name, i configured in one of my yml files.
but in my form
>>>>>>>>>>>>>>>>
<% form_for(:mail_contact, :url => contact_path) do |f| %>
<div class="question_form_info">
<p>
<%= label_tag 'mail_contact_name', t(:"
info.name") + ":" %>
<%= f.text_field(:name, { :size => 25}) %>
</p>
<p>
<%= f.label :email %>
<%= f.text_field(:email, { :size => 15}) %>
</p>
<p>
<%= label_tag 'mail_contact_name', t(:"info.subject") + ":" %>
<%= f.text_field(:subject, { :size => 15}) %>
</p>
<p>
<%= label_tag 'mail_contact_comment', t(:"info.your_request") +
":" %>
<%= f.text_area(:comment, { :size => 15}) %>
</p>
</div>
<div class="question_form_submit">
<%= submit_tag t(:"common.send") %>
</div>
<% end %>
<<<<<<<<<<<<<<<<
my contact_form_presenter.rb
class ContactFormPresenter
include Validatable
acts_as_translatable_model
ATTRIBUTES = %w(name email subject comment)
ATTRIBUTES.each { |name| attr_accessor name }
ATTRIBUTES.each { |name| validates_presence_of name }
validates_format_of :email, :with => RegexCollection::EMAIL_REGEX
def initialize(attributes = nil)
ATTRIBUTES.each { |name| self.send("#{name}=",
attributes[name.to_sym]) } if attributes.is_a?(Hash)
end
end
<<<<<<<<<<<<<<
my yml:
de:
activerecord:
attributes:
contact_form_presenter:
name: "Name_de"
subject: "Subject_de"
email: "Email_de"
comment: "Comment_de"
en:
activerecord:
attributes:
contact_form_presenter:
name: "Name_en"
subject: "Subject_en"
email: "Email_en"
comment: "Comment_en"
<<<<<<<<<<<<<<
script/console:
>> I18n.locale
=> :"en-US"
>> ContactFormPresenter.human_attribute_name("subject")
=> "Subject_en"
>> I18n.locale=:"de-DE"
=> :"de-DE"
>> ContactFormPresenter.human_attribute_name("subject")
=> "Subject_de"
<<<<<<<<<<<<<<
i have set @mail_contact = ContactFormPresenter.new in my controller
but the email label is not translated,
and when i display the error_messages_for :mail_contact
but the attributes are not translated.
did i do something wrong?
thx, florian