1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2024-10-30 15:42:41 +01:00
BookStack/app/Translation/FileLoader.php

37 lines
1.1 KiB
PHP
Raw Normal View History

2021-06-26 17:23:15 +02:00
<?php
namespace BookStack\Translation;
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
*
* @return array
*/
public function load($locale, $group, $namespace = null)
{
if ($group === '*' && $namespace === '*') {
return $this->loadJsonPaths($locale);
}
if (is_null($namespace) || $namespace === '*') {
$themePath = theme_path('lang');
$themeTranslations = $themePath ? $this->loadPath($themePath, $locale, $group) : [];
2021-08-21 16:49:40 +02:00
$originalTranslations = $this->loadPath($this->path, $locale, $group);
return array_merge($originalTranslations, $themeTranslations);
}
return $this->loadNamespaced($locale, $group, $namespace);
}
2021-03-07 23:24:05 +01:00
}