Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Email notifications are now translatable
Florian Dupret351c0ee2d7e6
diff --git a/app/Mail/ReportNewJournalsMail.php b/app/Mail/ReportNewJournalsMail.phpindex 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(): voiddiff --git a/resources/lang/en_US/email.php b/resources/lang/en_US/email.phpindex 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 <strong>all</strong> 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 <strong>all</strong> 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 <strong>must</strong> 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 <span style="font-family: monospace;">:url</span>.',- '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 <strong>all</strong> 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: <span style="font-family: monospace;">:errorMessage</span>',+ '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 <span style="font-family: monospace;">:file</span> on line :line with code :code.',- 'error_user_html' => 'The error was encountered by user #:id, <a href="mailto::email">:email</a>.',+ '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.twigindex 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' %}<p style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;">- {{ trans('email.access_token_created_body_1')}}+ {{ trans('email.access_token_created_body')}}</p><p style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;">- {{ trans('email.access_token_created_body_2_html')|raw }}+ {{ trans('email.access_token_created_explanation_html')|raw }}</p><p style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;">- {{ trans('email.access_token_created_body_3', {url: route('profile.index') })}}+ {{ trans('email.access_token_created_revoke', {url: route('profile.index') })}}</p>{% 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.twigindex 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.twigindex 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.twigindex 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.twigindex 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' %}<p style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;">- {{ trans('email.error_intro_html', { version: version, errorMessage: errorMessage })|raw }}+ {{ trans('email.error_intro', { version: version }) }} <span style="font-family: monospace;">{{ errorMessage }}</span>.</p><p style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;">@@ -13,12 +13,12 @@</p><p style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;">- {{ trans('email.error_location_html', { file: file, line: line, code: code })|raw }}+ {{ trans('email.error_location', { file: "<span style=\"font-family: monospace;\">#{ file }</span>", line: line, code: code })|raw }}</p><p style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;">{% if loggedIn %}- {{ trans('email.error_user_html', { id: user.id, email: user.email })|raw }}+ {{ trans('email.error_user', { id: user.id, email: "<a href=\"mailto::email\">#{ user.email }</a>" })|raw }}{% else %}{{ trans('email.error_no_user') }}{% endif %}@@ -26,7 +26,7 @@<p style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;">{{ trans('email.error_ip') }} {{ ip }}<br />- {{ trans('email.error_url') }} {{ url }}<br>+ {{ trans('email.error_url') }} {{ url }}<br />{{ trans('email.error_user_agent') }} {{ userAgent }}</p>diff --git a/resources/views/v1/emails/error-text.twig b/resources/views/v1/emails/error-text.twigindex 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 [email protected]. This can help fix-the bug you just encountered.+{{ trans('email.error_stacktrace', { email: '[email protected]' })|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.twigindex 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.twigindex 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.twigindex 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' %}<p style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;">- {{ trans('email.oauth_created_body_html', { name:client.name, url:client.redirect})|raw }}+ {{ trans('email.oauth_created_body', { name:client.name, url: "<span style=\"font-family: monospace;\">" ~ client.redirect ~ "</span>"})|raw }}</p><p style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;">diff --git a/resources/views/v1/emails/oauth-client-created-text.twig b/resources/views/v1/emails/oauth-client-created-text.twigindex 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.twigindex 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.twigindex 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.twigindex 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' %}<p style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;">- {% 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 ) }}</p><!-- loop groups -->diff --git a/resources/views/v1/emails/report-new-journals-text.twig b/resources/views/v1/emails/report-new-journals-text.twigindex 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.twigindex 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' %}