mirror of
https://github.com/flarum/framework.git
synced 2025-04-14 07:03:04 +08:00
Allows configuration of where the language files live. So that
language packs can optionally decide for themselves if they want to use a different directory.
This commit is contained in:
parent
3611fa1bb9
commit
42a7f2f586
@ -18,6 +18,18 @@ use RuntimeException;
|
||||
|
||||
class LanguagePack implements ExtenderInterface, LifecycleInterface
|
||||
{
|
||||
protected $path;
|
||||
|
||||
/**
|
||||
* LanguagePack constructor.
|
||||
*
|
||||
* @param string|null $path Path to yaml language files.
|
||||
*/
|
||||
public function __construct(string $path = null)
|
||||
{
|
||||
$this->path = $path;
|
||||
}
|
||||
|
||||
public function extend(Container $container, Extension $extension = null)
|
||||
{
|
||||
if (is_null($extension)) {
|
||||
@ -47,7 +59,7 @@ class LanguagePack implements ExtenderInterface, LifecycleInterface
|
||||
{
|
||||
$locales->addLocale($locale, $title);
|
||||
|
||||
$directory = $extension->getPath().'/locale';
|
||||
$directory = $extension->getPath().($this->path ?? '/locale');
|
||||
|
||||
if (! is_dir($directory)) {
|
||||
throw new RuntimeException(
|
||||
|
Loading…
x
Reference in New Issue
Block a user