Commit 66027700 authored by Nigel McNie's avatar Nigel McNie
Browse files

Translate the not found/access denied exceptions. Fixes #1621.

Those exceptions are safe to translate, other exceptions can't easily be translated without testing, as you have to make sure everywhere they should be used the translation infrastructure is working.

As it is, if the translation code throws an exception, everything will probably go to hell.
parent 47cfcee2
......@@ -78,6 +78,12 @@ $string['unrecoverableerrortitle'] = '%s - Site Unavailable';
$string['parameterexception'] = 'A required parameter was missing';
$string['accessdeniedexception'] = 'You do not have access to view this page';
$string['notfound'] = 'Not Found';
$string['notfoundexception'] = 'The page you are looking for could not be found';
$string['accessdenied'] = 'Access Denied';
$string['accessdeniedexception'] = 'You do not have access to view this page';
$string['viewnotfoundexceptiontitle'] = 'View not found';
$string['viewnotfoundexceptionmessage'] = 'You tried to access a view that didn\'t exist!';
......
......@@ -613,8 +613,8 @@ class UserException extends MaharaException implements MaharaThrowable {
class NotFoundException extends UserException {
public function strings() {
return array_merge(parent::strings(),
array('message' => 'The page you are looking for could not be found',
'title' => 'Not Found'));
array('message' => get_string('notfoundexception', 'error'),
'title' => get_string('notfound', 'error')));
}
public function render_exception() {
......@@ -730,8 +730,8 @@ class QuotaExceededException extends UserException {}
class AccessDeniedException extends UserException {
public function strings() {
return array_merge(parent::strings(),
array('message' => 'You do not have access to view this page',
'title' => 'Access denied'));
array('message' => get_string('accessdeniedexception', 'error'),
'title' => get_string('accessdenied', 'error')));
}
public function render_exception() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment