The search method may be wrong, but I couldn't find the fixed phrase of the Japanese translation of devise's automatic email. So, I'm going to write an article about the fixed phrases used in my portfolio. I hope you find it helpful.
--Use environment variables (Gem of dotenv-rails) for the URL and inquiry email address to be described in the signature. --The subject of the email shall be translated into Japanese using the Gem of "devise-i18n" and "devise-i18n-views". ――The translated text is not a literal translation, but a text that is commonly used in Japan. I tried not to make any mistakes or deficiencies, but if you are kind, please feel free to point out any mistakes or deficiencies. ――Since I learned later that I18n support, this article does not support I18n in the text. Only the translated text is written directly in the template file. If you want to support multiple languages, please refer to the following.
https://qiita.com/tiktak/items/a70ef7940fa4710f37cb
The following 5 files are preset in devise.
--Membership registration confirmation email: ( `confirmation_instructions.html.erb```) --Change notification email to the original email address: (```email_changed.html.erb```) --Password change completion email: (
password_change.html.erb```) --Email address change confirmation email: (``
reset_password_instructions.html.erb) --Account lock notification email: (
unlock_instructions.html.erb```)
This translation is shown below.
erb:app/views/devise/mailer/confirmation_instructions.html.erb
<p>* This email is an automatically sent email.</p>
<p><%= @email %>Mr</p>
<p>「<%= ENV['APP_NAME'] %>This is the secretariat.</p>
<p>This time"<%= ENV['APP_NAME'] %>Thank you for registering.</p>
<p>Please check your account email from the link below.</p>
<p><%= link_to 'Click here to check your account email', confirmation_url(@resource, confirmation_token: @token) %></p>
<p>* This email will not be delivered even if you reply. For inquiries, please start the app and click "Inquiries".</p>
<p>
Those who received this email even though they don't remember<br>
We apologize for the inconvenience. We apologize for the inconvenience, but please contact us at the email address below.<br>
</p>
<p><%= ENV['MAIL_BCC'] %></p>
<p>――――――――――――――――――――――――――――――</p>
<%= ENV['APP_NAME'] %><br>
URL : <%= ENV['WEB_PROTOCOL'] %>://<%= ENV['WEB_HOST'] %><br>
Mail : <%= ENV['MAIL_BCC'] %><br>
<p>――――――――――――――――――――――――――――――</p>
erb:app/views/devise/mailer/email_changed.html.erb
<p>* This email is an automatically sent email.</p>
<p><%= @email %>Mr</p>
<p>「<%= ENV['APP_NAME'] %>This is the secretariat.</p>
<% if @resource.try(:unconfirmed_email?) %>
<p>The registered email address is<%= @resource.unconfirmed_email %>We will inform you that it has been changed to.</p>
<% else %>
<p>The registered email address is<%= @resource.email %>We will inform you that it has been changed to.</p>
<% end %>
<p>
Those who received this email even though they don't remember<br>
We apologize for the inconvenience. We apologize for the inconvenience, but please contact us at the email address below.<br>
</p>
<p><%= ENV['MAIL_BCC'] %></p>
<p>――――――――――――――――――――――――――――――</p>
<%= ENV['APP_NAME'] %><br>
URL : <%= ENV['WEB_PROTOCOL'] %>://<%= ENV['WEB_HOST'] %><br>
Mail : <%= ENV['MAIL_BCC'] %><br>
<p>――――――――――――――――――――――――――――――</p>
erb:app/views/devise/mailer/password_change.html.erb
<p>* This email is an automatically sent email.</p>
<p><%= @resource.email %>Mr</p>
<p>「<%= ENV['APP_NAME'] %>This is the secretariat.</p>
<p>We will inform you that your password has been changed.</p>
<p>We look forward to working with you in the future.</p>
<p>
Those who received this email even though they don't remember<br>
We apologize for the inconvenience. We apologize for the inconvenience, but please contact us at the email address below.<br>
</p>
<p><%= ENV['MAIL_BCC'] %></p>
<p>――――――――――――――――――――――――――――――</p>
<%= ENV['APP_NAME'] %><br>
URL : <%= ENV['WEB_PROTOCOL'] %>://<%= ENV['WEB_HOST'] %><br>
Mail : <%= ENV['MAIL_BCC'] %><br>
<p>――――――――――――――――――――――――――――――</p>
erb:app/views/devise/mailer/reset_password_instructions.html.erb
<p>* This email is an automatically sent email.</p>
<p><%= @resource.email %>Mr</p>
<p>「<%= ENV['APP_NAME'] %>This is the secretariat.</p>
<p>We will inform you that your password has been changed.</p>
<p>We look forward to working with you in the future.</p>
<p>
Those who received this email even though they don't remember<br>
We apologize for the inconvenience. We apologize for the inconvenience, but please contact us at the email address below.<br>
</p>
<p><%= ENV['MAIL_BCC'] %></p>
<p>――――――――――――――――――――――――――――――</p>
<%= ENV['APP_NAME'] %><br>
URL : <%= ENV['WEB_PROTOCOL'] %>://<%= ENV['WEB_HOST'] %><br>
Mail : <%= ENV['MAIL_BCC'] %><br>
<p>――――――――――――――――――――――――――――――</p>
erb:app/views/devise/mailer/unlock_instructions.html.erb
<p>* This email is an automatically sent email.</p>
<p><%= @resource.email %>Mr</p>
<p>「<%= ENV['APP_NAME'] %>This is the secretariat.</p>
<p>The number of failed sign-ins has reached the limit and your account has been locked.</p>
<p>Click the link below to unlock your account.</p>
<p><%= link_to 'Unlock your account', unlock_url(@resource, unlock_token: @token) %></p>
<p>
Those who received this email even though they don't remember<br>
We apologize for the inconvenience. We apologize for the inconvenience, but please contact us at the email address below.<br>
</p>
<p><%= ENV['MAIL_BCC'] %></p>
<p>――――――――――――――――――――――――――――――</p>
<%= ENV['APP_NAME'] %><br>
URL : <%= ENV['WEB_PROTOCOL'] %>://<%= ENV['WEB_HOST'] %><br>
Mail : <%= ENV['MAIL_BCC'] %><br>
<p>――――――――――――――――――――――――――――――</p>
The automatic e-mail sent for each page and the verification method are described below.
--Membership registration page --Member registration confirmation email --User information edit page --Password change completion email --Email address change confirmation email --Change notification email to the original email address --Login page --Account lock notification email
Change your password and send a "password change completion email"
Change your e-mail address and send a "e-mail address change confirmation e-mail"
Send a "email address change confirmation email" when the account email address has been changed in the "email address change confirmation email"
config/initializers/devise.rb
#・ ・ ・ Omitted
# Send a notification to the original email when the user's email is changed.
config.send_email_changed_notification = true # <=If set to true, "email address change confirmation email" will be sent to the original email.
#・ ・ ・ Omitted
config/initializers/devise.rb
#・ ・ ・ Omitted
# Number of authentication tries before locking an account if lock_strategy
# is failed attempts.
config.maximum_attempts = 20 #<=Means account lock after 20 failures
#・ ・ ・ Omitted
config/initializers/devise.rb
#・ ・ ・ Omitted
# Defines which strategy will be used to unlock an account.
# :email = Sends an unlock link to the user email
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
# :both = Enables both strategies
# :none = No unlock strategy. You should handle unlocking by yourself.
config.unlock_strategy = :email # <= 「:If you select "email", you can recover your account with "account lock notification email".
#・ ・ ・ Omitted
――I thought it would be even better if I18n was supported. I will try next time.
It was an opportunity to know when the Devise email was sent.
Devise.rb configuration file item summary
Recommended Posts