0
我想通过使用翻译在select_month助手下拉列表中使用自定义月份缩写。Rails形式select_month助手自定义翻译几个月
我的形式如下所示:
<div class="col-xs-4 col-sm-4 pad-bottom">
<div class="pull-right pad-top">
<%= select_month(Date.today, :field_name => 'cc_exp_month', :add_month_numbers => true, :use_month_names => t('date.abbr_month_names')) %>
<%= select_year(Date.today, :field_name => 'cc_exp_year', :start_year => Date.today.year, :end_year => 8.years.from_now.year) %>
</div>
</div>
我有一个en.yml
文件包含以下翻译:
date:
abbr_month_names: [~, M1, M2, M3, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec]
我曾尝试使用以下,他们似乎并没有帮助无论是。
:use_month_names => %w(t('date.abbr_month_names'))
:use_month_names => %w(I18n.t('date.abbr_month_names'))
有没有人知道如何做到这一点偶然?
什么是你的代码正在做什么和期望的行为之间的增量? –
@ruby_newbie我真的确定我的问题是什么。它使用该密钥的默认en.yml值,所以我只是在自定义en.yml中创建了一个不同的密钥。 –