简体   繁体   中英

split I18n into sperate files

one of the requirement is to split I18n. I have been looking into the link below in section organization of local files

http://guides.rubyonrails.org/i18n.html

If I look at the config/locales/en-US.yml in my project I dont see anything for model, view or controller. I see the data about the items of the webpage. en-US.yml looks like this

en-US:
Healthe:
 Points:
   my_points: "Point %{unit}"
   status: "Points achieved"

Am I looking at wrong file? How do i split i18n for model, views and controller that has translation?

In this file will be all the translations of the language by default (en) . If you need to change the messages then you must first implement an .yml file that the community already has prepared in this direction Locales . Then you have to download the file you need (en-US.yml) and put it in the address config/locales/en-US.yml and add or edit the messages you want. Then you have to edit the configuration of your application and put the one you want (es-ES), for this you have to create a file in config/initializers/language.rb and inside

Rails.application.config.i18n.default_locale = 'es-US'

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