开发者

i18n and Date::ABBR_DAYNAMES

hi i want translate the names in Date::ABBR_DAYNAMES in ita and so i've put in locales/it.yml this:

 date:
formats:
  default: "%d-%m-%Y"
  short: "%d %b"
  long: "%d %B %Y"

day_names: [Domenica, Lunedì, Martedì, Mercoledì, Giovedì, Venerdì, Sabato]
abbr_day_names: [Dom, Lun, Mar, Mer, Gio, Ven, Sab]

in my view i try to translate a day开发者_运维百科 but doesn't work:

<%=t Date::ABBR_DAYNAMES %> 

How can i do?

Thanks


I do not know if the formatting is corrupted due to pasting it to your question or not, but the spacing/level in front of the lines is important and broken in your question.
Also, at the top your locale is required (and missing in your example).

it:
  date:
    formats:
      default: "%d-%m-%Y"
      short: "%d %b"
      long: "%d %B %Y"

    # Note that the spaces are reduced again
    day_names: [Domenica, Lunedì, Martedì, Mercoledì, Giovedì, Venerdì, Sabato]
    abbr_day_names: [Dom, Lun, Mar, Mer, Gio, Ven, Sab]

For more information about I18n and Date/Time formatting, see this article (Edit: from archive, as the original is not available anymore). The en.yml shows all available fields you could translate into Italian.

On script/console you can try the Italian locale:

>> I18n.t 'date.abbr_day_names'
=> ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
>> I18n.locale = "it"
>> I18n.t 'date.abbr_day_names'
=> ["Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜