1
我有點困惑,我該如何指定什麼日期時間格式(或在這種情況下,特別是日期格式)應該用來翻譯本地化的字符串內的日期。Rails I18n:日期時間格式裏面翻譯的字符串
到目前爲止,我有這樣的:
# config/locales/en.yml
en:
date:
formats:
month: '%B %Y'
texts:
only_showing_between: "Only showing events between %{from} and %{to}."
# app/views/mymodel/index.html.erb
<%= content_tag :p, t('texts.only_showing_between', :format => :month, :from => @listing[:from], :to => @listing[:to]), :class => 'text-muted' %>
但它似乎並沒有應用自定義格式。任何有用的三分球,將不勝感激:)