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