Skip to content

Commit ee5ddfa

Browse files
authored
Merge pull request dokuwiki#4358 from dokuwiki/extensionmanager
Extension Manager Refactoring
2 parents c156c07 + bc72c22 commit ee5ddfa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+3828
-3753
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace dokuwiki\plugin\extension;
4+
5+
use Throwable;
6+
7+
/**
8+
* Implements translatable exception messages
9+
*/
10+
class Exception extends \Exception
11+
{
12+
/**
13+
* @param string $message The error message or language string
14+
* @param array $context array of sprintf variables to be replaced in the message
15+
* @param Throwable|null $previous Previous exception
16+
*/
17+
public function __construct($message = "", $context = [], Throwable $previous = null)
18+
{
19+
// try to translate the message
20+
$helper = plugin_load('helper', 'extension');
21+
$newmessage = $helper->getLang($message);
22+
if ($newmessage === '') {
23+
$newmessage = $message;
24+
}
25+
26+
if ($context) {
27+
$newmessage = vsprintf($newmessage, $context);
28+
}
29+
30+
parent::__construct($newmessage, 0, $previous);
31+
}
32+
}

0 commit comments

Comments
 (0)