如何更改en.yml中的默认月份?

时间:2012-01-25 20:09:32

标签: ruby-on-rails devise

我已经更改了一些默认错误消息,但我最后需要更改默认月份名称,我试过了:

en:
  hello: "Hello world"
   activerecord:
    errors:
     messages:
      taken: "este mail ya sido utilizado"
        confirmation: "password y confirmacion no coinciden"

    date:
       month_names: "enero"

但不起作用,请帮忙, 提前谢谢。

1 个答案:

答案 0 :(得分:0)

通过我在您的其他问题中发布的link,您可以找到定义英文月份名称的file

month_names是一个数组,而不是字符串,因此您需要指定全部12(并且nil为第一个值。)

您还将date:嵌套到深层。它需要直接嵌套在en:

下面
en:
  date:
    formats:
    # Don't forget the nil at the beginning; there's no such thing as a 0th month
    month_names: [~, January, February, March, April, May, June, July, August, September, October, November, December]