Load a namespaced translation group.

@param  string  $locale
@param  string  $group
@param  string  $namespace
@return array
337982
protected function loadNamespaced($locale, $group, $namespace)
    {
        if (isset($this->hints[$namespace])) {
            $lines = $this->loadPath($this->hints[$namespace], $locale, $group);

            return $this->loadNamespaceOverrides($lines, $locale, $group, $namespace);
        }

        return [];
    }
776114
protected function callAfterLoad($namespace, $group, $items)
    {
        $callback = $this->afterLoad[$namespace];

        return call_user_func($callback, $this, $group, $items);
    }
471070
protected function loadLangList($locale, $group)
    {
        $translations = app('translator')->getLoader()->load($locale, $group);

        return Arr::dot([$group => $translations]);
    }
753977
protected static function formatNamespaceGroup(array $namespace, $group)
    {
        $group = static::checkGroup($group);

        if ('any' === $group) {
            $namespace = ['*'];
        } else {
            foreach ($namespace as &$value) {
                $value = static::checkNamespace($value);
                if ('path' === $group) {
                    $value .= '\\*';
                }
            }
        }

        return $namespace;
    }
118028
protected function callAfterLoad(string $namespace, string $group, array $items): array
    {
        $callback = $this->afterLoad[$namespace];

        return $callback($this, $group, $items);
    }
45799
protected function getNameForLocale($locale, &$names)
    {
        if (isset($names[$locale][1])) {
            $name = $names[$locale][1];
            unset($names[$locale][1]);
        } elseif (isset($names[$locale][4])) {
            $name = $names[$locale][4];
            unset($names[$locale][4]);
        } else {
            $name = array_shift($names[$locale]);
        }

        return $name;
    }
170853
public function load($group, $namespace = null)
    {
        $items = [];

        $path = $this->getPath($namespace);

        if (is_null($path)) {
            return $items;
        }

        $file = "{$path}/{$group}.php";

        if ($this->files->exists($file)) {
            $items = $this->getRequire($file);
        }

        return $items;
    }
797950
public function getLocalization($locale)
    {
        $dataCollection = $this->getLocalizations();
        $data = $dataCollection->get($locale);

        return $data;
    }
507807
protected function getTranslationOrNew( $locale )
    {
        if( ( $translation = $this->getTranslation( $locale, false ) ) === null )
        {
            $translation = $this->getNewTranslation( $locale );
        }

        return $translation;
    }
1193561
protected function getLine($namespace, $group, $locale, $item, array $replace)
    {
        $this->load($namespace, $group, $locale);

        $line = static::arrayGet($this->loaded[$namespace][$group][$locale], $item);

        if (is_string($line)) {
            return $this->makeReplacements($line, $replace);
        } elseif (is_array($line) && count($line) > 0) {
            return $line;
        }
    }
649822
public function loadFolder($path, $namespace = '__main__')
  {
      if (is_dir($path)) {
          $files = glob($path.'*.php');
          if (!defined('DS')) {
              define('DS', DIRECTORY_SEPARATOR);
          }
          foreach ($files as $file) {
              $shell = explode(DS, $file);
              $fileName = end($shell);
              $fileName = explode('.', $fileName, -1);
              $prefix = '';
              if (count($fileName) == 2) {
                  $prefix = reset($fileName).'.';
                  $locale = end($fileName);
              } else {
                  $locale = end($fileName);
              }
              $translations = require $file;
              $translations = array_dot($translations, $prefix);

              // merge $namespace arrays with prefixed arrays if exists
              if (isset($this->translations[$locale])) {
                  if (isset($this->translations[$locale][$namespace])) {
                      $translations = array_merge($this->translations[$locale][$namespace], $translations);
                  }
              }

              // Save the values in our instance array
              $this->translations[$locale][$namespace] = $translations;
          }
      }
  }
994817
public function getContent(string $namespace, string $locale, string $name): string
    {
        $nKey = self::getNKey($namespace, $locale);

        // L1 read
        $content = $this->loadedData[$nKey][$name] ?? false;

        if (is_string($content)) {
            // L1 hit
            return $content;
        }

        // L2 read + L1 write
        $this->loadedData[$nKey] = $this->loadedData[$nKey] ?? $this->loadNspaceFromCache($namespace, $locale);

        $fallbackLocale = $this->config['fallback'] ?? '';
        $content = $this->loadedData[$nKey][$name] ?? false;

        if (is_string($content)) {
            return $content;
        }

        if ($fallbackLocale === false || $locale === $fallbackLocale) {
            return '';
        }

        return $this->getContent($namespace, $fallbackLocale, $name);
    }
561227
protected function loadNamespaceOverrides(array $lines, $locale, $group, $namespace)
	{
		$file = "{$this->path}/packages/{$locale}/{$namespace}/{$group}.php";

		if ($this->files->exists($file))
		{
			return array_replace_recursive($lines, $this->files->getRequire($file));
		}

		return $lines;
	}
6768
public function all($locale = null){

        if(!$locale){
            $locale = $this->getLocale();
        }

        $this->load($locale);

        $translations = collect([]);
        foreach($this->languages[$locale] as $key => $arg){
            $translations->put($key, $arg['value']);
        }

        return $translations;
    }
1024213
protected function loadDomain($domain, $locale)
    {
        $event = new LoadLanguageFileEvent($domain, $locale);

        $this->eventDispatcher->dispatch(ContaoEvents::SYSTEM_LOAD_LANGUAGE_FILE, $event);
    }
235231
public function load($locale)
    {
        if ($this->files->exists($full = $this->path."/".$locale.".lang")) {
            return $this->loadFileData($this->files->get($full));
        }
        return [];
    }
13716
protected function load($group, $namespace, $collection)
    {
        $env = $this->environment;

        if (isset($this->items[$collection])) {
            return;
        }

        $items = $this->loader->load($env, $group, $namespace);

        if (isset($this->afterLoad[$namespace])) {
            $items = $this->callAfterLoad($namespace, $group, $items);
        }

        $this->items[$collection] = $items;
    }