什么是I18n.t的型号选项

时间:2016-02-10 01:52:48

标签: ruby-on-rails

https://github.com/rails/rails/blob/6226f8f0662f66c8189f7e628dc42ca59d8f980a/actionview/lib/action_view/helpers/form_helper.rb#L1932

  

I18n.t(defaults.shift, model: model, default: defaults)

此rails代码使用I18n.t选项调用model。它是什么?

Rails Internationalization (I18n) API — Ruby on Rails Guides不要说模型选项。

1 个答案:

答案 0 :(得分:1)

你可以在这里找到 https://github.com/rails/rails/blob/master/actionview/lib/action_view/locale/en.yml

默认为

 helpers:
    select:
      # Default value for :prompt => true in FormOptionsHelper
      prompt: "Please select"

    # Default translation keys for submit and button FormHelper
    submit:
      create: 'Create %{model}'
      update: 'Update %{model}'
      submit: 'Save %{model}'