2
我想爲我的約會添加'th','nd'後綴。這個問題解決了部分問題:In Ruby on Rails, how do I format a date with the "th" suffix, as in, "Sun Oct 5th"?如何在en.yml上使用「th」後綴格式化日期?
但是我需要將它添加到/config/en.yml中。怎麼做?
我想爲我的約會添加'th','nd'後綴。這個問題解決了部分問題:In Ruby on Rails, how do I format a date with the "th" suffix, as in, "Sun Oct 5th"?如何在en.yml上使用「th」後綴格式化日期?
但是我需要將它添加到/config/en.yml中。怎麼做?
您可以將字符串傳遞到現場
en:
foo: "it is the %{day} of %{month} today"
I18n.t('foo', day: Date.today.day.ordinalize, month: Date::MONTHNAMES[Date.today.month])