localize emails

This commit is contained in:
MrZYX 2011-02-12 17:35:12 +01:00
parent 8639e08920
commit 3c089506ff

View file

@ -30,9 +30,11 @@ class Notifier < ActionMailer::Base
attachments.inline['logo_caps.png'] = ATTACHMENT attachments.inline['logo_caps.png'] = ATTACHMENT
I18n.with_locale(@receiver.language) do
mail(:to => "\"#{@receiver.name}\" <#{@receiver.email}>", mail(:to => "\"#{@receiver.name}\" <#{@receiver.email}>",
:subject => I18n.t('notifier.new_request.subject', :from => @sender.name), :host => AppConfig[:pod_uri].host) :subject => I18n.t('notifier.new_request.subject', :from => @sender.name), :host => AppConfig[:pod_uri].host)
end end
end
def request_accepted(recipient_id, sender_id) def request_accepted(recipient_id, sender_id)
@receiver = User.find_by_id(recipient_id) @receiver = User.find_by_id(recipient_id)
@ -42,9 +44,11 @@ class Notifier < ActionMailer::Base
attachments.inline['logo_caps.png'] = ATTACHMENT attachments.inline['logo_caps.png'] = ATTACHMENT
I18n.with_locale(@receiver.language) do
mail(:to => "\"#{@receiver.name}\" <#{@receiver.email}>", mail(:to => "\"#{@receiver.name}\" <#{@receiver.email}>",
:subject => I18n.t('notifier.request_accepted.subject', :name => @sender.name), :host => AppConfig[:pod_uri].host) :subject => I18n.t('notifier.request_accepted.subject', :name => @sender.name), :host => AppConfig[:pod_uri].host)
end end
end
def mentioned(recipient_id, sender_id, target_id) def mentioned(recipient_id, sender_id, target_id)
@receiver = User.find_by_id(recipient_id) @receiver = User.find_by_id(recipient_id)
@ -55,9 +59,11 @@ class Notifier < ActionMailer::Base
attachments.inline['logo_caps.png'] = ATTACHMENT attachments.inline['logo_caps.png'] = ATTACHMENT
I18n.with_locale(@receiver.language) do
mail(:to => "\"#{@receiver.name}\" <#{@receiver.email}>", mail(:to => "\"#{@receiver.name}\" <#{@receiver.email}>",
:subject => I18n.t('notifier.mentioned.subject', :name => @sender.name), :host => AppConfig[:pod_uri].host) :subject => I18n.t('notifier.mentioned.subject', :name => @sender.name), :host => AppConfig[:pod_uri].host)
end end
end
def comment_on_post(recipient_id, sender_id, comment_id) def comment_on_post(recipient_id, sender_id, comment_id)
@receiver = User.find_by_id(recipient_id) @receiver = User.find_by_id(recipient_id)
@ -68,9 +74,11 @@ class Notifier < ActionMailer::Base
attachments.inline['logo_caps.png'] = ATTACHMENT attachments.inline['logo_caps.png'] = ATTACHMENT
I18n.with_locale(@receiver.language) do
mail(:to => "\"#{@receiver.name}\" <#{@receiver.email}>", mail(:to => "\"#{@receiver.name}\" <#{@receiver.email}>",
:subject => I18n.t('notifier.comment_on_post.subject', :name => @sender.name), :host => AppConfig[:pod_uri].host) :subject => I18n.t('notifier.comment_on_post.subject', :name => @sender.name), :host => AppConfig[:pod_uri].host)
end end
end
def also_commented(recipient_id, sender_id, comment_id) def also_commented(recipient_id, sender_id, comment_id)
@receiver = User.find_by_id(recipient_id) @receiver = User.find_by_id(recipient_id)
@ -83,9 +91,11 @@ class Notifier < ActionMailer::Base
attachments.inline['logo_caps.png'] = ATTACHMENT attachments.inline['logo_caps.png'] = ATTACHMENT
I18n.with_locale(@receiver.language) do
mail(:to => "\"#{@receiver.name}\" <#{@receiver.email}>", mail(:to => "\"#{@receiver.name}\" <#{@receiver.email}>",
:subject => I18n.t('notifier.also_commented.subject', :name => @sender.name, :post_author => @post_author_name ), :host => AppConfig[:pod_uri].host) :subject => I18n.t('notifier.also_commented.subject', :name => @sender.name, :post_author => @post_author_name ), :host => AppConfig[:pod_uri].host)
end end
end
private private
def log_mail recipient_id, sender_id, type def log_mail recipient_id, sender_id, type