From 0c94ef59126f26bd8e1dea60ec2bb89859e84720 Mon Sep 17 00:00:00 2001 From: wvengen Date: Tue, 7 May 2013 13:28:14 +0200 Subject: [PATCH] also translate mail subjects --- app/mailers/mailer.rb | 14 +++++++------- config/locales/de/de.mailer.yml | 7 +++++++ config/locales/en/en.mailer.yml | 6 ++++++ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/app/mailers/mailer.rb b/app/mailers/mailer.rb index 5092d55a..30eb44a7 100644 --- a/app/mailers/mailer.rb +++ b/app/mailers/mailer.rb @@ -26,7 +26,7 @@ class Mailer < ActionMailer::Base @link = new_password_url(id: @user.id, token: @user.reset_password_token) mail :to => @user.email, - :subject => "[#{FoodsoftConfig[:name]}] Neues Passwort für/ New password for #{@user.nick}" + :subject => "[#{FoodsoftConfig[:name]}] " + I18n.t('mailer.reset_password.subject', :username => @user.nick) end # Sends an invite email. @@ -36,7 +36,7 @@ class Mailer < ActionMailer::Base @link = accept_invitation_url(token: @invite.token) mail :to => @invite.email, - :subject => "Einladung in die Foodcoop #{FoodsoftConfig[:name]} - Invitation to the Foodcoop" + :subject => I18n.t('mailer.invite.subject') end # Notify user of upcoming task. @@ -46,7 +46,7 @@ class Mailer < ActionMailer::Base @task = task mail :to => user.email, - :subject => "[#{FoodsoftConfig[:name]}] Aufgaben werden fällig!" + :subject => "[#{FoodsoftConfig[:name]}] " + I18n.t('mailer.upcoming_tasks.subject') end # Sends order result for specific Ordergroup @@ -56,7 +56,7 @@ class Mailer < ActionMailer::Base @group_order = group_order mail :to => user.email, - :subject => "[#{FoodsoftConfig[:name]}] Bestellung beendet: #{group_order.order.name}" + :subject => "[#{FoodsoftConfig[:name]}] " + I18n.t('mailer.order_result.subject', :name => group_order.order.name) end # Notify user if account balance is less than zero @@ -66,7 +66,7 @@ class Mailer < ActionMailer::Base @transaction = transaction mail :to => user.email, - :subject => "[#{FoodsoftConfig[:name]}] Gruppenkonto im Minus" + :subject => "[#{FoodsoftConfig[:name]}] " + I18n.t('mailer.negative_balance') end def feedback(user, feedback) @@ -78,7 +78,7 @@ class Mailer < ActionMailer::Base :from => "#{user.nick} <#{user.email}>", :sender => FoodsoftConfig[:notification]["sender_address"], :errors_to => FoodsoftConfig[:notification]["sender_address"], - :subject => "[Foodsoft] Feeback von #{user.email}" + :subject => "[#{FoodsoftConfig[:name]}] " + I18n.t('mailer.feedback.subject', :email => user.email) end def not_enough_users_assigned(task, user) @@ -87,7 +87,7 @@ class Mailer < ActionMailer::Base @user = user mail :to => user.email, - :subject => "[#{FoodsoftConfig[:name]}] \"#{task.name}\" braucht noch Leute!" + :subject => "[#{FoodsoftConfig[:name]}] " + I18n.t('mailer.not_enough_users_assigned.subject', :task => task.name) end private diff --git a/config/locales/de/de.mailer.yml b/config/locales/de/de.mailer.yml index 294cabf7..ea0ec215 100644 --- a/config/locales/de/de.mailer.yml +++ b/config/locales/de/de.mailer.yml @@ -2,6 +2,7 @@ de: mailer: dateformat: '%d. %b' feedback: + subject: 'Feedback von %{email}' header: '%{user} schrieb am %{date}:' foodsoft_message: footer: | @@ -9,6 +10,7 @@ de: Nachricht online einsehen: %{msg_url} Nachrichten-Einstellungen: %{profile_url} invite: + subject: 'Einlading in die Foodcoop' text: | Hallo! @@ -18,6 +20,7 @@ de: Grüße sendet die Foodsoft! negative_balance: + subject: 'Gruppenkonto im Minus' text: | Liebe %{group}, @@ -29,6 +32,7 @@ de: Viele Grüße von %{foodcoop} not_enough_users_assigned: + subject: '"%{task}" braucht noch Leute!' text: | Liebe(r) %{user}, @@ -41,6 +45,7 @@ de: Deine Aufgaben: %{user_tasks_url} order_result: + subject: 'Bestellung beendet: %{name}' text0: | Liebe %{ordergroup}, @@ -54,6 +59,7 @@ de: Viele Grüße von %{foodcoop} reset_password: + subject: 'Neues Password für %{username}' text: | Hallo %{user}, @@ -65,6 +71,7 @@ de: Grüße sendet die Foodsoft! :) upcoming_tasks: + subject: 'Aufgaben werden fällig!' text0: | Liebe(r) %{user}, diff --git a/config/locales/en/en.mailer.yml b/config/locales/en/en.mailer.yml index 60cc35f6..e098a981 100644 --- a/config/locales/en/en.mailer.yml +++ b/config/locales/en/en.mailer.yml @@ -2,6 +2,7 @@ en: mailer: dateformat: '%d %b' feedback: + subject: 'Feedback from %{email}' header: '%{user} wrote at %{date}:' foodsoft_message: footer: | @@ -9,6 +10,7 @@ en: See message online: %{msg_url} Messaging options: %{profile_url} invite: + subject: 'Invitation to the Foodcoop' text: | Hi! @@ -18,6 +20,7 @@ en: Greetings, your Foodsoft Team! negative_balance: + subject: 'Negative account balance' text: | Dear %{group}, @@ -29,6 +32,7 @@ en: Kind regards from %{foodcoop}. not_enough_users_assigned: + subject: '"%{task}" still needs people!' text: | Dear %{user}, @@ -54,6 +58,7 @@ en: Kind regards from %{foodcoop}. reset_password: + subject: 'New password for %{username}' text: | Hi %{user}, @@ -64,6 +69,7 @@ en: Greetings, your Foodsoft Team! upcoming_tasks: + subject: 'Tasks are due!' text0: | Dear %{user},