diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb index 5023acd0a..18fdf3bc7 100644 --- a/app/helpers/notifications_helper.rb +++ b/app/helpers/notifications_helper.rb @@ -1,37 +1,40 @@ module NotificationsHelper def object_link(note) target_type = note.action - translation = t("notifications.#{target_type}") case target_type when 'mentioned' post = Mention.find(note.target_id).post if post - "#{translation} #{link_to t('notifications.post'), object_path(post)}".html_safe + "#{translation(target_type)} #{link_to t('notifications.post'), object_path(post)}".html_safe else - "#{translation} #{t('notifications.deleted')} #{t('notifications.post')}" + "#{translation(target_type)} #{t('notifications.deleted')} #{t('notifications.post')}" end when 'request_accepted' - translation + translation(target_type) when 'new_request' - translation + translation(target_type) when 'comment_on_post' post = Post.where(:id => note.target_id).first if post - "#{translation} #{link_to t('notifications.post'), object_path(post)}".html_safe + "#{translation(target_type)} #{link_to t('notifications.post'), object_path(post)}".html_safe else - "#{translation} #{t('notifications.deleted')} #{t('notifications.post')}" + "#{translation(target_type)} #{t('notifications.deleted')} #{t('notifications.post')}" end when 'also_commented' post = Post.where(:id => note.target_id).first if post - "#{translation} #{link_to t('notifications.post'), object_path(post)}".html_safe + "#{translation(target_type, post.person.name)} #{link_to t('notifications.post'), object_path(post)}".html_safe else - "#{translation} #{t('notifications.deleted')} #{t('notifications.post')}" + "#{translation(target_type, post.person.name)} #{t('notifications.deleted')} #{t('notifications.post')}" end else end end + def translation(target_type, post_author = nil) + t("notifications.#{target_type}", :post_author => post_author) + end + def new_notification_text(count) if count > 0 t('new_notifications', :count => count) diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 4521f01b4..1da47f737 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -223,7 +223,7 @@ en: request_accepted: "accepted your share request." new_request: "offered to share with you." comment_on_post: "commented on your" - also_commented: "also commented on your contact's" + also_commented: "also commented on %{post_author}'s" mentioned: "has mentioned you in their" post: "post" deleted: "deleted" @@ -479,7 +479,7 @@ en: commented: "has commented on your post:" sign_in: "Sign in to view it." also_commented: - subject: "%{name} has also commented on your contact's post." + subject: "%{name} has also commented on your %{post_author}'s post." commented: "has also commented on %{post_author}'s post:" sign_in: "Sign in to view it." mentioned: