/**
  * Load the messages strictly for the given locale.
  *
  * @param string $group
  * @param string $namespace
  *
  * @return array
  */
 public function load($locale, $group, $namespace = null)
 {
     $namespace = $namespace ?: '*';
     // Translations from files
     $translationsFromFiles = $this->fileLoader->load($locale, $group, $namespace);
     // If group is 'db', retrive also from DB.
     $translationsFromDB = $group == 'db' ? $this->loadFromDB($locale, $group, $namespace) : [];
     return array_merge($translationsFromFiles, $translationsFromDB);
 }
Beispiel #2
0
 /**
  * Load the messages for the given locale.
  *
  * @param  string $locale
  * @param  string $group
  * @param  string $namespace
  * @return array
  */
 public function load($locale, $group, $namespace = null)
 {
     // First we load from configuration
     $fileTranslations = $this->fileLoader->load($locale, $group, $namespace);
     // Then we load from database. In this instance the group refers to a top-level field setting. Such as roles.*
     $dbTranslations = $this->translationRepository->getByGroup($locale, 'ui', $group)->toArray();
     // Merge the two and do any refactoring
     $translations = array_merge_recursive($fileTranslations, $dbTranslations);
     return $translations;
 }
Beispiel #3
0
 /**
  * Load the messages for the given locale.
  *
  * @param string $locale
  * @param string $group
  * @param string $namespace
  *
  * @return array
  */
 public function load($locale, $group, $namespace = null)
 {
     $defaults = [];
     foreach ($this->paths as $path) {
         $defaults = array_replace_recursive($defaults, $this->loadPath($path, $locale, $group));
     }
     return array_replace_recursive($defaults, parent::load($locale, $group, $namespace));
 }
Beispiel #4
0
 /**
  * Load the messages strictly for the given locale without checking the cache or in case of a cache miss.
  *
  * @param  string  $locale
  * @param  string  $group
  * @param  string  $namespace
  * @return array
  */
 public function loadRawLocale($locale, $group, $namespace = null)
 {
     $namespace = $namespace ?: '*';
     return $this->laravelFileLoader->load($locale, $group, $namespace);
 }
Beispiel #5
0
 /**
  * Load the messages strictly for the given locale without checking the cache or in case of a cache miss.
  *
  * @param  string  $locale
  * @param  string  $group
  * @param  string  $namespace
  * @return array
  */
 public function loadSource($locale, $group, $namespace = '*')
 {
     return array_dot($this->laravelFileLoader->load($locale, $group, $namespace));
 }
Beispiel #6
0
 /**
  * Load the messages for the given locale.
  *
  * @param  string  $locale
  * @param  string  $group
  * @param  string  $namespace
  *
  * @return array
  */
 public function load($locale, $group, $namespace = null)
 {
     $defaults = [];
     if (empty($this->locales) || $this->isSupported($locale)) {
         $defaults = $this->loadPath($this->getVendorPath(), $locale, $group);
     }
     return array_replace_recursive($defaults, parent::load($locale, $group, $namespace));
 }
 /**
  * Load the messages for the given locale.
  *
  * @param  string  $locale
  * @param  string  $group
  * @param  string  $namespace
  * @return array
  */
 public function load($locale, $group, $namespace = null)
 {
     $defaults = $this->loadPath($this->multiLangPath, $locale, $group);
     return array_replace_recursive($defaults, parent::load($locale, $group, $namespace));
 }