【发布时间】:2012-10-25 06:27:56
【问题描述】:
我想用 i18n 系统翻译一个 rails 表单。
我的模型属性翻译正确,但是当我想翻译提交动作时,模型名称没有翻译。
这是我的 fr.yml 语言环境文件
fr:
activerecord:
model:
character:
one: "Personnage"
other: "Personnages"
attributes:
character:
name: "Nom"
title: "Titre"
biography: "Biographie"
helpers:
submit:
update: "Mise à jour %{model}"
我的 _form.html.erb 是
<%= form_for(@character) do |f| %>
<% if @character.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@character.errors.count, "error") %> prohibited this character from being saved:</h2>
<ul>
<% @character.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :name %><br />
<%= f.text_field :name %>
</div>
<div class="field">
<%= f.label :title %><br />
<%= f.text_field :title %>
</div>
<div class="field">
<%= f.label :biography %><br />
<%= f.text_area :biography, :rows => 8%>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
在我的表单上,我希望更新按钮是“Mise à jour Personnage”,但我仍然有“Mise à jour Character”。
感谢您的帮助!
【问题讨论】:
标签: ruby-on-rails internationalization translation locale