mirror of
https://github.com/flarum/framework.git
synced 2025-03-02 06:33:10 +08:00
Make exception message dynamic as well
This commit is contained in:
parent
9758dfac47
commit
80546b9ed7
@ -18,14 +18,14 @@ use RuntimeException;
|
||||
|
||||
class LanguagePack implements ExtenderInterface, LifecycleInterface
|
||||
{
|
||||
protected $path;
|
||||
private $path;
|
||||
|
||||
/**
|
||||
* LanguagePack constructor.
|
||||
*
|
||||
* @param string|null $path Path to yaml language files.
|
||||
*/
|
||||
public function __construct(string $path = null)
|
||||
public function __construct(string $path = '/locale')
|
||||
{
|
||||
$this->path = $path;
|
||||
}
|
||||
@ -59,11 +59,11 @@ class LanguagePack implements ExtenderInterface, LifecycleInterface
|
||||
{
|
||||
$locales->addLocale($locale, $title);
|
||||
|
||||
$directory = $extension->getPath().($this->path ?? '/locale');
|
||||
$directory = $extension->getPath().$this->path;
|
||||
|
||||
if (! is_dir($directory)) {
|
||||
throw new RuntimeException(
|
||||
'Language packs must have a "locale" subdirectory.'
|
||||
'Expected to find "'.$this->path.'" directory in language pack.'
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user