I18n for model-specific Rails submit button

前端 未结 2 520
广开言路
广开言路 2021-01-01 09:33

I\'ve found that Rails allows for generic i18n of submit buttons via the following in config/locales/en.yml:

en:
  helpers:
    submit:
      cr         


        
相关标签:
2条回答
  • 2021-01-01 10:16

    From the source code, it looks like you should be able to do this:

    en:
      helpers:
        submit:
          post:
            create: "Upload %{model}"
    

    where post is the name of your model. The inline docs also mention that you can do this.

    0 讨论(0)
  • 2021-01-01 10:35

    If you use the i18n-debug gem, the rails server will print translations look-up attempts to the console, like:

    [i18n-debug] en.helpers.submit.post.create => nil
    
    0 讨论(0)
提交回复
热议问题