2014-11-24 32 views
0

在我的Ruby on Rails应用程序,我创建了简单的pl.yml文件:Formtastic和l18n:'。 '(点符号)分割字符串

pl: 
    contact_email: "My e-mail: [email protected]" 
    send_message: 'Wyślij wiadomość' 
    formtastic: 
    labels: 
     contact: 
     title: 'Tytuł wiadomości' 
     content: 'Treść wiadomości' 

在主动管理页面,我有一个简单的表格,我已经添加标签标签与l18n:

form do |f| 
    f.inputs "Wiadomość" do 
     f.input :title 
     f.input :content 
     f.label I18n.t 'contact_email' 
    end 
    f.actions 
    end 

我的问题是,CONTACT_EMAIL( '我的电子邮箱:[email protected]'):

由点符号( “”)分裂enter image description here

在这个字符串中我应该用什么来代替('。')在电子邮件地址中保留这个'点'?

回答

0

尝试使用

= f.label :custom_email, label: I18n.t 'contact_email'

第一个参数标签的方法,字段名,即通过的I18n automaticaly翻译

+0

感谢帮助,但它不工作。我得到以下错误: '语法错误,意外tSTRING_BEG,期待keyword_end f.label:custom_email,标签:I18n.t'contact_email'^' – nicq 2014-11-24 21:32:12