From b54bb20617daf45bc96b4198aff71e47b4fd71bb Mon Sep 17 00:00:00 2001 From: Florian Dupret Date: Mon, 25 May 2020 13:13:33 +0200 Subject: [PATCH 1/5] Make admin test email translatable --- resources/lang/en_US/firefly.php | 9 +++++++++ resources/views/v1/emails/admin-test-html.twig | 2 +- resources/views/v1/emails/admin-test-text.twig | 2 +- resources/views/v1/emails/footer-html.twig | 6 +++--- resources/views/v1/emails/footer-text.twig | 6 +++--- resources/views/v1/emails/header-html.twig | 2 +- resources/views/v1/emails/header-text.twig | 3 +-- 7 files changed, 19 insertions(+), 11 deletions(-) diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php index d0c7de9560..6b7cf41cb0 100644 --- a/resources/lang/en_US/firefly.php +++ b/resources/lang/en_US/firefly.php @@ -1621,6 +1621,15 @@ return [ 'box_net_worth_in_currency' => 'Net worth (:currency)', 'box_spend_per_day' => 'Left to spend per day: :amount', + // emails + 'email_greeting' => 'Hi there,', + 'email_closing' => 'Beep boop,', + 'email_signature' => 'The Firefly III Mail Robot', + 'email_footer_ps' => 'PS: This message was sent because a request from IP :ip:userIp:ipAddress triggered it.', + + 'email_admin_test_subject' => 'A test message from your Firefly III installation', + 'email_admin_test_body' => 'This is a test message from your Firefly III instance. It was sent to :email.', + // telemetry 'telemetry_admin_index' => 'Telemetry', 'telemetry_intro' => 'Firefly III supports the collection and sending of usage telemetry. This means that Firefly III will try to collect info on how you use Firefly III, and send it to the developer of Firefly III. This is always opt-in, and is disabled by default. Firefly III will never collect or send financial information. Firefly III will also never collect or send financial meta-information, like sums or calculations. The collected data will never be made publicly accessible.', diff --git a/resources/views/v1/emails/admin-test-html.twig b/resources/views/v1/emails/admin-test-html.twig index 0862786993..30ef2cacdf 100644 --- a/resources/views/v1/emails/admin-test-html.twig +++ b/resources/views/v1/emails/admin-test-html.twig @@ -1,5 +1,5 @@ {% include 'emails.header-html' %}

- This is a test message from your Firefly III instance. It was sent to {{ email }}. + {{ trans('firefly.email_admin_test_body', {email: email })}}

{% include 'emails.footer-html' %} diff --git a/resources/views/v1/emails/admin-test-text.twig b/resources/views/v1/emails/admin-test-text.twig index 23c246e694..dd2799b575 100644 --- a/resources/views/v1/emails/admin-test-text.twig +++ b/resources/views/v1/emails/admin-test-text.twig @@ -1,3 +1,3 @@ {% include 'emails.header-text' %} - This is a test message from your Firefly III instance. It was sent to {{ email }}. + {{ trans('firefly.email_admin_test_body', {email: email })}} {% include 'emails.footer-text' %} diff --git a/resources/views/v1/emails/footer-html.twig b/resources/views/v1/emails/footer-html.twig index 6e2ca37007..ed426326d4 100644 --- a/resources/views/v1/emails/footer-html.twig +++ b/resources/views/v1/emails/footer-html.twig @@ -1,12 +1,12 @@

- Beep boop, + {{ trans('firefly.email_closing') }}

- The Firefly III Mail Robot + {{ trans('firefly.email_signature') }}

- PS: This message was sent because a request from IP {{ ip }}{{ userIp }}{{ ipAddress }} triggered it. + {{ trans('firefly.email_footer_ps', {ip: ip, userIp: userIp, ipAddress: ipAddress}) }}

diff --git a/resources/views/v1/emails/footer-text.twig b/resources/views/v1/emails/footer-text.twig index e2ec3ff9d4..321902a6b4 100644 --- a/resources/views/v1/emails/footer-text.twig +++ b/resources/views/v1/emails/footer-text.twig @@ -1,6 +1,6 @@ -Beep boop, +{{ trans('firefly.email_closing') }} -The Firefly III Mail Robot +{{ trans('firefly.email_signature') }} -PS: This message was sent because a request from IP {{ ip }}{{ userIp }}{{ ipAddress }} triggered it. +{{ trans('firefly.email_footer_ps', {ip: ip, userIp: userIp, ipAddress: ipAddress}) }} diff --git a/resources/views/v1/emails/header-html.twig b/resources/views/v1/emails/header-html.twig index f3a4e8edc7..a6e8ac4475 100644 --- a/resources/views/v1/emails/header-html.twig +++ b/resources/views/v1/emails/header-html.twig @@ -6,5 +6,5 @@

- Hi there, + {{ trans('firefly.email_greeting') }}

diff --git a/resources/views/v1/emails/header-text.twig b/resources/views/v1/emails/header-text.twig index e60df7e024..3ea6e074da 100644 --- a/resources/views/v1/emails/header-text.twig +++ b/resources/views/v1/emails/header-text.twig @@ -1,2 +1 @@ -Hi there, - +{{ trans('firefly.email_greeting') }} From 37b35661be67b0935cf03b4cf022c91acf905825 Mon Sep 17 00:00:00 2001 From: Florian Dupret Date: Mon, 25 May 2020 19:24:21 +0200 Subject: [PATCH 2/5] most email notifications translatable --- app/Jobs/MailError.php | 2 +- app/Mail/AccessTokenCreatedMail.php | 2 +- app/Mail/AdminTestMail.php | 2 +- app/Mail/ConfirmEmailChangeMail.php | 2 +- app/Mail/OAuthTokenCreatedMail.php | 2 +- app/Mail/RegisteredUser.php | 2 +- app/Mail/RequestedNewPassword.php | 2 +- app/Mail/UndoEmailChangeMail.php | 2 +- resources/lang/en_US/email.php | 98 +++++++++++++++++++ resources/lang/en_US/firefly.php | 9 -- .../v1/emails/access-token-created-html.twig | 6 +- .../v1/emails/access-token-created-text.twig | 6 +- .../views/v1/emails/admin-test-html.twig | 2 +- .../views/v1/emails/admin-test-text.twig | 2 +- .../v1/emails/confirm-email-change-html.twig | 8 +- .../v1/emails/confirm-email-change-text.twig | 9 +- resources/views/v1/emails/error-html.twig | 28 +++--- resources/views/v1/emails/footer-html.twig | 6 +- resources/views/v1/emails/footer-text.twig | 6 +- resources/views/v1/emails/header-html.twig | 2 +- resources/views/v1/emails/header-text.twig | 2 +- .../v1/emails/oauth-client-created-html.twig | 7 +- .../v1/emails/oauth-client-created-text.twig | 6 +- resources/views/v1/emails/password-html.twig | 4 +- resources/views/v1/emails/password-text.twig | 4 +- .../views/v1/emails/registered-html.twig | 12 ++- .../views/v1/emails/registered-text.twig | 16 +-- .../v1/emails/undo-email-change-html.twig | 11 +-- .../v1/emails/undo-email-change-text.twig | 11 +-- 29 files changed, 179 insertions(+), 92 deletions(-) create mode 100644 resources/lang/en_US/email.php diff --git a/app/Jobs/MailError.php b/app/Jobs/MailError.php index abcc87a586..032b15ba50 100644 --- a/app/Jobs/MailError.php +++ b/app/Jobs/MailError.php @@ -84,7 +84,7 @@ class MailError extends Job implements ShouldQueue $args, function (Message $message) use ($email) { if ('mail@example.com' !== $email) { - $message->to($email, $email)->subject('Caught an error in Firefly III'); + $message->to($email, $email)->subject(trans('email.error_subject')); } } ); diff --git a/app/Mail/AccessTokenCreatedMail.php b/app/Mail/AccessTokenCreatedMail.php index 584a7b5eee..96f4c3a594 100644 --- a/app/Mail/AccessTokenCreatedMail.php +++ b/app/Mail/AccessTokenCreatedMail.php @@ -63,6 +63,6 @@ class AccessTokenCreatedMail extends Mailable public function build(): self { return $this->view('emails.access-token-created-html')->text('emails.access-token-created-text') - ->subject('A new access token was created'); + ->subject(trans('email.access_token_created_subject')); } } diff --git a/app/Mail/AdminTestMail.php b/app/Mail/AdminTestMail.php index 91d65bcba2..c02f50f345 100644 --- a/app/Mail/AdminTestMail.php +++ b/app/Mail/AdminTestMail.php @@ -62,6 +62,6 @@ class AdminTestMail extends Mailable public function build(): self { return $this->view('emails.admin-test-html')->text('emails.admin-test-text') - ->subject('A test message from your Firefly III installation'); + ->subject(trans('email.admin_test_subject')); } } diff --git a/app/Mail/ConfirmEmailChangeMail.php b/app/Mail/ConfirmEmailChangeMail.php index 1e7be38f1a..91d6e6a5cf 100644 --- a/app/Mail/ConfirmEmailChangeMail.php +++ b/app/Mail/ConfirmEmailChangeMail.php @@ -70,6 +70,6 @@ class ConfirmEmailChangeMail extends Mailable public function build(): self { return $this->view('emails.confirm-email-change-html')->text('emails.confirm-email-change-text') - ->subject('Your Firefly III email address has changed'); + ->subject(trans('email.email_change_subject')); } } diff --git a/app/Mail/OAuthTokenCreatedMail.php b/app/Mail/OAuthTokenCreatedMail.php index ad3dbfb474..72336b0853 100644 --- a/app/Mail/OAuthTokenCreatedMail.php +++ b/app/Mail/OAuthTokenCreatedMail.php @@ -67,6 +67,6 @@ class OAuthTokenCreatedMail extends Mailable public function build(): self { return $this->view('emails.oauth-client-created-html')->text('emails.oauth-client-created-text') - ->subject('A new OAuth client has been created'); + ->subject(trans('email.oauth_created_subject')); } } diff --git a/app/Mail/RegisteredUser.php b/app/Mail/RegisteredUser.php index edda7e6885..1d90ec36e5 100644 --- a/app/Mail/RegisteredUser.php +++ b/app/Mail/RegisteredUser.php @@ -61,6 +61,6 @@ class RegisteredUser extends Mailable */ public function build(): self { - return $this->view('emails.registered-html')->text('emails.registered-text')->subject('Welcome to Firefly III!'); + return $this->view('emails.registered-html')->text('emails.registered-text')->subject(trans('email.registered_subject')); } } diff --git a/app/Mail/RequestedNewPassword.php b/app/Mail/RequestedNewPassword.php index f1bb6c9b75..eccf9a5eb6 100644 --- a/app/Mail/RequestedNewPassword.php +++ b/app/Mail/RequestedNewPassword.php @@ -60,6 +60,6 @@ class RequestedNewPassword extends Mailable */ public function build(): self { - return $this->view('emails.password-html')->text('emails.password-text')->subject('Your password reset request'); + return $this->view('emails.password-html')->text('emails.password-text')->subject(trans('email.reset_pw_subject')); } } diff --git a/app/Mail/UndoEmailChangeMail.php b/app/Mail/UndoEmailChangeMail.php index dd54a573ef..0d325bff82 100644 --- a/app/Mail/UndoEmailChangeMail.php +++ b/app/Mail/UndoEmailChangeMail.php @@ -68,6 +68,6 @@ class UndoEmailChangeMail extends Mailable public function build(): self { return $this->view('emails.undo-email-change-html')->text('emails.undo-email-change-text') - ->subject('Your Firefly III email address has changed'); + ->subject(trans('email.email_change_subject')); } } diff --git a/resources/lang/en_US/email.php b/resources/lang/en_US/email.php new file mode 100644 index 0000000000..f0aef757c3 --- /dev/null +++ b/resources/lang/en_US/email.php @@ -0,0 +1,98 @@ +. + */ + +declare(strict_types=1); + +return [ + // common items + 'greeting' => 'Hi there,', + 'closing' => 'Beep boop,', + 'signature' => 'The Firefly III Mail Robot', + 'footer_ps' => 'PS: This message was sent because a request from IP :ipAddress triggered it.', + + // admin test + 'admin_test_subject' => 'A test message from your Firefly III installation', + 'admin_test_body' => 'This is a test message from your Firefly III instance. It was sent to :email.', + + // access token created + 'access_token_created_subject' => 'A new access token was created', + 'access_token_created_body_1' => 'Somebody (hopefully you) just created a new Firefly III API Access Token for your user account.', + 'access_token_created_body_2_html' => 'With this token, they can access all of your financial records through the Firefly III API.', + 'access_token_created_body_2_text' => 'With this token, they can access *all* of your financial records through the Firefly III API.', + 'access_token_created_body_3' => 'If this wasn\'t you, please revoke this token as soon as possible at :url.', + + // registered + 'registered_subject' => 'Welcome to Firefly III!', + 'registered_welcome_html' => 'Welcome to Firefly III. Your registration has made it, and this email is here to confirm it. Yay!', + 'registered_welcome_text' => 'Welcome to Firefly III. Your registration has made it, and this email is here to confirm it. Yay!', + 'registered_pw_html' => 'If you have forgotten your password already, please reset it using the password reset tool.', + 'registered_pw_text' => 'If you have forgotten your password already, please reset it using the password reset tool.', + 'registered_help' => 'There is a help-icon in the top right corner of each page. If you need help, click it!', + 'registered_doc_html' => 'If you haven\'t already, please read the grand theory.', + 'registered_doc_text' => 'If you haven\'t already, please read the first use guide and the full description.', + 'registered_closing' => 'Enjoy!', + 'registered_firefly_iii_link' => 'Firefly III:', + 'registered_pw_reset_link' => 'Password reset:', + 'registered_doc_link' => 'Documentation:', + + // email change + 'email_change_subject' => 'Your Firefly III email address has changed', + 'email_change_body_to_new' => 'You or somebody with access to your Firefly III account has changed your email address. If you did not expect this message, please ignore and delete it.', + 'email_change_body_to_old_html' => 'You or somebody with access to your Firefly III account has changed your email address. + If you did not expect this to happen, you must follow the "undo"-link below to protect your account!', + 'email_change_body_to_old_text' => 'You or somebody with access to your Firefly III account has changed your email address. If you did not expect this to happen, + you must follow the "undo"-link below to protect your account!', + 'email_change_ignore' => 'If you initiated this change, you may safely ignore this message.', + 'email_change_old' => 'The old email address was:', + 'email_change_new' => 'The new email address is:', + 'email_change_instructions' => 'You cannot use Firefly III until you confirm this change. Please follow the link below to do so.', + 'email_change_undo_link' => 'To undo the change, follow this link:', + + // OAuth token created + 'oauth_created_subject' => 'A new OAuth client has been created', + 'oauth_created_body_html' => 'Somebody (hopefully you) just created a new Firefly III API OAuth Client for your user account. It\'s labeled ":name" and has callback URL :url.', + 'oauth_created_body_text' => 'Somebody (hopefully you) just created a new Firefly III API OAuth Client for your user account. It\'s labeled ":name" and has callback URL:', + 'oauth_created_explanation_html' => 'With this client, they can access all of your financial records through the Firefly III API.', + 'oauth_created_explanation_text' => 'With this client, they can access *all* of your financial records through the Firefly III API.', + 'oauth_created_undo' => 'If this wasn\'t you, please revoke this client as soon as possible at :url.', + + // reset password + 'reset_pw_subject' => 'Your password reset request', + 'reset_pw_instructions' => 'Somebody tried to reset your password. If it was you, please follow the link below to do so.', + 'reset_pw_warning_html' => 'PLEASE verify that the link actually goes to the Firefly III you expect it to go!', + 'reset_pw_warning_text' => '*PLEASE* verify that the link actually goes to the Firefly III you expect it to go!', + + // error + 'error_subject' => 'Caught an error in Firefly III', + 'error_intro_html' => 'Firefly III v:version ran into an error: :errorMessage', + 'error_type' => 'The error was of type ":class".', + 'error_timestamp' => 'The error occurred on/at: :time.', + 'error_location_html' => 'This error occurred in file :file on line :line with code :code.', + 'error_user_html' => 'The error was encountered by user #:id, :email.', + 'error_no_user' => 'There was no user logged in for this error or no user was detected.', + 'error_ip' => 'The IP address related to this error is:', + 'error_url' => 'URL is:', + 'error_user_agent' => 'User agent:', + 'error_stacktrace' => 'The full stacktrace is below. If you think this is a bug in Firefly III, you can forward this message to :email. This can help fix the bug you just encountered.', + 'error_github' => 'If you prefer, you can also open a new issue on :link.', + 'error_stacktrace_below' => 'The full stacktrace is below:' +]; diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php index 6b7cf41cb0..d0c7de9560 100644 --- a/resources/lang/en_US/firefly.php +++ b/resources/lang/en_US/firefly.php @@ -1621,15 +1621,6 @@ return [ 'box_net_worth_in_currency' => 'Net worth (:currency)', 'box_spend_per_day' => 'Left to spend per day: :amount', - // emails - 'email_greeting' => 'Hi there,', - 'email_closing' => 'Beep boop,', - 'email_signature' => 'The Firefly III Mail Robot', - 'email_footer_ps' => 'PS: This message was sent because a request from IP :ip:userIp:ipAddress triggered it.', - - 'email_admin_test_subject' => 'A test message from your Firefly III installation', - 'email_admin_test_body' => 'This is a test message from your Firefly III instance. It was sent to :email.', - // telemetry 'telemetry_admin_index' => 'Telemetry', 'telemetry_intro' => 'Firefly III supports the collection and sending of usage telemetry. This means that Firefly III will try to collect info on how you use Firefly III, and send it to the developer of Firefly III. This is always opt-in, and is disabled by default. Firefly III will never collect or send financial information. Firefly III will also never collect or send financial meta-information, like sums or calculations. The collected data will never be made publicly accessible.', diff --git a/resources/views/v1/emails/access-token-created-html.twig b/resources/views/v1/emails/access-token-created-html.twig index 1c88099a1d..f7396395e5 100644 --- a/resources/views/v1/emails/access-token-created-html.twig +++ b/resources/views/v1/emails/access-token-created-html.twig @@ -1,13 +1,13 @@ {% include 'emails.header-html' %}

- Somebody (hopefully you) just created a new Firefly III API Access Token for your user account. + {{ trans('email.access_token_created_body_1')}}

- With this token, they can access all of your financial records through the Firefly III API. + {{ trans('email.access_token_created_body_2_html')|raw }}

- If this wasn't you, please revoke this token as soon as possible at {{ route('profile.index') }}. + {{ trans('email.access_token_created_body_3', {url: route('profile.index') })}}

{% include 'emails.footer-html' %} diff --git a/resources/views/v1/emails/access-token-created-text.twig b/resources/views/v1/emails/access-token-created-text.twig index 5ea41eb0fe..1900ef3a3a 100644 --- a/resources/views/v1/emails/access-token-created-text.twig +++ b/resources/views/v1/emails/access-token-created-text.twig @@ -1,7 +1,7 @@ {% include 'emails.header-text' %} -Somebody (hopefully you) just created a new Firefly III API Access Token for your user account. +{{ trans('email.access_token_created_body_1')}} -With this token, they can access all of your financial records through the Firefly III API. +{{ trans('email.access_token_created_body_2_text')}} -If this wasn't you, please revoke this token as soon as possible at {{ route('profile.index') }}. +{{ trans('email.access_token_created_body_3', {url: route('profile.index') })}} {% include 'emails.footer-text' %} diff --git a/resources/views/v1/emails/admin-test-html.twig b/resources/views/v1/emails/admin-test-html.twig index 30ef2cacdf..6d343085b8 100644 --- a/resources/views/v1/emails/admin-test-html.twig +++ b/resources/views/v1/emails/admin-test-html.twig @@ -1,5 +1,5 @@ {% include 'emails.header-html' %}

- {{ trans('firefly.email_admin_test_body', {email: email })}} + {{ trans('email.admin_test_body', {email: email })}}

{% include 'emails.footer-html' %} diff --git a/resources/views/v1/emails/admin-test-text.twig b/resources/views/v1/emails/admin-test-text.twig index dd2799b575..382b73ff7a 100644 --- a/resources/views/v1/emails/admin-test-text.twig +++ b/resources/views/v1/emails/admin-test-text.twig @@ -1,3 +1,3 @@ {% include 'emails.header-text' %} - {{ trans('firefly.email_admin_test_body', {email: email })}} + {{ trans('email.admin_test_body', {email: email })}} {% include 'emails.footer-text' %} diff --git a/resources/views/v1/emails/confirm-email-change-html.twig b/resources/views/v1/emails/confirm-email-change-html.twig index 0a5091e505..cc494344f2 100644 --- a/resources/views/v1/emails/confirm-email-change-html.twig +++ b/resources/views/v1/emails/confirm-email-change-html.twig @@ -1,15 +1,15 @@ {% include 'emails.header-html' %}

- You or somebody with access to your Firefly III account has changed your email address. If you did not expect this message, please ignore and delete it. + {{ trans('email.email_change_body_to_new')}}

- The old email address was: {{ oldEmail }} + {{trans('email.email_change_old')}} {{ oldEmail }}

- The new email address is: {{ newEmail }} + {{trans('email.email_change_new')}} {{ newEmail }}

- You cannot use Firefly III until you confirm this change. Please follow the link below to do so. + {{ trans('email.email_change_instructions')}}

diff --git a/resources/views/v1/emails/confirm-email-change-text.twig b/resources/views/v1/emails/confirm-email-change-text.twig index c2ddf3600a..dc67f2bced 100644 --- a/resources/views/v1/emails/confirm-email-change-text.twig +++ b/resources/views/v1/emails/confirm-email-change-text.twig @@ -1,9 +1,10 @@ {% include 'emails.header-text' %} -You or somebody with access to your Firefly III account has changed your email address. If you did not expect this message, please ignore and delete it. +{{ trans('email.email_change_body_to_new')}} -The old email address was: {{ oldEmail }} +{{trans('email.email_change_old')}} {{ oldEmail }} -The new email address is: {{ newEmail }} +{{trans('email.email_change_new')}} {{ newEmail }} -You cannot use Firefly III until you confirm this change. Please follow the link to do so: {{ uri }} +{{ trans('email.email_change_instructions')}} +{{ uri }} {% include 'emails.footer-text' %} diff --git a/resources/views/v1/emails/error-html.twig b/resources/views/v1/emails/error-html.twig index 2017bad70a..5219b6b4f9 100644 --- a/resources/views/v1/emails/error-html.twig +++ b/resources/views/v1/emails/error-html.twig @@ -1,46 +1,44 @@ {% include 'emails.header-html' %}

- Firefly III v{{ version }} ran into an error: {{ errorMessage }} + {{ trans('email.error_intro_html', { version: version, errorMessage: errorMessage })|raw }}

- The error was of type "{{ class }}". + {{ trans('email.error_type', {class: class }) }}

- The error occurred on/at: {{ time }}. + {{ trans('email.error_timestamp', {time: time }) }} +

- This error occurred in file {{ file }} on line {{ line }} with code {{ code }}. + {{ trans('email.error_location_html', { file: file, line: line, code: code })|raw }}

{% if loggedIn %} - The error was encountered by user #{{ user.id }}, {{ user.email }}. + {{ trans('email.error_user_html', { id: user.id, email: user.email })|raw }} {% else %} - There was no user logged in for this error or no user was detected. + {{ trans('email.error_no_user') }} {% endif %}

- The IP address related to this error is: {{ ip }}
- URL is: {{ url }}
- User agent: {{ userAgent }} + {{ trans('email.error_ip') }} {{ ip }}
+ {{ trans('email.error_url') }} {{ url }}
+ {{ trans('email.error_user_agent') }} {{ userAgent }}

- The full stacktrace is below. If you think this is a bug in Firefly III, you - can forward this message to - james@firefly-iii.org. - This can help fix the bug you just encountered. + {{ trans('email.error_stacktrace', { email: 'james@firefly-iii.org' })|raw }}

- If you prefer, you can also open a new issue on GitHub. + {{ trans('email.error_github', { link: 'GitHub' })|raw }}

- The full stacktrace is below:

+ {{ trans('email.error_stacktrace_below') }}

{{ stackTrace|nl2br }}

diff --git a/resources/views/v1/emails/footer-html.twig b/resources/views/v1/emails/footer-html.twig index ed426326d4..a5caad932a 100644 --- a/resources/views/v1/emails/footer-html.twig +++ b/resources/views/v1/emails/footer-html.twig @@ -1,12 +1,12 @@

- {{ trans('firefly.email_closing') }} + {{ trans('email.closing') }}

- {{ trans('firefly.email_signature') }} + {{ trans('email.signature') }}

- {{ trans('firefly.email_footer_ps', {ip: ip, userIp: userIp, ipAddress: ipAddress}) }} + {{ trans('email.footer_ps', {ipAddress: ipAddress}) }}

diff --git a/resources/views/v1/emails/footer-text.twig b/resources/views/v1/emails/footer-text.twig index 321902a6b4..b60f0beef0 100644 --- a/resources/views/v1/emails/footer-text.twig +++ b/resources/views/v1/emails/footer-text.twig @@ -1,6 +1,6 @@ -{{ trans('firefly.email_closing') }} +{{ trans('email.closing') }} -{{ trans('firefly.email_signature') }} +{{ trans('email.signature') }} -{{ trans('firefly.email_footer_ps', {ip: ip, userIp: userIp, ipAddress: ipAddress}) }} +{{ trans('email.footer_ps', {ipAddress: ipAddress}) }} diff --git a/resources/views/v1/emails/header-html.twig b/resources/views/v1/emails/header-html.twig index a6e8ac4475..d4e89e3255 100644 --- a/resources/views/v1/emails/header-html.twig +++ b/resources/views/v1/emails/header-html.twig @@ -6,5 +6,5 @@

- {{ trans('firefly.email_greeting') }} + {{ trans('email.greeting') }}

diff --git a/resources/views/v1/emails/header-text.twig b/resources/views/v1/emails/header-text.twig index 3ea6e074da..fedf86d341 100644 --- a/resources/views/v1/emails/header-text.twig +++ b/resources/views/v1/emails/header-text.twig @@ -1 +1 @@ -{{ trans('firefly.email_greeting') }} +{{ trans('email.greeting') }} diff --git a/resources/views/v1/emails/oauth-client-created-html.twig b/resources/views/v1/emails/oauth-client-created-html.twig index f49cd54b34..ba0db45dfa 100644 --- a/resources/views/v1/emails/oauth-client-created-html.twig +++ b/resources/views/v1/emails/oauth-client-created-html.twig @@ -1,14 +1,13 @@ {% include 'emails.header-html' %}

- Somebody (hopefully you) just created a new Firefly III API OAuth Client for your user account. It's labeled "{{ client.name }}" - and has callback URL {{ client.redirect }}. + {{ trans('email.oauth_created_body_html', { name:client.name, url:client.redirect})|raw }}

- With this client, they can access all of your financial records through the Firefly III API. + {{ trans('email.oauth_created_explanation_html')|raw }}

- If this wasn't you, please revoke this client as soon as possible at {{ route('profile.index') }}. + {{ trans('email.oauth_created_undo', { url:route('profile.index')}) }}

{% include 'emails.footer-html' %} diff --git a/resources/views/v1/emails/oauth-client-created-text.twig b/resources/views/v1/emails/oauth-client-created-text.twig index d74222d0f4..a9761889e2 100644 --- a/resources/views/v1/emails/oauth-client-created-text.twig +++ b/resources/views/v1/emails/oauth-client-created-text.twig @@ -1,9 +1,9 @@ {% include 'emails.header-text' %} -Somebody (hopefully you) just created a new Firefly III API OAuth Client for your user account. It's labeled "{{ client.name }}" and has callback URL: +{{ trans('email.oauth_created_body_text', {name: client.name }) }} {{ client.redirect }} -With this client, they can access all of your financial records through the Firefly III API. +{{ trans('email.oauth_created_explanation_text') }} -If this wasn't you, please revoke this client as soon as possible at {{ route('profile.index') }}. +{{ trans('email.oauth_created_undo') }} {% include 'emails.footer-text' %} diff --git a/resources/views/v1/emails/password-html.twig b/resources/views/v1/emails/password-html.twig index 2b15f16191..28c07eacd2 100644 --- a/resources/views/v1/emails/password-html.twig +++ b/resources/views/v1/emails/password-html.twig @@ -1,10 +1,10 @@ {% include 'emails.header-html' %}

- Somebody tried to reset your password. If it was you, please follow the link below to do so. + {{ trans('email.reset_pw_instructions') }}

- PLEASE verify that the link actually goes to the Firefly III you expect it to go! + {{ trans('email.reset_pw_warning_html')|raw }}

diff --git a/resources/views/v1/emails/password-text.twig b/resources/views/v1/emails/password-text.twig index 0e67dd735b..e3c33e8ec5 100644 --- a/resources/views/v1/emails/password-text.twig +++ b/resources/views/v1/emails/password-text.twig @@ -1,7 +1,7 @@ {% include 'emails.header-text' %} -Somebody tried to reset your password. If it was you, please follow the link below to do so. +{{ trans('email.reset_pw_instructions') }} -PLEASE verify that the link actually goes to the Firefly III you expect it to go! +{{ trans('email.reset_pw_warning_text') }} {{ url }} {% include 'emails.footer-text' %} diff --git a/resources/views/v1/emails/registered-html.twig b/resources/views/v1/emails/registered-html.twig index 3c9ee2460d..3bd9b14dcd 100644 --- a/resources/views/v1/emails/registered-html.twig +++ b/resources/views/v1/emails/registered-html.twig @@ -1,18 +1,20 @@ {% include 'emails.header-html' %}

- Welcome to Firefly III. Your registration has made it, and this email is here to confirm it. Yay! + {{ trans('email.registered_welcome_html', {address: address})|raw }}

+

+ {{ trans('email.registered_closing')}} +

{% include 'emails.footer-html' %} diff --git a/resources/views/v1/emails/registered-text.twig b/resources/views/v1/emails/registered-text.twig index bbfbca6953..a9b432f2e9 100644 --- a/resources/views/v1/emails/registered-text.twig +++ b/resources/views/v1/emails/registered-text.twig @@ -1,19 +1,19 @@ {% include 'emails.header-text' %} -Welcome to Firefly III. Your registration has made it, and this email is here to confirm it. Yay! +{{ trans('email.registered_welcome_text')}} -* If you have forgotten your password already, please reset it using the password reset tool. -* There is a help-icon in the top right corner of each page. If you need help, click it! -* If you haven't already, please read the first use guide and the full description. +* {{ trans('email.registered_pw_text')}} +* {{ trans('email.registered_help')}} +* {{ trans('email.registered_doc_text')}} -Enjoy! +{{ trans('email.registered_closing')}} -Firefly III: +{{ trans('email.registered_firefly_iii_link')}} {{ address }} -Password reset: +{{ trans('email.registered_pw_reset_link')}} {{ address }}/password/reset -Documentation: +{{ trans('email.registered_doc_link')}} https://github.com/firefly-iii/firefly-iii https://firefly-iii.org/ diff --git a/resources/views/v1/emails/undo-email-change-html.twig b/resources/views/v1/emails/undo-email-change-html.twig index 4f849ccc19..ce9133d24e 100644 --- a/resources/views/v1/emails/undo-email-change-html.twig +++ b/resources/views/v1/emails/undo-email-change-html.twig @@ -1,18 +1,17 @@ {% include 'emails.header-html' %}

- You or somebody with access to your Firefly III account has changed your email address. - If you did not expect this to happen, you must follow the "undo"-link below to protect your account! + {{ trans('email.email_change_body_to_old_html')|raw }}

- If you initiated this change, you may safely ignore this message. + {{ trans('email.email_change_ignore') }}

- The old email address was: {{ oldEmail }} + {{trans('email.email_change_old')}} {{ oldEmail }}

- The new email address is: {{ newEmail }} + {{trans('email.email_change_new')}} {{ newEmail }}

- To undo the change, follow this link: {{ uri }} + {{trans('email.email_change_undo_link')}} {{ uri }}

{% include 'emails.footer-html' %} diff --git a/resources/views/v1/emails/undo-email-change-text.twig b/resources/views/v1/emails/undo-email-change-text.twig index 1ef2042ba4..7229e870b9 100644 --- a/resources/views/v1/emails/undo-email-change-text.twig +++ b/resources/views/v1/emails/undo-email-change-text.twig @@ -1,12 +1,11 @@ {% include 'emails.header-text' %} -You or somebody with access to your Firefly III account has changed your email address. If you did not expect this to happen, -you must follow the "undo"-link below to protect your account! +{{ trans('email.email_change_body_to_old_text')}} -If you initiated this change, you may safely ignore this message. +{{ trans('email.email_change_ignore')}} -The old email address was: {{ oldEmail }} +{{trans('email.email_change_old')}} {{ oldEmail }} -The new email address is: {{ newEmail }} +{{trans('email.email_change_new')}} {{ newEmail }} -To undo the change, follow this link: {{ uri }} +{{ trans('email.email_change_undo_link')}} {{ uri }} {% include 'emails.footer-text' %} From 351c0ee2d7e609eced7672fdd2e68f6aa90f845f Mon Sep 17 00:00:00 2001 From: Florian Dupret Date: Tue, 26 May 2020 12:01:39 +0200 Subject: [PATCH 3/5] Email notifications are now translatable --- app/Mail/ReportNewJournalsMail.php | 2 +- resources/lang/en_US/email.php | 28 ++++++++++--------- .../v1/emails/access-token-created-html.twig | 6 ++-- .../v1/emails/access-token-created-text.twig | 6 ++-- .../views/v1/emails/admin-test-text.twig | 2 +- .../v1/emails/confirm-email-change-text.twig | 8 +++--- resources/views/v1/emails/error-html.twig | 8 +++--- resources/views/v1/emails/error-text.twig | 28 ++++++++----------- resources/views/v1/emails/footer-text.twig | 6 ++-- resources/views/v1/emails/header-text.twig | 3 +- .../v1/emails/oauth-client-created-html.twig | 2 +- .../v1/emails/oauth-client-created-text.twig | 8 ++---- resources/views/v1/emails/password-text.twig | 4 +-- .../views/v1/emails/registered-text.twig | 15 +++++----- .../v1/emails/report-new-journals-html.twig | 7 +---- .../v1/emails/report-new-journals-text.twig | 3 +- .../v1/emails/undo-email-change-text.twig | 10 +++---- 17 files changed, 69 insertions(+), 77 deletions(-) diff --git a/app/Mail/ReportNewJournalsMail.php b/app/Mail/ReportNewJournalsMail.php index 26da94db1d..14d687b894 100644 --- a/app/Mail/ReportNewJournalsMail.php +++ b/app/Mail/ReportNewJournalsMail.php @@ -79,7 +79,7 @@ class ReportNewJournalsMail extends Mailable $this->transform(); return $this->view('emails.report-new-journals-html')->text('emails.report-new-journals-text') - ->subject($subject); + ->subject(trans_choice('email.new_journals_subject', $this->groups->count() )); } private function transform(): void diff --git a/resources/lang/en_US/email.php b/resources/lang/en_US/email.php index f0aef757c3..add1b6cbad 100644 --- a/resources/lang/en_US/email.php +++ b/resources/lang/en_US/email.php @@ -35,10 +35,10 @@ return [ // access token created 'access_token_created_subject' => 'A new access token was created', - 'access_token_created_body_1' => 'Somebody (hopefully you) just created a new Firefly III API Access Token for your user account.', - 'access_token_created_body_2_html' => 'With this token, they can access all of your financial records through the Firefly III API.', - 'access_token_created_body_2_text' => 'With this token, they can access *all* of your financial records through the Firefly III API.', - 'access_token_created_body_3' => 'If this wasn\'t you, please revoke this token as soon as possible at :url.', + 'access_token_created_body' => 'Somebody (hopefully you) just created a new Firefly III API Access Token for your user account.', + 'access_token_created_explanation_html' => 'With this token, they can access all of your financial records through the Firefly III API.', + 'access_token_created_explanation_text' => 'With this token, they can access *all* of your financial records through the Firefly III API.', + 'access_token_created_revoke' => 'If this wasn\'t you, please revoke this token as soon as possible at :url.', // registered 'registered_subject' => 'Welcome to Firefly III!', @@ -59,8 +59,7 @@ return [ 'email_change_body_to_new' => 'You or somebody with access to your Firefly III account has changed your email address. If you did not expect this message, please ignore and delete it.', 'email_change_body_to_old_html' => 'You or somebody with access to your Firefly III account has changed your email address. If you did not expect this to happen, you must follow the "undo"-link below to protect your account!', - 'email_change_body_to_old_text' => 'You or somebody with access to your Firefly III account has changed your email address. If you did not expect this to happen, - you must follow the "undo"-link below to protect your account!', + 'email_change_body_to_old_text' => 'You or somebody with access to your Firefly III account has changed your email address. If you did not expect this to happen, you *must* follow the "undo"-link below to protect your account!', 'email_change_ignore' => 'If you initiated this change, you may safely ignore this message.', 'email_change_old' => 'The old email address was:', 'email_change_new' => 'The new email address is:', @@ -69,8 +68,7 @@ return [ // OAuth token created 'oauth_created_subject' => 'A new OAuth client has been created', - 'oauth_created_body_html' => 'Somebody (hopefully you) just created a new Firefly III API OAuth Client for your user account. It\'s labeled ":name" and has callback URL :url.', - 'oauth_created_body_text' => 'Somebody (hopefully you) just created a new Firefly III API OAuth Client for your user account. It\'s labeled ":name" and has callback URL:', + 'oauth_created_body' => 'Somebody (hopefully you) just created a new Firefly III API OAuth Client for your user account. It\'s labeled ":name" and has callback URL :url.', 'oauth_created_explanation_html' => 'With this client, they can access all of your financial records through the Firefly III API.', 'oauth_created_explanation_text' => 'With this client, they can access *all* of your financial records through the Firefly III API.', 'oauth_created_undo' => 'If this wasn\'t you, please revoke this client as soon as possible at :url.', @@ -83,16 +81,20 @@ return [ // error 'error_subject' => 'Caught an error in Firefly III', - 'error_intro_html' => 'Firefly III v:version ran into an error: :errorMessage', + 'error_intro' => 'Firefly III v:version ran into an error:', 'error_type' => 'The error was of type ":class".', 'error_timestamp' => 'The error occurred on/at: :time.', - 'error_location_html' => 'This error occurred in file :file on line :line with code :code.', - 'error_user_html' => 'The error was encountered by user #:id, :email.', + 'error_location' => 'This error occurred in file ":file" on line :line with code :code.', + 'error_user' => 'The error was encountered by user #:id, :email.', 'error_no_user' => 'There was no user logged in for this error or no user was detected.', 'error_ip' => 'The IP address related to this error is:', 'error_url' => 'URL is:', 'error_user_agent' => 'User agent:', - 'error_stacktrace' => 'The full stacktrace is below. If you think this is a bug in Firefly III, you can forward this message to :email. This can help fix the bug you just encountered.', + 'error_stacktrace' => 'The full stacktrace is below. If you think this is a bug in Firefly III, you can forward this message to :email. This can help fix the bug you just encountered.', 'error_github' => 'If you prefer, you can also open a new issue on :link.', - 'error_stacktrace_below' => 'The full stacktrace is below:' + 'error_stacktrace_below' => 'The full stacktrace is below:', + + // report new journals + 'new_journals_subject' => 'Firefly III has created a new transaction|Firefly III has created :count new transactions', + 'new_journals_header' => 'Firefly III has created a transaction for you. You can find it in your Firefly III installation:|Firefly III has created :count transactions for you. You can find them in your Firefly III installation:' ]; diff --git a/resources/views/v1/emails/access-token-created-html.twig b/resources/views/v1/emails/access-token-created-html.twig index f7396395e5..d20aecd79e 100644 --- a/resources/views/v1/emails/access-token-created-html.twig +++ b/resources/views/v1/emails/access-token-created-html.twig @@ -1,13 +1,13 @@ {% include 'emails.header-html' %}

- {{ trans('email.access_token_created_body_1')}} + {{ trans('email.access_token_created_body')}}

- {{ trans('email.access_token_created_body_2_html')|raw }} + {{ trans('email.access_token_created_explanation_html')|raw }}

- {{ trans('email.access_token_created_body_3', {url: route('profile.index') })}} + {{ trans('email.access_token_created_revoke', {url: route('profile.index') })}}

{% include 'emails.footer-html' %} diff --git a/resources/views/v1/emails/access-token-created-text.twig b/resources/views/v1/emails/access-token-created-text.twig index 1900ef3a3a..ccb5b37408 100644 --- a/resources/views/v1/emails/access-token-created-text.twig +++ b/resources/views/v1/emails/access-token-created-text.twig @@ -1,7 +1,7 @@ {% include 'emails.header-text' %} -{{ trans('email.access_token_created_body_1')}} +{{ trans('email.access_token_created_body')|raw }} -{{ trans('email.access_token_created_body_2_text')}} +{{ trans('email.access_token_created_explanation_text')|raw }} -{{ trans('email.access_token_created_body_3', {url: route('profile.index') })}} +{{ trans('email.access_token_created_revoke', {url: route('profile.index') })|raw }} {% include 'emails.footer-text' %} diff --git a/resources/views/v1/emails/admin-test-text.twig b/resources/views/v1/emails/admin-test-text.twig index 382b73ff7a..e6c5aca702 100644 --- a/resources/views/v1/emails/admin-test-text.twig +++ b/resources/views/v1/emails/admin-test-text.twig @@ -1,3 +1,3 @@ {% include 'emails.header-text' %} - {{ trans('email.admin_test_body', {email: email })}} +{{ trans('email.admin_test_body', {email: email })|raw }} {% include 'emails.footer-text' %} diff --git a/resources/views/v1/emails/confirm-email-change-text.twig b/resources/views/v1/emails/confirm-email-change-text.twig index dc67f2bced..7392c89a99 100644 --- a/resources/views/v1/emails/confirm-email-change-text.twig +++ b/resources/views/v1/emails/confirm-email-change-text.twig @@ -1,10 +1,10 @@ {% include 'emails.header-text' %} -{{ trans('email.email_change_body_to_new')}} +{{ trans('email.email_change_body_to_new')|raw }} -{{trans('email.email_change_old')}} {{ oldEmail }} +{{trans('email.email_change_old')|raw }} {{ oldEmail }} -{{trans('email.email_change_new')}} {{ newEmail }} +{{trans('email.email_change_new')|raw }} {{ newEmail }} -{{ trans('email.email_change_instructions')}} +{{ trans('email.email_change_instructions')|raw }} {{ uri }} {% include 'emails.footer-text' %} diff --git a/resources/views/v1/emails/error-html.twig b/resources/views/v1/emails/error-html.twig index 5219b6b4f9..792f1caba0 100644 --- a/resources/views/v1/emails/error-html.twig +++ b/resources/views/v1/emails/error-html.twig @@ -1,6 +1,6 @@ {% include 'emails.header-html' %}

- {{ trans('email.error_intro_html', { version: version, errorMessage: errorMessage })|raw }} + {{ trans('email.error_intro', { version: version }) }} {{ errorMessage }}.

@@ -13,12 +13,12 @@

- {{ trans('email.error_location_html', { file: file, line: line, code: code })|raw }} + {{ trans('email.error_location', { file: "#{ file }", line: line, code: code })|raw }}

{% if loggedIn %} - {{ trans('email.error_user_html', { id: user.id, email: user.email })|raw }} + {{ trans('email.error_user', { id: user.id, email: "#{ user.email }" })|raw }} {% else %} {{ trans('email.error_no_user') }} {% endif %} @@ -26,7 +26,7 @@

{{ trans('email.error_ip') }} {{ ip }}
- {{ trans('email.error_url') }} {{ url }}
+ {{ trans('email.error_url') }} {{ url }}
{{ trans('email.error_user_agent') }} {{ userAgent }}

diff --git a/resources/views/v1/emails/error-text.twig b/resources/views/v1/emails/error-text.twig index 18df8c3696..83c11026f8 100644 --- a/resources/views/v1/emails/error-text.twig +++ b/resources/views/v1/emails/error-text.twig @@ -1,31 +1,27 @@ {% include 'emails.header-text' %} -Firefly III v{{ version }} ran into an error: {{ errorMessage }}. +{{ trans('email.error_intro', { version: version })|raw }} {{ errorMessage }}. -The error was of type "{{ class }}". +{{ trans('email.error_type', {class: class })|raw }} -The error occurred on/at: {{ time }}. +{{ trans('email.error_timestamp', {time: time })|raw }} -This error occurred in file "{{ file }}" on line {{ line }} with code {{ code }}. +{{ trans('email.error_location', { file: file , line: line, code: code })|raw }} {% if loggedIn %} - The error was encountered by user #{{ user.id }}, {{ user.email }}. +{{ trans('email.error_user', { id: user.id, email: user.email })|raw }} {% else %} - There was no user logged in for this error or no user was detected. +{{ trans('email.error_no_user')|raw }} {% endif %} -The IP address related to this error is: {{ ip }} -URL is: {{ url }} -User agent: {{ userAgent }} +{{ trans('email.error_ip')|raw }} {{ ip }} +{{ trans('email.error_url')|raw }} {{ url }} +{{ trans('email.error_user_agent')|raw }} {{ userAgent }} -The full stacktrace is below. If you think this is a bug in Firefly III, you -can forward this message to james@firefly-iii.org. This can help fix -the bug you just encountered. +{{ trans('email.error_stacktrace', { email: 'james@firefly-iii.org' })|raw }} -If you prefer, you can also open a new issue here: +{{ trans('email.error_github', { link: 'https://github.com/firefly-iii/firefly-iii/issues' })|raw }} -https://github.com/firefly-iii/firefly-iii/issues - -The full stacktrace is below: +{{ trans('email.error_stacktrace_below')|raw }} {{ stackTrace }} {% include 'emails.footer-text' %} diff --git a/resources/views/v1/emails/footer-text.twig b/resources/views/v1/emails/footer-text.twig index b60f0beef0..54a6c6b68d 100644 --- a/resources/views/v1/emails/footer-text.twig +++ b/resources/views/v1/emails/footer-text.twig @@ -1,6 +1,6 @@ -{{ trans('email.closing') }} +{{ trans('email.closing')|raw }} -{{ trans('email.signature') }} +{{ trans('email.signature')|raw }} -{{ trans('email.footer_ps', {ipAddress: ipAddress}) }} +{{ trans('email.footer_ps', {ipAddress: ipAddress})|raw }} diff --git a/resources/views/v1/emails/header-text.twig b/resources/views/v1/emails/header-text.twig index fedf86d341..16cd8490c4 100644 --- a/resources/views/v1/emails/header-text.twig +++ b/resources/views/v1/emails/header-text.twig @@ -1 +1,2 @@ -{{ trans('email.greeting') }} +{{ trans('email.greeting')|raw }} + diff --git a/resources/views/v1/emails/oauth-client-created-html.twig b/resources/views/v1/emails/oauth-client-created-html.twig index ba0db45dfa..9be04c0e1b 100644 --- a/resources/views/v1/emails/oauth-client-created-html.twig +++ b/resources/views/v1/emails/oauth-client-created-html.twig @@ -1,6 +1,6 @@ {% include 'emails.header-html' %}

- {{ trans('email.oauth_created_body_html', { name:client.name, url:client.redirect})|raw }} + {{ trans('email.oauth_created_body', { name:client.name, url: "" ~ client.redirect ~ ""})|raw }}

diff --git a/resources/views/v1/emails/oauth-client-created-text.twig b/resources/views/v1/emails/oauth-client-created-text.twig index a9761889e2..4edf653de8 100644 --- a/resources/views/v1/emails/oauth-client-created-text.twig +++ b/resources/views/v1/emails/oauth-client-created-text.twig @@ -1,9 +1,7 @@ {% include 'emails.header-text' %} -{{ trans('email.oauth_created_body_text', {name: client.name }) }} +{{ trans('email.oauth_created_body', {name: client.name, url: client.redirect })|raw }} -{{ client.redirect }} +{{ trans('email.oauth_created_explanation_text')|raw }} -{{ trans('email.oauth_created_explanation_text') }} - -{{ trans('email.oauth_created_undo') }} +{{ trans('email.oauth_created_undo', { url:route('profile.index')})|raw }} {% include 'emails.footer-text' %} diff --git a/resources/views/v1/emails/password-text.twig b/resources/views/v1/emails/password-text.twig index e3c33e8ec5..d184d5cf94 100644 --- a/resources/views/v1/emails/password-text.twig +++ b/resources/views/v1/emails/password-text.twig @@ -1,7 +1,7 @@ {% include 'emails.header-text' %} -{{ trans('email.reset_pw_instructions') }} +{{ trans('email.reset_pw_instructions')|raw }} -{{ trans('email.reset_pw_warning_text') }} +{{ trans('email.reset_pw_warning_text')|raw }} {{ url }} {% include 'emails.footer-text' %} diff --git a/resources/views/v1/emails/registered-text.twig b/resources/views/v1/emails/registered-text.twig index a9b432f2e9..16ce44415f 100644 --- a/resources/views/v1/emails/registered-text.twig +++ b/resources/views/v1/emails/registered-text.twig @@ -1,16 +1,17 @@ {% include 'emails.header-text' %} -{{ trans('email.registered_welcome_text')}} -* {{ trans('email.registered_pw_text')}} -* {{ trans('email.registered_help')}} -* {{ trans('email.registered_doc_text')}} +{{ trans('email.registered_welcome_text')|raw }} -{{ trans('email.registered_closing')}} +* {{ trans('email.registered_pw_text')|raw }} +* {{ trans('email.registered_help')|raw }} +* {{ trans('email.registered_doc_text')|raw }} -{{ trans('email.registered_firefly_iii_link')}} +{{ trans('email.registered_closing')|raw }} + +{{ trans('email.registered_firefly_iii_link')|raw }} {{ address }} -{{ trans('email.registered_pw_reset_link')}} +{{ trans('email.registered_pw_reset_link')|raw }} {{ address }}/password/reset {{ trans('email.registered_doc_link')}} diff --git a/resources/views/v1/emails/report-new-journals-html.twig b/resources/views/v1/emails/report-new-journals-html.twig index 66ec31b09e..c4414ae4ed 100644 --- a/resources/views/v1/emails/report-new-journals-html.twig +++ b/resources/views/v1/emails/report-new-journals-html.twig @@ -1,11 +1,6 @@ {% include 'emails.header-html' %}

- {% if transformed|length == 1 %} - Firefly III has created a transaction for you. You can find it in your Firefly III installation: - {% endif %} - {% if transformed|length > 1 %} - Firefly III has created {{ groups.count }} transactions for you. You can find them in your Firefly III installation: - {% endif %} + {{ trans_choice('email.new_journals_header', transformed|length ) }}

diff --git a/resources/views/v1/emails/report-new-journals-text.twig b/resources/views/v1/emails/report-new-journals-text.twig index b5e45c15bc..fe6455141c 100644 --- a/resources/views/v1/emails/report-new-journals-text.twig +++ b/resources/views/v1/emails/report-new-journals-text.twig @@ -1,6 +1,5 @@ {% include 'emails.header-text' %} -{% if transformed|length == 1 %}Firefly III has created a transaction for you. You can find it in your Firefly III installation:{% endif %} -{% if transformed|length > 1 %}Firefly III has created {{ groups.count }} transactions for you. You can find them in your Firefly III installation:{% endif %} +{{ trans_choice('email.new_journals_header', transformed|length )|raw }} {% for group in transformed %} diff --git a/resources/views/v1/emails/undo-email-change-text.twig b/resources/views/v1/emails/undo-email-change-text.twig index 7229e870b9..ea5eb0e84c 100644 --- a/resources/views/v1/emails/undo-email-change-text.twig +++ b/resources/views/v1/emails/undo-email-change-text.twig @@ -1,11 +1,11 @@ {% include 'emails.header-text' %} -{{ trans('email.email_change_body_to_old_text')}} +{{ trans('email.email_change_body_to_old_text')|raw }} -{{ trans('email.email_change_ignore')}} +{{ trans('email.email_change_ignore')|raw }} -{{trans('email.email_change_old')}} {{ oldEmail }} +{{trans('email.email_change_old')|raw }} {{ oldEmail }} -{{trans('email.email_change_new')}} {{ newEmail }} +{{trans('email.email_change_new')|raw }} {{ newEmail }} -{{ trans('email.email_change_undo_link')}} {{ uri }} +{{ trans('email.email_change_undo_link')|raw }} {{ uri }} {% include 'emails.footer-text' %} From 1771b3964e67636a780220cdfb397ba8ec097e7e Mon Sep 17 00:00:00 2001 From: Florian Dupret Date: Tue, 26 May 2020 18:50:48 +0200 Subject: [PATCH 4/5] Email view cleanup: confirm account is obsolete --- .../views/v1/emails/confirm-account-html.twig | 20 ------------------- .../views/v1/emails/confirm-account-text.twig | 11 ---------- 2 files changed, 31 deletions(-) delete mode 100644 resources/views/v1/emails/confirm-account-html.twig delete mode 100644 resources/views/v1/emails/confirm-account-text.twig diff --git a/resources/views/v1/emails/confirm-account-html.twig b/resources/views/v1/emails/confirm-account-html.twig deleted file mode 100644 index 9dacd4e6a5..0000000000 --- a/resources/views/v1/emails/confirm-account-html.twig +++ /dev/null @@ -1,20 +0,0 @@ -{% include 'emails.header-html' %} -

- To start using your brand new Firefly III account, you need to activate it. Activating your account allows the website to verify that this email address is - valid. Unfortunately, not even the most complex routines can work this out, without actually sending an email message. And here it is! -

- -

- To active your account please follow the link below. -

-

- PLEASE verify that this activation link goes to the Firefly III installation you expect it to be: -

-

- {{ route }} -

- -

- You should be redirected to the index page right away. The link expires in about four hours. -

-{% include 'emails.footer-html' %} diff --git a/resources/views/v1/emails/confirm-account-text.twig b/resources/views/v1/emails/confirm-account-text.twig deleted file mode 100644 index ca8f3a1e1b..0000000000 --- a/resources/views/v1/emails/confirm-account-text.twig +++ /dev/null @@ -1,11 +0,0 @@ -{% include 'emails.header-text' %} -To start using your brand new Firefly III account, you need to activate it. Activating your account allows the website to verify that this email address is valid. Unfortunately, not even the most complex routines can work this out, without actually sending an email message. And here it is! - -To active your account please follow the link below. - -PLEASE verify that this activation link goes to the Firefly III installation you expect it to be: - -{{ route }} - -You should be redirected to the index page right away. The link expires in about four hours. -{% include 'emails.footer-text' %} From 6c6bb2cd1e61e3980110d6c6a2c112f65f4cc014 Mon Sep 17 00:00:00 2001 From: Florian Dupret Date: Wed, 27 May 2020 09:34:52 +0200 Subject: [PATCH 5/5] Email translations cleanup --- resources/lang/en_US/email.php | 44 +++++++++---------- .../v1/emails/access-token-created-html.twig | 6 +-- .../v1/emails/access-token-created-text.twig | 4 +- .../v1/emails/confirm-email-change-html.twig | 4 +- .../v1/emails/confirm-email-change-text.twig | 4 +- resources/views/v1/emails/error-html.twig | 16 +++---- resources/views/v1/emails/error-text.twig | 18 ++++---- .../v1/emails/oauth-client-created-html.twig | 4 +- .../v1/emails/oauth-client-created-text.twig | 4 +- resources/views/v1/emails/password-html.twig | 2 +- resources/views/v1/emails/password-text.twig | 2 +- .../views/v1/emails/registered-html.twig | 4 +- .../views/v1/emails/registered-text.twig | 4 +- .../v1/emails/undo-email-change-html.twig | 6 +-- .../v1/emails/undo-email-change-text.twig | 6 +-- 15 files changed, 62 insertions(+), 66 deletions(-) diff --git a/resources/lang/en_US/email.php b/resources/lang/en_US/email.php index add1b6cbad..872c37cc00 100644 --- a/resources/lang/en_US/email.php +++ b/resources/lang/en_US/email.php @@ -36,16 +36,13 @@ return [ // access token created 'access_token_created_subject' => 'A new access token was created', 'access_token_created_body' => 'Somebody (hopefully you) just created a new Firefly III API Access Token for your user account.', - 'access_token_created_explanation_html' => 'With this token, they can access all of your financial records through the Firefly III API.', - 'access_token_created_explanation_text' => 'With this token, they can access *all* of your financial records through the Firefly III API.', + 'access_token_created_explanation' => 'With this token, they can access all of your financial records through the Firefly III API.', 'access_token_created_revoke' => 'If this wasn\'t you, please revoke this token as soon as possible at :url.', // registered 'registered_subject' => 'Welcome to Firefly III!', - 'registered_welcome_html' => 'Welcome to Firefly III. Your registration has made it, and this email is here to confirm it. Yay!', - 'registered_welcome_text' => 'Welcome to Firefly III. Your registration has made it, and this email is here to confirm it. Yay!', - 'registered_pw_html' => 'If you have forgotten your password already, please reset it using the password reset tool.', - 'registered_pw_text' => 'If you have forgotten your password already, please reset it using the password reset tool.', + 'registered_welcome' => 'Welcome to Firefly III. Your registration has made it, and this email is here to confirm it. Yay!', + 'registered_pw' => 'If you have forgotten your password already, please reset it using the password reset tool.', 'registered_help' => 'There is a help-icon in the top right corner of each page. If you need help, click it!', 'registered_doc_html' => 'If you haven\'t already, please read the grand theory.', 'registered_doc_text' => 'If you haven\'t already, please read the first use guide and the full description.', @@ -57,41 +54,40 @@ return [ // email change 'email_change_subject' => 'Your Firefly III email address has changed', 'email_change_body_to_new' => 'You or somebody with access to your Firefly III account has changed your email address. If you did not expect this message, please ignore and delete it.', - 'email_change_body_to_old_html' => 'You or somebody with access to your Firefly III account has changed your email address. - If you did not expect this to happen, you must follow the "undo"-link below to protect your account!', - 'email_change_body_to_old_text' => 'You or somebody with access to your Firefly III account has changed your email address. If you did not expect this to happen, you *must* follow the "undo"-link below to protect your account!', + 'email_change_body_to_old' => 'You or somebody with access to your Firefly III account has changed your email address. If you did not expect this to happen, you must follow the "undo"-link below to protect your account!', 'email_change_ignore' => 'If you initiated this change, you may safely ignore this message.', - 'email_change_old' => 'The old email address was:', - 'email_change_new' => 'The new email address is:', + 'email_change_old' => 'The old email address was: :email', + 'email_change_old_strong' => 'The old email address was: :email', + 'email_change_new' => 'The new email address is: :email', + 'email_change_new_strong' => 'The new email address is: :email', 'email_change_instructions' => 'You cannot use Firefly III until you confirm this change. Please follow the link below to do so.', 'email_change_undo_link' => 'To undo the change, follow this link:', // OAuth token created 'oauth_created_subject' => 'A new OAuth client has been created', - 'oauth_created_body' => 'Somebody (hopefully you) just created a new Firefly III API OAuth Client for your user account. It\'s labeled ":name" and has callback URL :url.', - 'oauth_created_explanation_html' => 'With this client, they can access all of your financial records through the Firefly III API.', - 'oauth_created_explanation_text' => 'With this client, they can access *all* of your financial records through the Firefly III API.', + 'oauth_created_body' => 'Somebody (hopefully you) just created a new Firefly III API OAuth Client for your user account. It\'s labeled ":name" and has callback URL :url.', + 'oauth_created_explanation' => 'With this client, they can access all of your financial records through the Firefly III API.', 'oauth_created_undo' => 'If this wasn\'t you, please revoke this client as soon as possible at :url.', // reset password 'reset_pw_subject' => 'Your password reset request', 'reset_pw_instructions' => 'Somebody tried to reset your password. If it was you, please follow the link below to do so.', - 'reset_pw_warning_html' => 'PLEASE verify that the link actually goes to the Firefly III you expect it to go!', - 'reset_pw_warning_text' => '*PLEASE* verify that the link actually goes to the Firefly III you expect it to go!', + 'reset_pw_warning' => 'PLEASE verify that the link actually goes to the Firefly III you expect it to go!', // error 'error_subject' => 'Caught an error in Firefly III', - 'error_intro' => 'Firefly III v:version ran into an error:', + 'error_intro' => 'Firefly III v:version ran into an error: :errorMessage.', 'error_type' => 'The error was of type ":class".', 'error_timestamp' => 'The error occurred on/at: :time.', - 'error_location' => 'This error occurred in file ":file" on line :line with code :code.', - 'error_user' => 'The error was encountered by user #:id, :email.', + 'error_location' => 'This error occurred in file ":file" on line :line with code :code.', + 'error_user' => 'The error was encountered by user #:id, :email.', 'error_no_user' => 'There was no user logged in for this error or no user was detected.', - 'error_ip' => 'The IP address related to this error is:', - 'error_url' => 'URL is:', - 'error_user_agent' => 'User agent:', - 'error_stacktrace' => 'The full stacktrace is below. If you think this is a bug in Firefly III, you can forward this message to :email. This can help fix the bug you just encountered.', - 'error_github' => 'If you prefer, you can also open a new issue on :link.', + 'error_ip' => 'The IP address related to this error is: :ip', + 'error_url' => 'URL is: :url', + 'error_user_agent' => 'User agent: :userAgent', + 'error_stacktrace' => 'The full stacktrace is below. If you think this is a bug in Firefly III, you can forward this message to james@firefly-iii.org. This can help fix the bug you just encountered.', + 'error_github_html' => 'If you prefer, you can also open a new issue on GitHub.', + 'error_github_text' => 'If you prefer, you can also open a new issue on https://github.com/firefly-iii/firefly-iii/issues.', 'error_stacktrace_below' => 'The full stacktrace is below:', // report new journals diff --git a/resources/views/v1/emails/access-token-created-html.twig b/resources/views/v1/emails/access-token-created-html.twig index d20aecd79e..ede3a2f044 100644 --- a/resources/views/v1/emails/access-token-created-html.twig +++ b/resources/views/v1/emails/access-token-created-html.twig @@ -1,13 +1,13 @@ {% include 'emails.header-html' %}

- {{ trans('email.access_token_created_body')}} + {{ trans('email.access_token_created_body') }}

- {{ trans('email.access_token_created_explanation_html')|raw }} + {{ trans('email.access_token_created_explanation')|raw }}

- {{ trans('email.access_token_created_revoke', {url: route('profile.index') })}} + {{ trans('email.access_token_created_revoke', {url: route('profile.index') }) }}

{% include 'emails.footer-html' %} diff --git a/resources/views/v1/emails/access-token-created-text.twig b/resources/views/v1/emails/access-token-created-text.twig index ccb5b37408..04d85cdf35 100644 --- a/resources/views/v1/emails/access-token-created-text.twig +++ b/resources/views/v1/emails/access-token-created-text.twig @@ -1,7 +1,7 @@ {% include 'emails.header-text' %} -{{ trans('email.access_token_created_body')|raw }} +{{ trans('email.access_token_created_body')|raw }} -{{ trans('email.access_token_created_explanation_text')|raw }} +{{ trans('email.access_token_created_explanation')|striptags|raw }} {{ trans('email.access_token_created_revoke', {url: route('profile.index') })|raw }} {% include 'emails.footer-text' %} diff --git a/resources/views/v1/emails/confirm-email-change-html.twig b/resources/views/v1/emails/confirm-email-change-html.twig index cc494344f2..7eb907c421 100644 --- a/resources/views/v1/emails/confirm-email-change-html.twig +++ b/resources/views/v1/emails/confirm-email-change-html.twig @@ -3,10 +3,10 @@ {{ trans('email.email_change_body_to_new')}}

- {{trans('email.email_change_old')}} {{ oldEmail }} + {{trans('email.email_change_old', { email: oldEmail }) }}

- {{trans('email.email_change_new')}} {{ newEmail }} + {{trans('email.email_change_new_strong', { email: newEmail })|raw }}

{{ trans('email.email_change_instructions')}} diff --git a/resources/views/v1/emails/confirm-email-change-text.twig b/resources/views/v1/emails/confirm-email-change-text.twig index 7392c89a99..1fd8695814 100644 --- a/resources/views/v1/emails/confirm-email-change-text.twig +++ b/resources/views/v1/emails/confirm-email-change-text.twig @@ -1,9 +1,9 @@ {% include 'emails.header-text' %} {{ trans('email.email_change_body_to_new')|raw }} -{{trans('email.email_change_old')|raw }} {{ oldEmail }} +{{trans('email.email_change_old', { email: oldEmail })|raw }} -{{trans('email.email_change_new')|raw }} {{ newEmail }} +{{trans('email.email_change_new', { email: newEmail })|raw }} {{ trans('email.email_change_instructions')|raw }} {{ uri }} diff --git a/resources/views/v1/emails/error-html.twig b/resources/views/v1/emails/error-html.twig index 792f1caba0..d90bc67879 100644 --- a/resources/views/v1/emails/error-html.twig +++ b/resources/views/v1/emails/error-html.twig @@ -1,6 +1,6 @@ {% include 'emails.header-html' %}

- {{ trans('email.error_intro', { version: version }) }} {{ errorMessage }}. + {{ trans('email.error_intro', { version: version, errorMessage: errorMessage })|raw }}

@@ -13,28 +13,28 @@

- {{ trans('email.error_location', { file: "#{ file }", line: line, code: code })|raw }} + {{ trans('email.error_location', { file: file, line: line, code: code })|raw }}

{% if loggedIn %} - {{ trans('email.error_user', { id: user.id, email: "#{ user.email }" })|raw }} + {{ trans('email.error_user', { id: user.id, email: user.email })|raw }} {% else %} {{ trans('email.error_no_user') }} {% endif %}

- {{ trans('email.error_ip') }} {{ ip }}
- {{ trans('email.error_url') }} {{ url }}
- {{ trans('email.error_user_agent') }} {{ userAgent }} + {{ trans('email.error_ip', { ip: ip }) }}
+ {{ trans('email.error_url', {url :url }) }}
+ {{ trans('email.error_user_agent', {userAgent: userAgent }) }}

- {{ trans('email.error_stacktrace', { email: 'james@firefly-iii.org' })|raw }} + {{ trans('email.error_stacktrace')|raw }}

- {{ trans('email.error_github', { link: 'GitHub' })|raw }} + {{ trans('email.error_github_html')|raw }}

diff --git a/resources/views/v1/emails/error-text.twig b/resources/views/v1/emails/error-text.twig index 83c11026f8..35e4a46334 100644 --- a/resources/views/v1/emails/error-text.twig +++ b/resources/views/v1/emails/error-text.twig @@ -1,27 +1,27 @@ {% include 'emails.header-text' %} -{{ trans('email.error_intro', { version: version })|raw }} {{ errorMessage }}. +{{ trans('email.error_intro', { version: version, errorMessage: errorMessage })|striptags|raw }} {{ trans('email.error_type', {class: class })|raw }} {{ trans('email.error_timestamp', {time: time })|raw }} -{{ trans('email.error_location', { file: file , line: line, code: code })|raw }} +{{ trans('email.error_location', { file: file , line: line, code: code })|striptags|raw }} {% if loggedIn %} -{{ trans('email.error_user', { id: user.id, email: user.email })|raw }} +{{ trans('email.error_user', { id: user.id, email: user.email })|striptags|raw }} {% else %} {{ trans('email.error_no_user')|raw }} {% endif %} -{{ trans('email.error_ip')|raw }} {{ ip }} -{{ trans('email.error_url')|raw }} {{ url }} -{{ trans('email.error_user_agent')|raw }} {{ userAgent }} +{{ trans('email.error_ip', { ip: ip }) }} +{{ trans('email.error_url', {url :url}) }} +{{ trans('email.error_user_agent', {userAgent: userAgent } ) }} -{{ trans('email.error_stacktrace', { email: 'james@firefly-iii.org' })|raw }} +{{ trans('email.error_stacktrace')|striptags|raw }} -{{ trans('email.error_github', { link: 'https://github.com/firefly-iii/firefly-iii/issues' })|raw }} +{{ trans('email.error_github_text' )|raw }} {{ trans('email.error_stacktrace_below')|raw }} -{{ stackTrace }} +{{ stackTrace|raw }} {% include 'emails.footer-text' %} diff --git a/resources/views/v1/emails/oauth-client-created-html.twig b/resources/views/v1/emails/oauth-client-created-html.twig index 9be04c0e1b..03906957f1 100644 --- a/resources/views/v1/emails/oauth-client-created-html.twig +++ b/resources/views/v1/emails/oauth-client-created-html.twig @@ -1,10 +1,10 @@ {% include 'emails.header-html' %}

- {{ trans('email.oauth_created_body', { name:client.name, url: "" ~ client.redirect ~ ""})|raw }} + {{ trans('email.oauth_created_body', { name:client.name, url: client.redirect })|raw }}

- {{ trans('email.oauth_created_explanation_html')|raw }} + {{ trans('email.oauth_created_explanation')|raw }}

diff --git a/resources/views/v1/emails/oauth-client-created-text.twig b/resources/views/v1/emails/oauth-client-created-text.twig index 4edf653de8..566f2ad89b 100644 --- a/resources/views/v1/emails/oauth-client-created-text.twig +++ b/resources/views/v1/emails/oauth-client-created-text.twig @@ -1,7 +1,7 @@ {% include 'emails.header-text' %} -{{ trans('email.oauth_created_body', {name: client.name, url: client.redirect })|raw }} +{{ trans('email.oauth_created_body', {name: client.name, url: client.redirect })|striptags|raw }} -{{ trans('email.oauth_created_explanation_text')|raw }} +{{ trans('email.oauth_created_explanation')|striptags|raw }} {{ trans('email.oauth_created_undo', { url:route('profile.index')})|raw }} {% include 'emails.footer-text' %} diff --git a/resources/views/v1/emails/password-html.twig b/resources/views/v1/emails/password-html.twig index 28c07eacd2..2f020fb924 100644 --- a/resources/views/v1/emails/password-html.twig +++ b/resources/views/v1/emails/password-html.twig @@ -4,7 +4,7 @@

- {{ trans('email.reset_pw_warning_html')|raw }} + {{ trans('email.reset_pw_warning')|raw }}

diff --git a/resources/views/v1/emails/password-text.twig b/resources/views/v1/emails/password-text.twig index d184d5cf94..258521ea99 100644 --- a/resources/views/v1/emails/password-text.twig +++ b/resources/views/v1/emails/password-text.twig @@ -1,7 +1,7 @@ {% include 'emails.header-text' %} {{ trans('email.reset_pw_instructions')|raw }} -{{ trans('email.reset_pw_warning_text')|raw }} +{{ trans('email.reset_pw_warning')|striptags|raw }} {{ url }} {% include 'emails.footer-text' %} diff --git a/resources/views/v1/emails/registered-html.twig b/resources/views/v1/emails/registered-html.twig index 3bd9b14dcd..78d8b1052e 100644 --- a/resources/views/v1/emails/registered-html.twig +++ b/resources/views/v1/emails/registered-html.twig @@ -1,11 +1,11 @@ {% include 'emails.header-html' %}

- {{ trans('email.registered_welcome_html', {address: address})|raw }} + {{ trans('email.registered_welcome', {address: address})|raw }}

  • - {{ trans('email.registered_pw_html', {address: address})|raw }} + {{ trans('email.registered_pw', {address: address})|raw }}
  • {{ trans('email.registered_help')}} diff --git a/resources/views/v1/emails/registered-text.twig b/resources/views/v1/emails/registered-text.twig index 16ce44415f..78c696b065 100644 --- a/resources/views/v1/emails/registered-text.twig +++ b/resources/views/v1/emails/registered-text.twig @@ -1,8 +1,8 @@ {% include 'emails.header-text' %} -{{ trans('email.registered_welcome_text')|raw }} +{{ trans('email.registered_welcome')|striptags|raw }} -* {{ trans('email.registered_pw_text')|raw }} +* {{ trans('email.registered_pw')|striptags|raw }} * {{ trans('email.registered_help')|raw }} * {{ trans('email.registered_doc_text')|raw }} diff --git a/resources/views/v1/emails/undo-email-change-html.twig b/resources/views/v1/emails/undo-email-change-html.twig index ce9133d24e..00bc5bb7a4 100644 --- a/resources/views/v1/emails/undo-email-change-html.twig +++ b/resources/views/v1/emails/undo-email-change-html.twig @@ -1,15 +1,15 @@ {% include 'emails.header-html' %}

    - {{ trans('email.email_change_body_to_old_html')|raw }} + {{ trans('email.email_change_body_to_old')|raw }}

    {{ trans('email.email_change_ignore') }}

    - {{trans('email.email_change_old')}} {{ oldEmail }} + {{trans('email.email_change_old_strong', { email: oldEmail })|raw }}

    - {{trans('email.email_change_new')}} {{ newEmail }} + {{trans('email.email_change_new', { email: newEmail }) }}

    {{trans('email.email_change_undo_link')}} {{ uri }} diff --git a/resources/views/v1/emails/undo-email-change-text.twig b/resources/views/v1/emails/undo-email-change-text.twig index ea5eb0e84c..2c719b9e4d 100644 --- a/resources/views/v1/emails/undo-email-change-text.twig +++ b/resources/views/v1/emails/undo-email-change-text.twig @@ -1,11 +1,11 @@ {% include 'emails.header-text' %} -{{ trans('email.email_change_body_to_old_text')|raw }} +{{ trans('email.email_change_body_to_old')|striptags|raw }} {{ trans('email.email_change_ignore')|raw }} -{{trans('email.email_change_old')|raw }} {{ oldEmail }} +{{trans('email.email_change_old', { email: oldEmail })|raw }} -{{trans('email.email_change_new')|raw }} {{ newEmail }} +{{trans('email.email_change_new', { email: newEmail })|raw }} {{ trans('email.email_change_undo_link')|raw }} {{ uri }} {% include 'emails.footer-text' %}