2021-06-26 17:23:15 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace BookStack\Translation;
|
2019-10-26 13:12:35 +02:00
|
|
|
|
|
|
|
use Illuminate\Translation\FileLoader as BaseLoader;
|
|
|
|
|
|
|
|
class FileLoader extends BaseLoader
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Load the messages for the given locale.
|
|
|
|
* Extends Laravel's translation FileLoader to look in multiple directories
|
|
|
|
* so that we can load in translation overrides from the theme file if wanted.
|
2021-06-26 17:23:15 +02:00
|
|
|
*
|
|
|
|
* @param string $locale
|
|
|
|
* @param string $group
|
|
|
|
* @param string|null $namespace
|
|
|
|
*
|
2019-10-26 13:12:35 +02:00
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function load($locale, $group, $namespace = null)
|
|
|
|
{
|
|
|
|
if ($group === '*' && $namespace === '*') {
|
|
|
|
return $this->loadJsonPaths($locale);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is_null($namespace) || $namespace === '*') {
|
|
|
|
$themeTranslations = $this->loadPath(theme_path('lang'), $locale, $group);
|
2021-06-26 17:23:15 +02:00
|
|
|
$originalTranslations = $this->loadPath($this->path, $locale, $group);
|
|
|
|
|
2019-10-26 13:12:35 +02:00
|
|
|
return array_merge($originalTranslations, $themeTranslations);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->loadNamespaced($locale, $group, $namespace);
|
|
|
|
}
|
2021-03-07 23:24:05 +01:00
|
|
|
}
|