2013-05-15 73 views
0

我必须本地化一个网站,一切都快完成了,除了我遇到了两个问题。下面的代码是用于一个小输入表单,但字符串在哪里?有一个文本字段和一个按钮的标签。 其次,我收到了一个错误:红宝石本地化

"undefined method `-' for "translation missing: lv.date.order":String". 

我在哪里必须创建翻译?在.yml文件中?如果是这样,怎么样? 在此先感谢!

<%= form_for([:admin, @publisher]) do |f| %> 
    <% if @publisher.errors.any? %> 
    <div id="error_explanation"> 
     <h2><%= pluralize(@publisher.errors.count, t(:error)) %> <%=t(:prohibited_saved)%></h2> 

     <ul> 
     <% @publisher.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="actions"> 
    <%= f.submit %> 
    </div> 
<% end %> 

回答

1

此错误表示Rails在当前语言环境文件中找不到date.order的翻译。

你应该有一个lv.yml文件中config/locales与此内容:

lv: 
    date: 
    order: 
    - :day 
    - :month 
    - :year 

它会指示轨显示的格式日期:day/month/year