Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subject translations #87

Closed
keilmillerjr opened this issue Jan 4, 2014 · 3 comments
Closed

subject translations #87

keilmillerjr opened this issue Jan 4, 2014 · 3 comments

Comments

@keilmillerjr
Copy link

Any reason why this wouldn't work? Am I doing this correctly, or is it a bug? I'm trying to make my existing and working mailer to work with i18n translations.

# snippet from message_mailer.rb
mail to: ENV['MAILER_USERNAME'], subject: t('message_mailer.new_message', message: @message.name), css: ['mailers/message']
# snippet from en.yml
en
  message_mailer:
    new_message:
      subject: "New message from %{name}"

And the rendered mailer shows a subject like so:

Subject:
{:subject=>"New message from %{name}"}

EDIT: I changed the config from letter_opener to smtp, and this does not seem to be an issue with letter_opener. The actual emails to my inbox reflect the same results as letter_opener. Can anyone help me figure out what I am doing wrong anyways?

@guilhermesimoes
Copy link

Yes, this is unrelated to letter_opener.

t('message_mailer.new_message', message: @message.name)

should be

t('message_mailer.new_message.subject', name: @message.name)

Not sure if you already checked the Rails Guides, but this should be helpful.

@nashby
Copy link
Collaborator

nashby commented Jan 4, 2014

@guilhermesimoes thanks!

@nashby nashby closed this as completed Jan 4, 2014
@keilmillerjr
Copy link
Author

Wow. I feel stupid, but really appreciate the help. Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants