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中創建了一個不同的密鑰。 –