Merge pull request #3405 from sephrat/error_pages_translation

Make error pages translatable
This commit is contained in:
James Cole
2020-05-29 06:41:55 +02:00
committed by GitHub
5 changed files with 77 additions and 32 deletions

View File

@@ -0,0 +1,53 @@
<?php
/**
* firefly.php
* Copyright (c) 2019 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
return [
'404_header' => 'Firefly III cannot find this page.',
'404_page_does_not_exist' => 'The page you have requested does not exist. Please check that you have not entered the wrong URL. Did you make a typo perhaps?',
'404_send_error' => 'If you were redirected to this page automatically, please accept my apologies. There is a mention of this error in your log files and I would be grateful if you sent me the error to me.',
'404_github_link' => 'If you are sure this page should exist, please open a ticket on
<strong><a href="https://github.com/firefly-iii/firefly-iii/issues">GitHub</a></strong>.',
'whoops' => 'Whoops',
'fatal_error' => 'There was a fatal error. Please check the log files in "storage/logs" or use "docker logs -f [container]" to see what\'s going on.',
'maintenance_mode' => 'Firefly III is in maintenance mode.',
'be_right_back' => 'Be right back!',
'check_back' => 'Firefly III is down for some necessary maintenance. Please check back in a second.',
'error_occurred' => 'Whoops! An error occurred.',
'error_not_recoverable' => 'Unfortunately, this error was not recoverable :(. Firefly III broke. The error is:',
'error' => 'Error',
'error_location' => 'This error occured in file <span style="font-family: monospace;">:file</span> on line :line with
code :code.',
'stacktrace' => 'Stack trace',
'more_info' => 'More information',
'collect_info' => 'Please collect more information in the <code>storage/logs</code> directory where you will find log files. If you\'re running Docker, use <code>docker logs -f [container]</code>.',
'collect_info_more' => 'You can read more about collecting error information in <a href="https://docs.firefly-iii.org/faq/other#how-do-i-enable-debug-mode">the FAQ</a>.',
'github_help' => 'Get help on GitHub',
'github_instructions' => 'You\'re more than welcome to open a new issue <strong><a href="https://github.com/firefly-iii/firefly-iii/issues">on GitHub</a></strong>.',
'use_search' => 'Use the search!',
'include_info' => 'Include the information <a href=":link">from this debug page</a>.',
'tell_more' => 'Tell us more than "it says Whoops!"',
'include_logs' => 'Include error logs (see above).',
'what_did_you_do' => 'Tell us what you were doing.',
];

View File

@@ -29,28 +29,24 @@
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<h3 class="text-info">404 &mdash; Firefly III cannot find this page.</h3>
<h3 class="text-info">404 &mdash; {{ trans('errors.404_header') }}</h3>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<p class="text-danger">
The page you have requested does not exist. Please check that you have not entered
the wrong URL. Did you make a typo perhaps?
{{ trans('errors.404_page_does_not_exist') }}
</p>
<p>
If you were redirected to this page automatically, please accept my apologies.
There is a mention of this error in your log files and I would be grateful if you sent
me the error to me.
{{ trans('errors.404_send_error') }}
</p>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<p>
If you are sure this page should exist, please open a ticket on
<strong><a href="https://github.com/firefly-iii/firefly-iii/issues">GitHub</a></strong>.
{{ trans('errors.404_github_link')|raw }}
</p>
</div>
</div>

View File

@@ -48,10 +48,8 @@
<body>
<div class="container">
<div class="content">
<div class="title">Whoops</div>
<code class="text">There was a fatal error. Please check the log files in "storage/logs" or use "docker logs -f [container]"
to see what's going on.
</code>
<div class="title">{{ trans('errors.whoops') }}</div>
<code class="text">{{ trans('errors.fatal_error') }}</code>
</div>
</div>

View File

@@ -1,7 +1,7 @@
<html>
<head>
<base href="{{ route('index') }}/"/>
<title>Firefly III is in maintenance mode.</title>
<title>{{ trans('errors.maintenance_mode') }}</title>
<style>
/* latin */
@@ -48,9 +48,9 @@
<body>
<div class="container">
<div class="content">
<div class="title">Be right back!</div>
<div class="title">{{ trans('errors.be_right_back') }}</div>
<p>
Firefly III is down for some necessary maintenance. Please check back in a second.
{{ trans('errors.check_back') }}
</p>
</div>
</div>

View File

@@ -34,14 +34,14 @@
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<h3 class="text-info">Whoops! An error occurred.</h3>
<h3 class="text-info">{{ trans('errors.error_occurred') }}</h3>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<p>
Unfortunately, this error was not recoverable :(. Firefly III broke. The error is:
{{ trans('errors.error_not_recoverable') }}
</p>
<p class="text-danger">
{{ exception.getMessage |default('General unknown errror') }}
@@ -52,21 +52,20 @@
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<p>
<strong>More information</strong><br />
Please collect more information in the <code>storage/logs</code> directory where you will find
log files. If you're running Docker, use <code>docker logs -f [container]</code>.
You can read more about collecting error information in <a href="https://docs.firefly-iii.org/faq/other#how-do-i-enable-debug-mode">the FAQ</a>.
<strong>{{ trans('errors.more_info') }}</strong><br />
{{ trans('errors.collect_info')|raw }}
{{ trans('errors.collect_info_more')|raw }}
</p>
<p>
<strong>Get help on GitHub</strong><br />
You're more than welcome to open a new issue <strong><a href="https://github.com/firefly-iii/firefly-iii/issues">on GitHub</a></strong>.
<strong>{{ trans('errors.github_help') }}</strong><br />
{{ trans('errors.github_instructions')|raw }}
</p>
<ol>
<li>Use the search!</li>
<li>Include the information <a href="{{ route('debug') }}">from this debug page</a>.</li>
<li>Tell us more than "it says Whoops!"</li>
<li>Include error logs (see above).</li>
<li>Tell us what you were doing.</li>
<li>{{ trans('errors.use_search') }}</li>
<li>{{ trans('errors.include_info', { link: route('debug') })|raw }}</li>
<li>{{ trans('errors.tell_more') }}</li>
<li>{{ trans('errors.include_logs') }}</li>
<li>{{ trans('errors.what_did_you_do') }}</li>
</ol>
</div>
</div>
@@ -75,10 +74,9 @@
{% if debug %}
<div class="error-stack">
<h4>Error</h4>
<p>This error occurred in file <span style="font-family: monospace;">{{ exception.getFile }}</span> on line {{ exception.getLine }} with
code {{ exception.getCode }}.</p>
<h4>Stack trace</h4>
<h4>{{ trans('errors.error') }}</h4>
<p>{{ trans('errors.error_location', {file: exception.getFile, line: exception.getLine, code: exception.getCode })|raw }}</p>
<h4>{{ trans('errors.stacktrace') }}</h4>
<div style="font-family: monospace;font-size:11px;">
{{ exception.getTraceAsString|nl2br }}
</div>