]> BookStack Code Mirror - bookstack/blob - app/Translation/FileLoader.php
Revamped workings of WYSIWYG code blocks
[bookstack] / app / Translation / FileLoader.php
1 <?php
2
3 namespace BookStack\Translation;
4
5 use Illuminate\Translation\FileLoader as BaseLoader;
6
7 class FileLoader extends BaseLoader
8 {
9     /**
10      * Load the messages for the given locale.
11      * Extends Laravel's translation FileLoader to look in multiple directories
12      * so that we can load in translation overrides from the theme file if wanted.
13      *
14      * @param string      $locale
15      * @param string      $group
16      * @param string|null $namespace
17      *
18      * @return array
19      */
20     public function load($locale, $group, $namespace = null)
21     {
22         if ($group === '*' && $namespace === '*') {
23             return $this->loadJsonPaths($locale);
24         }
25
26         if (is_null($namespace) || $namespace === '*') {
27             $themePath = theme_path('lang');
28             $themeTranslations = $themePath ? $this->loadPath($themePath, $locale, $group) : [];
29             $originalTranslations = $this->loadPath($this->path, $locale, $group);
30
31             return array_merge($originalTranslations, $themeTranslations);
32         }
33
34         return $this->loadNamespaced($locale, $group, $namespace);
35     }
36 }
Morty Proxy This is a proxified and sanitized view of the page, visit original site.