Email notifications are now translatable

This commit is contained in:
Florian Dupret 2020-05-26 12:01:39 +02:00
parent 37b35661be
commit 351c0ee2d7
17 changed files with 69 additions and 77 deletions

View File

@ -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

View File

@ -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:'
];

View File

@ -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' %}

View File

@ -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' %}

View File

@ -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' %}

View File

@ -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' %}

View File

@ -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>

View File

@ -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' %}

View File

@ -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 }}

View File

@ -1 +1,2 @@
{{ trans('email.greeting') }}
{{ trans('email.greeting')|raw }}

View File

@ -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;">

View File

@ -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' %}

View File

@ -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' %}

View File

@ -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')}}

View File

@ -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 -->

View File

@ -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 %}

View File

@ -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' %}