Loads the country definitions for the provided locale.

@param string $locale The desired locale.

@return array
513531
protected function loadDefinitions($locale)
    {
        if (!isset($this->definitions[$locale])) {
            $filename = $this->definitionPath . $locale . '.json';
            $this->definitions[$locale] = json_decode(file_get_contents($filename), true);
        }

        return $this->definitions[$locale];
    }
388471
public function setLocale($locale)
    {
        foreach ($this->datas as $data) {
            $data->getDefinition()->setLocale($locale);
        }
    }
463269
public function get(string $key, string $locale = null)
    {
        list($country) = $this->parseKey($key);

        $locale = $locale ?? $this->fallbackLocale;

        $this->load($locale);

        if ($this->has($locale, $country)) {
            return $this->loaded[$locale][$country];
        }

        return $key;
    }
1027200
private function getAdditionalLinks($locale)
    {
        $return = [];
        $additional_links = $this->container->getParameter('networking_init_cms.xml_sitemap.additional_links');
        foreach ($additional_links as $links) {
            if ($links['locale'] == $locale) {
                return $links['links'];
            }
        }

        return $return;
    }
275488
protected function loadJsonPaths($locale)
    {
        $jsonPaths = array_merge($this->jsonPaths, array($this->path));

        $reducer = function ($items, $callback, $initial = null) {
            return array_reduce($items, $callback, $initial);
        };

        $decoder = function ($output, $path) use ($locale) {
            if (file_exists($full = "{$path}/{$locale}.json")) {
                $decoded = json_decode(file_get_contents($full), true);

                if (is_null($decoded) || json_last_error() !== JSON_ERROR_NONE) {
                    throw new RuntimeException("Translation file [{$full}] contains an invalid JSON structure.");
                }

                $output = array_merge($output, $decoded);
            }

            return $output;
        };

        return $reducer($jsonPaths, function ($output, $path) use ($decoder) {
            return $decoder($output, $path);
        }, array());
    }
408914
public static function getDisplayCountries($locale)
    {
        if (!isset(self::$countries[$locale])) {
            self::$countries[$locale] = Intl::getRegionBundle()->getCountryNames($locale);
        }

        return self::$countries[$locale];
    }
397690
public function findAllByLocale($locale)
    {
        try {
            $qb = $this->getUnitQuery($locale)
                ->orderBy('unitTranslations.name', 'ASC');

            return $qb->getQuery()->getResult();
        } catch (NoResultException $exc) {
            return null;
        }
    }
1168948
public function findAllByLocale($locale)
    {
        try {
            $qb = $this->getStatusQuery($locale);

            return $qb->getQuery()->getResult();
        } catch (NoResultException $exc) {
            return null;
        }
    }
753763
public static function getByLocale($locale)
    {
        if (!$locale) {
            return null;
        }

        if ($locale instanceof Locale) {
            return $locale;
        }

        if (!static::$locales_by_title) {
            static::$locales_by_title = [];
            foreach (Locale::getCached() as $localeObj) {
                static::$locales_by_title[$localeObj->Locale] = $localeObj;
            }
        }

        // Get filtered locale
        return isset(static::$locales_by_title[$locale]) ? static::$locales_by_title[$locale] : null;
    }
1127827
public function getTranslation($locale)
    {
        /** @var TaxClassTranslation $translation */
        foreach ($this->getTranslations() as $translation) {
            if ($translation->getLocale() === $locale) {
                return $translation;
            }
        }

        return null;
    }
1185231
public function locale($locale = null)
    {
        if ($locale) {
            // Normalize the language
            self::$locale = strtolower(str_replace([' ', '_'], '-', $locale));
        }

        return self::$locale;
    }
5663
protected function processDefinition($locale, array $definition)
    {
        $definition['locale'] = $locale;
        // The generation script strips all keys that have the same values
        // as the ones in 'en'.
        if ($definition['locale'] != 'en') {
            $definitions = $this->getDefinitions();
            $definition += $definitions['en'];
        }

        return $definition;
    }
608599
protected function getSiteNameForLocale($locale)
    {
        static $names = array();
        if (!isset($names[$locale])) {
            $prevLocale = \Localization::activeLocale();
            if ($prevLocale !== $locale) {
                \Localization::changeLocale($locale);
            }
            $names[$locale] = tc('SiteName', $this->app->make('site')->getSite()->getSiteName());
            if ($prevLocale !== $locale) {
                \Localization::changeLocale($prevLocale);
            }
        }

        return $names[$locale];
    }
987961
private function getCatalogue($locale)
    {
        if (empty($this->catalogues[$locale])) {
            $this->loadCatalogue($locale, $this->dir);
        }

        return $this->catalogues[$locale];
    }
365748
public function retrieveAllAsArray($locale)
    {
        $result = [];

        /** @var CustomerType $customerType */
        foreach ($this->retrieveAll($locale) as $customerType) {
            $result[] = [
                'id' => $customerType->getId(),
                'name' => $customerType->getName(),
            ];
        }

        return $result;
    }
324641
public function translationsFromFiles($locale)
    {
        $grouped = [];
        foreach ($this->hints as $name => $hint) {
            $languageDirectory = $hint . DIRECTORY_SEPARATOR . $locale;
            if (!is_dir($languageDirectory)) {
                continue;
            }
            $files = $this->filesystem->allFiles($languageDirectory);
            foreach ($files as $filename) {
                $file         = str_replace('.' . $filename->getExtension(), '', $filename->getFilename());
                $translations = array_dot(require $filename->getRealPath());
                foreach ($translations as $key => $translation) {
                    $grouped[$name] [$file . '.' . $key] = $translation;
                }
            }
        }
        return $grouped;
    }
1279657
public function load($locale, $group, $namespace = null): array
    {
        $fileTranslations = parent::load($locale, $group, $namespace);

        if (! is_null($namespace) && $namespace !== '*') {
            return $fileTranslations;
        }

        $loaderTranslations = $this->getTranslationsForTranslationLoaders($locale, $group, $namespace);

        return array_replace_recursive($fileTranslations, $loaderTranslations);
    }