1
0
mirror of https://github.com/flarum/core.git synced 2025-02-24 03:05:12 +01:00

Make exception message dynamic as well

This commit is contained in:
Franz Liedke 2019-08-01 22:25:15 +02:00
parent f0dff95d62
commit 2648e960a7
No known key found for this signature in database
GPG Key ID: 9A0231A879B055F4

View File

@ -20,14 +20,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;
}
@ -61,11 +61,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.'
);
}