且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Rails3:设计国际化不会本地化“密码确认";和别的

更新时间:2023-09-28 20:54:10

Actually, they come from your default language yml file. Devise locale file just have locales for alert messages and some notices. They do not provide attribute translation for form attributes.

You probably want to visit

https://github.com/svenfuchs/rails-i18n/tree/f8606e62def45279f3498549f97699049135bd11/rails/locale

and download the adequate (Japanese in your case) language file and put it in ./config/locales/ folder

Then in your rails application configuration file (./config/application.rb) change locale setting to use the Japanese locale file.

config.i18n.default_locale = :ja

After changing the setting, if you want any attribute to have Japanese name, add the rules like shown below.

activerecord:
    attributes:
        user:
            email: "Email address in Japanese"
            password: "Password in Japanese"
            password_confirmation: "Password confirmation in Japanese"