From 59e837fd47cf08fbf44302440945be89be0c9a5c Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Sun, 25 Jan 2026 17:23:16 -0300 Subject: [PATCH] feat: add i18n support for workspace connections disconnected email --- app/Mail/WorkspaceConnectionsDisconnected.php | 73 +++++++++ lang/en/mail.php | 15 ++ lang/pt-BR/mail.php | 15 ++ .../workspace-connections-disconnected.html | 66 +++++++++ ...rkspace-connections-disconnected.blade.php | 138 ++++++++++++++++++ 5 files changed, 307 insertions(+) create mode 100644 app/Mail/WorkspaceConnectionsDisconnected.php create mode 100644 lang/en/mail.php create mode 100644 lang/pt-BR/mail.php create mode 100644 maizzle/templates/workspace-connections-disconnected.html create mode 100644 resources/views/mail/workspace-connections-disconnected.blade.php diff --git a/app/Mail/WorkspaceConnectionsDisconnected.php b/app/Mail/WorkspaceConnectionsDisconnected.php new file mode 100644 index 00000000..5f764b79 --- /dev/null +++ b/app/Mail/WorkspaceConnectionsDisconnected.php @@ -0,0 +1,73 @@ + $disconnectedAccounts + */ + public function __construct( + public Workspace $workspace, + public Collection $disconnectedAccounts + ) { + $this->locale = $this->workspace->owner?->language?->code ?? 'en'; + } + + public function envelope(): Envelope + { + $count = $this->disconnectedAccounts->count(); + + return new Envelope( + subject: trans_choice('mail.workspace_connections_disconnected.subject', $count, [ + 'count' => $count, + 'workspace' => $this->workspace->name, + ], $this->locale), + ); + } + + public function content(): Content + { + $count = $this->disconnectedAccounts->count(); + $workspaceName = $this->workspace->name; + $locale = $this->locale; + + return new Content( + view: 'mail.workspace-connections-disconnected', + with: [ + 'title' => __('mail.workspace_connections_disconnected.title', [], $locale), + 'previewText' => trans_choice('mail.workspace_connections_disconnected.subject', $count, [ + 'count' => $count, + 'workspace' => $workspaceName, + ], $locale), + 'intro' => __('mail.workspace_connections_disconnected.intro', ['workspace' => $workspaceName], $locale), + 'reasonsTitle' => __('mail.workspace_connections_disconnected.reasons_title', [], $locale), + 'reasonExpired' => __('mail.workspace_connections_disconnected.reason_expired', [], $locale), + 'reasonRevoked' => __('mail.workspace_connections_disconnected.reason_revoked', [], $locale), + 'reasonChanged' => __('mail.workspace_connections_disconnected.reason_changed', [], $locale), + 'reconnectCta' => __('mail.workspace_connections_disconnected.reconnect_cta', [], $locale), + 'buttonText' => __('mail.workspace_connections_disconnected.button', [], $locale), + 'workspace' => $this->workspace, + 'disconnectedAccounts' => $this->disconnectedAccounts, + 'url' => route('accounts'), + ], + ); + } + + public function attachments(): array + { + return []; + } +} diff --git a/lang/en/mail.php b/lang/en/mail.php new file mode 100644 index 00000000..d31c4e50 --- /dev/null +++ b/lang/en/mail.php @@ -0,0 +1,15 @@ + [ + 'subject' => '{1} :count account needs to be reconnected in :workspace|[2,*] :count accounts need to be reconnected in :workspace', + 'title' => 'Accounts Need Reconnection', + 'intro' => 'The following social accounts in your :workspace workspace have been disconnected and need to be reconnected:', + 'reasons_title' => 'This may have happened because:', + 'reason_expired' => 'Access tokens expired', + 'reason_revoked' => 'You revoked access to TryPost on the platform', + 'reason_changed' => 'The platform changed their authentication requirements', + 'reconnect_cta' => 'Please reconnect these accounts to continue scheduling and publishing posts.', + 'button' => 'Reconnect Accounts', + ], +]; diff --git a/lang/pt-BR/mail.php b/lang/pt-BR/mail.php new file mode 100644 index 00000000..dce2efe5 --- /dev/null +++ b/lang/pt-BR/mail.php @@ -0,0 +1,15 @@ + [ + 'subject' => '{1} :count conta precisa ser reconectada em :workspace|[2,*] :count contas precisam ser reconectadas em :workspace', + 'title' => 'Contas Precisam ser Reconectadas', + 'intro' => 'As seguintes contas de redes sociais no seu workspace :workspace foram desconectadas e precisam ser reconectadas:', + 'reasons_title' => 'Isso pode ter acontecido porque:', + 'reason_expired' => 'Os tokens de acesso expiraram', + 'reason_revoked' => 'Você revogou o acesso ao TryPost na plataforma', + 'reason_changed' => 'A plataforma mudou os requisitos de autenticação', + 'reconnect_cta' => 'Por favor, reconecte essas contas para continuar agendando e publicando posts.', + 'button' => 'Reconectar Contas', + ], +]; diff --git a/maizzle/templates/workspace-connections-disconnected.html b/maizzle/templates/workspace-connections-disconnected.html new file mode 100644 index 00000000..3e94c864 --- /dev/null +++ b/maizzle/templates/workspace-connections-disconnected.html @@ -0,0 +1,66 @@ + +
+ + + + +
+ + + + + + +
+

+ @{{ $title }} +

+ +

+ {!! $intro !!} +

+ + + @foreach($disconnectedAccounts as $account) + + + + @endforeach +
+
+
+
+ @{{ $account->platform->label() }} + @if($account->display_name || $account->username) + - @{{ $account->display_name ?? $account->username }} + @endif +
+
+
+ +

+ @{{ $reasonsTitle }} +

+ +
    +
  • @{{ $reasonExpired }}
  • +
  • @{{ $reasonRevoked }}
  • +
  • @{{ $reasonChanged }}
  • +
+ +

+ @{{ $reconnectCta }} +

+ + + +
+ + @{{ $buttonText }} → + +
+
+ +
+
+
diff --git a/resources/views/mail/workspace-connections-disconnected.blade.php b/resources/views/mail/workspace-connections-disconnected.blade.php new file mode 100644 index 00000000..db518221 --- /dev/null +++ b/resources/views/mail/workspace-connections-disconnected.blade.php @@ -0,0 +1,138 @@ + + + + + + + + + + + @if(isset($title)) + {{ $title }} + @endif + + + + + + + @if(isset($previewText)) +
+ {{ $previewText }} +  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏ +
+ @endif +
+
+ + + + + + + +
+
+ + Trypost + +
+ + + + +
+

+ {{ $title }} +

+

+ {!! $intro !!} +

+ + @foreach($disconnectedAccounts as $account) + + + + @endforeach +
+
+
+
+ {{ $account->platform->label() }} + @if($account->display_name || $account->username) + - {{ $account->display_name ?? $account->username }} + @endif +
+
+
+

+ {{ $reasonsTitle }} +

+
    +
  • {{ $reasonExpired }}
  • +
  • {{ $reasonRevoked }}
  • +
  • {{ $reasonChanged }}
  • +
+

+ {{ $reconnectCta }} +

+
+ +
+
+

+ Open-source social media scheduling tool +

+ @if(isset($unsubscribe_url)) +

+ + Unsubscribe + +

+ @endif +
+
+
+ + \ No newline at end of file