[Japanese localization of gem: devise]

gem: devise Japanese localization flow

(Flow after installing devise)

  1. Install gem ・ Gem'devise-i18n' ・ Gem'devise-i18n-views'

  2. Generate a Japanese translation file with the command

  3. Edit devise.views.ja.yml

1. Install gem

gem 'devise-i18n'
gem 'devise-i18n-views'

Write in gemfile and do “$ bundle install”

2. Generate a Japanese translation file with the command

$ rails g devise:views:locale ja

When the command is executed, the Japanese translation file config / localesdevise.views.ja.yml Is generated.

3. Edit devise.views.ja.yml

Edit the generated config / localesdevise.views.ja.yml.

ruby:config/localesdevise.views.ja.yml


ja:
  activerecord:
    errors:
      models:
        user:
          attributes:
            email:
              taken: "Is already in use."
              blank: "Is not entered."
              too_short: "Is%{count}Please set more than characters."
              too_long: "Is%{count}Please set it below the character."
              invalid: "Is not valid."
            password:
              taken: "Is already in use."
              blank: "Is not entered."
              too_short: "Is%{count}Please set more than characters."
              too_long: "Is%{count}Please set it below the character."
              invalid: "Is not valid."
              confirmation: "Does not match the content."
    attributes:
      user:
        current_password: "Current password"
        name:name
        email: "mail address"
        password: "password"
        password_confirmation: "Confirmation password"
        remember_me: "login automatically from now on"
    models:
      user: "User"
  devise:
    confirmations:
      new:
        resend_confirmation_instructions: "Resend account confirmation email"
    mailer:
      confirmation_instructions:
        action: "Account confirmation"
        greeting: "Welcome,%{recipient}Mr.!"
        instruction: "The following link will complete the confirmation of your email address:"
      reset_password_instructions:
        action: "Change Password"
        greeting: "Hello,%{recipient}Mr.!"
        instruction: "Someone wants to reset my password. You can reset your password at the following link."
        instruction_2: "Ignore this email if you didn't want it."
        instruction_3: "Your password will not change until you access the link above and set a new password."
      unlock_instructions:
        action: "Account unlock"
        greeting: "Hello,%{recipient}Mr.!"
        instruction: "Click the link below to unlock your account."
        message: "Your account is locked due to repeated login failures."
    passwords:
      edit:
        change_my_password: "change the password"
        change_your_password: "Change password"
        confirm_new_password: "New password for confirmation"
        new_password: "new password"
      new:
        forgot_your_password: "Did you forget your password??"
        send_me_reset_password_instructions: "Send how to reset your password"
    registrations:
      edit:
        are_you_sure: "Is it really good?"
        cancel_my_account: "Account deletion"
        currently_waiting_confirmation_for_email: "%{email}Waiting for confirmation"
        leave_blank_if_you_don_t_want_to_change_it: "If left blank, do not change"
        title: "%{resource}Edit"
        unhappy: "I don't like it"
        update: "update"
        we_need_your_current_password_to_confirm_your_changes: "Please enter your current password for the changes to take effect"
      new:
        sign_up: "account registration"
    sessions:
      new:
        sign_in: "Login"
    shared:
      links:
        back: "Return"
        didn_t_receive_confirmation_instructions: "Did you receive an account confirmation email??"
        didn_t_receive_unlock_instructions: "Have you received an email on how to unfreeze your account??"
        forgot_your_password: "Did you forget your password??"
        sign_in: "Login"
        sign_in_with_provider: "%{provider}Login with"
        sign_up: "account registration"
    unlocks:
      new:
        resend_unlock_instructions: "Resend account unfreeze method"

I think you can translate it into Japanese!

in conclusion

I wrote it like a memo! Please refer to it if you like.

reference https://remonote.jp/rails-devise-i18n-locale-ja

Recommended Posts

[Japanese localization of gem: devise]
Japanese localization of Ubuntu20.04
Japanese localization of Eclipse
Japanese localization of error messages
Japanese localization of error messages
[Rails] Japanese localization of error messages
Japanese localization of error messages (rails)
Japanese localization of CentOS 8 and Japanese keyboard layout
[Rails] Japanese localization of validation error message ~ ja.yml ~
Introduction of Rspec and Japanese localization of error messages
[Rails] Introduction of devise Basics
Cleansing processing of Japanese sentences
What is Rails gem devise?
[Rails] gem devise installation flow
[Rails] Japanese localization using rails-i18n
Japanese localization of Docker container of CentOS7 / CentOS8 and Japan time setting
[Rails] Japanese localization of error message when using Form object
[Rails] How to use gem "devise"
Summary of devise controller initial state
[Rails] Validation settings and Japanese localization
devise gem Awareness Note: Redirect specs