@param string $locale

@throws \IntlException
@return \ResourceBundle
327219
private function getResourceBundle($locale)
    {
        if (!isset($this->resourceBundles[$locale])) {
            $resourceBundle = \ResourceBundle::create($locale, $this->resourcesDirectory, true);

            if ($resourceBundle === null) {
                throw new \IntlException('Could not create resource bundle');
            }

            $this->resourceBundles[$locale] = $resourceBundle;
        }

        return $this->resourceBundles[$locale];
    }
940480
public function getLangByLocale($locale)
    {
        // Event parameters prepare
        $arrayParameters = $this->makeArrayFromParameters(__METHOD__, func_get_args());

        // Sending service start event
        $arrayParameters = $this->sendEvent('melisengine_service_get_lang_by_local_start', $arrayParameters);

        // Service implementation start
        $langTable = $this->getServiceLocator()->get('MelisEngineTableCmsLang');
        $result = $langTable->getEntryByField('lang_cms_locale', $locale)->toArray();
        if(!isset($result[0]['lang_cms_locale'])) return null;
        $result = $result[0];
        // Service implementation end

        // Adding results to parameters for events treatment if needed
        $arrayParameters['results'] = $result;
        // Sending service end event
        $arrayParameters = $this->sendEvent('melisengine_service_get_lang_by_local_end', $arrayParameters);

        return $arrayParameters['results'];
    }
766449
public static function languages(string $locale = 'en') : Collection
    {
        return Collection::make(include __DIR__ . "/../../../umpirsky/language-list/data/{$locale}/language.php")->map(function ($lang) {
            return ucfirst($lang);
        });
    }
118918
public function translate($locale = null)
    {
        if (!$locale) {
            $locale = \localizer\locale()->id();
        } else {
            $locale = (int)$locale;
        }

        return $this->getTranslation($locale);
    }
187759
public function findByLocale($locale)
    {
        // Get sanitized locale
        $locale = Locale::sanitizeLocale($locale);

        return isset($this->available[$locale]) ? $this->available[$locale] : null;
    }
1143011
public function setLocale(string $locale): self
    {
        assert(empty($locale) === false && locale_canonicalize($locale) === $locale);

        $this->locale = $locale;

        return $this;
    }
591944
public function setLocale($locale)
    {
        if ($locale instanceof Locale) {
            $this->locale = $locale;
            return $this;
        }
        $this->locale = strtolower($locale);
        return $this;
    }
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;
    }
546263
public function findAll($locale)
    {
        $units = $this->unitRepository->findAllByLocale($locale);

        array_walk(
            $units,
            function (&$unit) use ($locale) {
                $unit = new Unit($unit, $locale);
            }
        );

        return $units;
    }
718288
public function setLocale($locale)
    {
        $this->parentSetLocale($locale);
        $this->formatCache = [];
        $this->dateFormatCache = [];
        return $this;
    }
783734
protected function getLocalise($locale = 'en-GB')
    {
        $locale = LanguageNormalize::toLanguageTag($locale);

        if (empty($this->localises[$locale]) || !($this->localises[$locale] instanceof LocaliseInterface)) {
            $tag = LanguageNormalize::getLocaliseClassPrefix($this->locale);

            $class = sprintf('Windwalker\\Language\\Localise\\%sLocalise', $tag);

            if (!class_exists($class)) {
                $class = 'Windwalker\\Language\\Localise\\NullLocalise';
            }

            $this->localises[$locale] = new $class();
        }

        return $this->localises[$locale];
    }
1047311
public function setLocale($locale)
    {
        if (null !== $locale && !array_key_exists($locale, Application::getAvailableLanguages())) {
            throw new InvalidArgumentException(sprintf('Invalid locale %s.', $locale));
        }

        $this->locale = $locale;

        return $this;
    }
791842
public function setLocale($locale = null)
    {
        if (is_null($locale)) {
            $locale = $this->getParent()->getLocale();
        }
        $this->locale = $locale;

        return $this;
    }
1249335
protected function setLocale($locale)
    {
        if (is_null($locale) || $locale === 'auto') {
            $locale = app()->getLocale();
        }

        $this->locale = $locale;

        return $this;
    }
984536
public static ResourceBundle getResourceBundle(String bundleName, Locale locale)
    {
        return ResourceBundle.getBundle(bundleName, locale);
    }
1170004
public function setLocale($locale)
    {
        //Check if we have information for this locale
        $file = __DIR__ . '/i18n/' . $locale . '.json';
        if (file_exists($file)) {
            //Read the locale information from the file
            $meta = json_decode(file_get_contents($file), true);
            if (is_array($meta)) {
                $this->locale = $meta;

                return true;
            } else {
                throw new LocaleParseErrorException('Locale "' . $locale . '" could not be parsed correctly');
            }
        } else {
            throw new LocaleNotSupportedException('Locale not supported by this library');
        }
    }
386315
public static final function configuration(string $locale) {
    if (!empty($locale)) {
      Lang::$locale = $locale;
    } else {
      Lang::$locale = Lang::STANDARD_LOCALE;
    }
    return null;
  }