From d319a21b01e39dae59a339364f3592e3e4f6d698 Mon Sep 17 00:00:00 2001 From: Florian Dupret Date: Wed, 27 May 2020 17:42:19 +0200 Subject: [PATCH] Make error pages translatable --- resources/lang/en_US/errors.php | 53 +++++++++++++++++++ resources/views/v1/errors/404.twig | 12 ++--- resources/views/v1/errors/500.twig | 6 +-- resources/views/v1/errors/503.twig | 6 +-- .../views/v1/errors/FireflyException.twig | 32 ++++++----- 5 files changed, 77 insertions(+), 32 deletions(-) create mode 100644 resources/lang/en_US/errors.php diff --git a/resources/lang/en_US/errors.php b/resources/lang/en_US/errors.php new file mode 100644 index 0000000000..42272b60ab --- /dev/null +++ b/resources/lang/en_US/errors.php @@ -0,0 +1,53 @@ +. + */ + +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 + GitHub.', + '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 :file on line :line with + code :code.', + 'stacktrace' => 'Stack trace', + 'more_info' => 'More information', + 'collect_info' => 'Please collect more information in the storage/logs directory where you will find log files. If you\'re running Docker, use docker logs -f [container].', + 'collect_info_more' => 'You can read more about collecting error information in the FAQ.', + 'github_help' => 'Get help on GitHub', + 'github_instructions' => 'You\'re more than welcome to open a new issue on GitHub.', + 'use_search' => 'Use the search!', + 'include_info' => 'Include the information from this debug page.', + '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.', + +]; diff --git a/resources/views/v1/errors/404.twig b/resources/views/v1/errors/404.twig index 5091a89d0a..81b3b4cfef 100644 --- a/resources/views/v1/errors/404.twig +++ b/resources/views/v1/errors/404.twig @@ -29,28 +29,24 @@
-

404 — Firefly III cannot find this page.

+

404 — {{ trans('errors.404_header') }}

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

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

- If you are sure this page should exist, please open a ticket on - GitHub. + {{ trans('errors.404_github_link')|raw }}

diff --git a/resources/views/v1/errors/500.twig b/resources/views/v1/errors/500.twig index 4b3dec6820..53d1297f59 100644 --- a/resources/views/v1/errors/500.twig +++ b/resources/views/v1/errors/500.twig @@ -48,10 +48,8 @@
-
Whoops
- 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. - +
{{ trans('errors.whoops') }}
+ {{ trans('errors.fatal_error') }}
diff --git a/resources/views/v1/errors/503.twig b/resources/views/v1/errors/503.twig index 2ad5dd4269..a846a0a8b9 100644 --- a/resources/views/v1/errors/503.twig +++ b/resources/views/v1/errors/503.twig @@ -1,7 +1,7 @@ - Firefly III is in maintenance mode. + {{ trans('errors.maintenance_mode') }}