|
|
@@ -38,6 +38,13 @@ class MessagesFileLoader
|
|
|
protected $_name;
|
|
|
|
|
|
/**
|
|
|
+ * The package (domain) plugin
|
|
|
+ *
|
|
|
+ * @var string
|
|
|
+ */
|
|
|
+ protected $_plugin;
|
|
|
+
|
|
|
+ /**
|
|
|
* The locale to load for the given package.
|
|
|
*
|
|
|
* @var string
|
|
|
@@ -93,6 +100,13 @@ class MessagesFileLoader
|
|
|
public function __construct(string $name, string $locale, string $extension = 'po')
|
|
|
{
|
|
|
$this->_name = $name;
|
|
|
+ // If space is not added after slash, the character after it remains lowercased
|
|
|
+ $pluginName = Inflector::camelize(str_replace('/', '/ ', $this->_name));
|
|
|
+ if (strpos($this->_name, '.')) {
|
|
|
+ [$this->_plugin, $this->_name] = pluginSplit($pluginName);
|
|
|
+ } elseif (Plugin::isLoaded($pluginName)) {
|
|
|
+ $this->_plugin = $pluginName;
|
|
|
+ }
|
|
|
$this->_locale = $locale;
|
|
|
$this->_extension = $extension;
|
|
|
}
|
|
|
@@ -159,6 +173,13 @@ class MessagesFileLoader
|
|
|
|
|
|
$searchPaths = [];
|
|
|
|
|
|
+ if ($this->_plugin && Plugin::isLoaded($this->_plugin)) {
|
|
|
+ $basePath = App::path('locales', $this->_plugin)[0];
|
|
|
+ foreach ($folders as $folder) {
|
|
|
+ $searchPaths[] = $basePath . $folder . DIRECTORY_SEPARATOR;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
$localePaths = App::path('locales');
|
|
|
if (empty($localePaths) && defined('APP')) {
|
|
|
$localePaths[] = ROOT . 'resources' . DIRECTORY_SEPARATOR . 'locales' . DIRECTORY_SEPARATOR;
|
|
|
@@ -169,14 +190,6 @@ class MessagesFileLoader
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // If space is not added after slash, the character after it remains lowercased
|
|
|
- $pluginName = Inflector::camelize(str_replace('/', '/ ', $this->_name));
|
|
|
- if (Plugin::isLoaded($pluginName)) {
|
|
|
- $basePath = App::path('locales', $pluginName)[0];
|
|
|
- foreach ($folders as $folder) {
|
|
|
- $searchPaths[] = $basePath . $folder . DIRECTORY_SEPARATOR;
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
return $searchPaths;
|
|
|
}
|