From 9209a5f588d4a01c252fbe2873f369552657fdaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20Klabbers?= Date: Wed, 31 Jul 2019 17:10:13 +0200 Subject: [PATCH] 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. --- framework/core/src/Extend/LanguagePack.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/framework/core/src/Extend/LanguagePack.php b/framework/core/src/Extend/LanguagePack.php index b956a4746..80b3de45b 100644 --- a/framework/core/src/Extend/LanguagePack.php +++ b/framework/core/src/Extend/LanguagePack.php @@ -20,6 +20,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)) { @@ -49,7 +61,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(