Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Rails 2.3.5错误消息中的模型名称转换问题_Ruby On Rails_Model_Internationalization_Translation - Fatal编程技术网

Ruby on rails Rails 2.3.5错误消息中的模型名称转换问题

Ruby on rails Rails 2.3.5错误消息中的模型名称转换问题,ruby-on-rails,model,internationalization,translation,Ruby On Rails,Model,Internationalization,Translation,我在Rails 2.3.5应用程序中翻译模型名称和属性时遇到了一些问题 我有以下型号: class BillingPlan < ActiveRecord::Base validates_presence_of :billing_option_id belongs_to :order belongs_to :user belongs_to :billing_option end 我的翻译文件的基础是: 有人能帮忙吗 提前Thx J.尝试检查active record型号

我在Rails 2.3.5应用程序中翻译模型名称和属性时遇到了一些问题

我有以下型号:

class BillingPlan < ActiveRecord::Base

  validates_presence_of :billing_option_id

  belongs_to :order
  belongs_to :user
  belongs_to :billing_option
end
我的翻译文件的基础是:

有人能帮忙吗

提前Thx
J.

尝试检查active record型号的翻译,请参阅i18n文档中关于Rails指南的5.1.3部分()

默认情况下,rails使用此选项,您应该为de i18n创建一个:

en:
  activerecord:
    errors:
      template:
        header:
          one:   "1 error prohibited this {{model}} from being saved"
          other: "{{count}} errors prohibited this {{model}} from being saved"
        body:    "There were problems with the following fields:"

你怎么称呼错误<代码>错误消息?在这里它变得更加混乱。我的大多数表单都使用formtastic,但也必须使用标准表单。如果我像那样使用formtastic:。。。一切都翻译得很好。如果是标准表格:。。。我仍然有一个问题,模型名没有翻译。哦,我看到这些翻译已经在中实现了,也许我的awnser没有太大帮助,毕竟似乎是一个更困难的问题。反正是Thx。
en:
  activerecord:
    errors:
      template:
        header:
          one:   "1 error prohibited this {{model}} from being saved"
          other: "{{count}} errors prohibited this {{model}} from being saved"
        body:    "There were problems with the following fields:"