diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-06-04 14:18:44 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-06-04 14:18:44 -0300 |
commit | fb5331f274077281854b55131deb69dd4cc9f9aa (patch) | |
tree | f920d7891294a87e5f3968f49484bbfea357ec56 /guides/source/i18n.md | |
parent | 361b68fa1974237e392de184bc4486d52b383372 (diff) | |
parent | d5e691a36eee3a22a2418483e006b37056e24e43 (diff) | |
download | rails-fb5331f274077281854b55131deb69dd4cc9f9aa.tar.gz rails-fb5331f274077281854b55131deb69dd4cc9f9aa.tar.bz2 rails-fb5331f274077281854b55131deb69dd4cc9f9aa.zip |
Merge pull request #15495 from maurogeorge/action-mailer-subject-guides
Add default_i18n_subject to the guides
Diffstat (limited to 'guides/source/i18n.md')
-rw-r--r-- | guides/source/i18n.md | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/guides/source/i18n.md b/guides/source/i18n.md index 0eba3af6e8..8340d6807f 100644 --- a/guides/source/i18n.md +++ b/guides/source/i18n.md @@ -860,6 +860,24 @@ en: subject: "Welcome to Rails Guides!" ``` +To send parameters to interpolation use the `default_i18n_subject` method on the mailer. + +```ruby +# user_mailer.rb +class UserMailer < ActionMailer::Base + def welcome(user) + mail(to: user.email, subject: default_i18n_subject(user: user.name)) + end +end +``` + +```yaml +en: + user_mailer: + welcome: + subject: "%{user}, welcome to Rails Guides!" +``` + ### Overview of Other Built-In Methods that Provide I18n Support Rails uses fixed strings and other localizations, such as format strings and other format information in a couple of helpers. Here's a brief overview. |