2013-02-05 45 views
0

如何翻译使用的I18n选项选择如何使用的I18n选项中选择翻译[Rails的3]

同事,请告诉我,我该怎么办

<%= date_select :user, :birthday, 
    {:start_year => Time.now.year, 
    :end_year => 1900, 
    :use_short_month => false, 
    :order => [:day, :month, :year], 
    :prompt => {:month => 'Month', :day => 'Day', :year => 'Year'}}, 
    {:class => 'userBirthday', 
    :id => 'userBirthday'} 
%> 

<%= select :user, :gender, ([["Male", "male"], ["Female", "female"]]), :class => 'bigselect' %> 
+1

't(“Male”)'不起作用? – Kaeros

回答

0

我忘了添加在本地文件中:

es: 
    date: 
    abbr_day_names: 
    - dom 
    - lun 
    - mar 
    - mié 
    - jue 
    - vie 
    - sáb 
    abbr_month_names: 
    - 
    - ene 
    - feb 
    - mar 
    - abr 
    - may 
    - jun 
    - jul 
    - ago 
    - sep 
    - oct 
    - nov 
    - dic 
    day_names: 
    - domingo 
    - lunes 
    - martes 
    - miércoles 
    - jueves 
    - viernes 
    - sábado 
    formats: 
     default: ! '%d/%m/%Y' 
     long: ! '%d de %B de %Y' 
     short: ! '%d de %b' 
    month_names: 
    - 
    - enero 
    - febrero 
    - marzo 
    - abril 
    - mayo 
    - junio 
    - julio 
    - agosto 
    - septiembre 
    - octubre 
    - noviembre 
    - diciembre 
    order: 
    - :day 
    - :month 
    - :year 
....... 
... 
.. 

全部在此链接中:https://github.com/svenfuchs/rails-i18n/blob/master/rails/locale/es.yml

并且正确选择的选项是:<%= select:user,:gender,([[t(“Male”),“male”],[t(“Female” ),“female”]]),:class =>'bigselect'%>谢谢提醒我@Kaeros