简体   繁体   中英

I18n of submit in Ruby on Rails

I have trying to add internationalization to my Rails app. I've read rails guides and all parts of app was internationalized successfully except Submit button. Actually I've translated it partially. Looked at source code of submit method, I've read commentary before declaration of the method. There is part from that commentary:

 en:
   helpers:
     submit:
       create: "Create a %{model}"
       update: "Confirm changes to %{model}"

I've used that example in my config/locales/??.yml files. And have a trouble to translate %{model} . Name of my Model always in english.

How can I translate it?

You can translate specific model names like this, eg for es.yml :

es:
  activerecord:
    models:
      my_model_name: new_model_name

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM