Skip to content

Commit

Permalink
Fully translatable email notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
imorland committed Dec 10, 2020
1 parent 212591a commit 02c3017
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 51 deletions.
64 changes: 53 additions & 11 deletions resources/locale/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,56 @@ fof-byobu:
byobu_index: Display a link to Private Discussions on the index page
byobu_index_help: When this option is enabled, a link from the forum main nav items to Private Discussions will be displayed

notifications:
private_discussion_created:
title: "[Private Discussion] user started a new private discussion with you"
private_discussion_replied:
title: "[Private Discussion] user posted in a private discussion"
recipient_removed:
title: "[Private Discussion] user left the discussion"
private_discussion_added:
title: "[Private Discussion] user added you to a private discussion"
made_public:
title: "[Private Discussion] user made the discussion public"
email:
subject:
private_discussion_created: "[Private Discussion] {display_name} started a new private discussion with you"
private_discussion_replied: "[Private Discussion] {display_name} posted in a private discussion"
recipient_removed: "[Private Discussion] {display_name} left the discussion"
private_discussion_added: "[Private Discussion] {display_name} added you to a private discussion"
made_public: "[Private Discussion] {display_name} made the discussion public"
body:
private_discussion_created: |
Hey {recipient_display_name},
{actor_display_name} started a new private discussion with you as a recipient, titled '{discussion_title}'.
View it here:
{discussion_url}
You may need to login first before being able to access this link.
private_discussion_replied: |
Hey {recipient_display_name},
{actor_display_name} posted in a private discussion with you as a recipient, titled '{discussion_title}'.
View it here:
{post_url}
You may need to login first before being able to access this link.
recipient_removed: |
Hey {recipient_display_name},
{actor_display_name} left the private discussion '{discussion_title}'. They'll no longer be able to view any of it's content.
View it here:
{discussion_url}
You may need to login first before being able to access this link.
private_discussion_added: |
Hey {recipient_display_name},
{actor_display_name} added you to an existing private discussion, titled '{discussion_title}'.
View it here:
{discussion_url}
You may need to login first before being able to access this link.
made_public: |
Hey {recipient_display_name},
{actor_display_name} made the private discussion '{discussion_title}' public. It's contents are now visible by anyone who can see the tag it's under.
View it here:
{discussion_url}
You may need to login first before being able to access this link.
11 changes: 6 additions & 5 deletions resources/views/emails/byobuMadePublic.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Hey {{ $user->username }},

{{ $blueprint->actor->username }} made the private discussion '{{ $blueprint->discussion->title }}' public. It's contents are now viewable by anyone who can see the tag it's under.

View it here: {{ app()->url() }}/d/{{ $blueprint->discussion->id }}-{{ $blueprint->discussion->slug }} (You may need to login first)
{!! $translator->trans('fof-byobu.email.body.made_public', [
'{recipient_display_name}' => $user->display_name,
'{actor_display_name}' => $blueprint->actor->display_name,
'{discussion_title}' => $blueprint->discussion->title,
'{discussion_url}' => $url->to('forum')->route('discussion', ['id' => $blueprint->discussion->id]),
]) !!}
11 changes: 6 additions & 5 deletions resources/views/emails/byobuRecipientRemoved.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Hey {{ $user->username }},

{{ $blueprint->user->username }} left the private discussion '{{ $blueprint->discussion->title }}'. They'll no longer be able to view any of it's content.

View it here: {{ app()->url() }}/d/{{ $blueprint->discussion->id }}-{{ $blueprint->discussion->slug }} (You may need to login first)
{!! $translator->trans('fof-byobu.email.body.recipient_removed', [
'{recipient_display_name}' => $user->display_name,
'{actor_display_name}' => $blueprint->user->display_name,
'{discussion_title}' => $blueprint->discussion->title,
'{discussion_url}' => $url->to('forum')->route('discussion', ['id' => $blueprint->discussion->id]),
]) !!}
11 changes: 6 additions & 5 deletions resources/views/emails/privateDiscussionAdded.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Hey {{ $user->username }},

{{ $blueprint->actor->username }} added you to an existing private discussion, titled '{{ $blueprint->discussion->title }}'.

View it here: {{ app()->url() }}/d/{{ $blueprint->discussion->id }}-{{ $blueprint->discussion->slug }} (You may need to login first)
{!! $translator->trans('fof-byobu.email.body.private_discussion_added', [
'{recipient_display_name}' => $user->display_name,
'{actor_display_name}' => $blueprint->actor->display_name,
'{discussion_title}' => $blueprint->discussion->title,
'{discussion_url}' => $url->to('forum')->route('discussion', ['id' => $blueprint->discussion->id]),
]) !!}
11 changes: 6 additions & 5 deletions resources/views/emails/privateDiscussionCreated.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Hey {{ $user->username }},

{{ $blueprint->discussion->user->username }} started a new private discussion with you as recipient, titled '{{ $blueprint->discussion->title }}'.

View it here: {{ app()->url() }}/d/{{ $blueprint->discussion->id }}-{{ $blueprint->discussion->slug }} (You may need to login first)
{!! $translator->trans('fof-byobu.email.body.private_discussion_created', [
'{recipient_display_name}' => $user->display_name,
'{actor_display_name}' => $blueprint->discussion->user->display_name,
'{discussion_title}' => $blueprint->discussion->title,
'{discussion_url}' => $url->to('forum')->route('discussion', ['id' => $blueprint->discussion->id]),
]) !!}
11 changes: 6 additions & 5 deletions resources/views/emails/privateDiscussionReplied.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Hey {{ $user->username }},

{{ $blueprint->post->user->username }} posted in a private discussion with you as recipient, titled '{{ $blueprint->post->discussion->title }}'.

View it here: {{ app()->url() }}/d/{{ $blueprint->post->discussion->id }}-{{ $blueprint->post->discussion->slug }}/{{ $blueprint->post->number }} (You may need to login first)
{!! $translator->trans('fof-byobu.email.body.private_discussion_replied', [
'{recipient_display_name}' => $user->display_name,
'{actor_display_name}' => $blueprint->post->user->display_name,
'{discussion_title}' => $blueprint->post->discussion->title,
'{post_url}' => $url->to('forum')->route('discussion', ['id' => $blueprint->post->discussion_id, 'near' => $blueprint->post->number]),
]) !!}
6 changes: 3 additions & 3 deletions src/Notifications/DiscussionAddedBlueprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ public function getEmailView()
*/
public function getEmailSubject()
{
return app('translator')->trans('fof-byobu.notifications.private_discussion_added.title', [
'user' => $this->actor->username,
'title' => $this->discussion->title,
return app('translator')->trans('fof-byobu.email.subject.private_discussion_added', [
'{display_name}' => $this->actor->username,
'{title}' => $this->discussion->title,
]);
}
}
6 changes: 3 additions & 3 deletions src/Notifications/DiscussionCreatedBlueprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ public function getEmailView()
*/
public function getEmailSubject()
{
return app('translator')->trans('fof-byobu.notifications.private_discussion_created.title', [
'user' => $this->discussion->user->username,
'title' => $this->discussion->title,
return app('translator')->trans('fof-byobu.email.subject.private_discussion_created', [
'{display_name}' => $this->discussion->user->display_name,
'{title}' => $this->discussion->title,
]);
}
}
6 changes: 3 additions & 3 deletions src/Notifications/DiscussionMadePublicBlueprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ public function getEmailView()
*/
public function getEmailSubject()
{
return app('translator')->trans('fof-byobu.notifications.made_public.title', [
'user' => $this->actor->username,
'title' => $this->discussion->title,
return app('translator')->trans('fof-byobu.email.subject.made_public', [
'{display_name}' => $this->actor->display_name,
'{title}' => $this->discussion->title,
]);
}
}
6 changes: 3 additions & 3 deletions src/Notifications/DiscussionRecipientRemovedBlueprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ public function getEmailView()
*/
public function getEmailSubject()
{
return app('translator')->trans('fof-byobu.notifications.recipient_removed.title', [
'user' => $this->user->username,
'title' => $this->discussion->title,
return app('translator')->trans('fof-byobu.email.subject.recipient_removed', [
'{display_name}' => $this->user->display_name,
'{title}' => $this->discussion->title,
]);
}
}
6 changes: 3 additions & 3 deletions src/Notifications/DiscussionRepliedBlueprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ public function getEmailView()
*/
public function getEmailSubject()
{
return app('translator')->trans('fof-byobu.notifications.private_discussion_replied.title', [
'user' => $this->actor->username,
'title' => $this->post->discussion->title,
return app('translator')->trans('fof-byobu.email.subject.private_discussion_replied', [
'{display_name}' => $this->actor->display_name,
'{title}' => $this->post->discussion->title,
]);
}
}

0 comments on commit 02c3017

Please sign in to comment.