@param string      $locale
@param string|null $version

@return array
@throws ArgumentException
@throws SettingsException
541457
public static function getStaticChampionsWithKeys( string $locale = 'en_US', string $version = null ) : array
	{
		$url = self::getStaticDataFileUrl(self::STATIC_CHAMPIONS, null, $locale, $version, self::STATIC_CHAMPION_BY_KEY);
		$data = self::loadCachedStaticData($url);
		if (!$data)
		{
			self::getStaticChampions($locale, $version);
			$data = self::loadCachedStaticData($url);
		}
		return $data;
	}
205167
public function getTranslations(Locale $locale)
    {
        $localeID = $locale->getID();
        $translations = isset($this->translations[$localeID]) ? $this->translations[$localeID][1] : null;
        if ($translations === null) {
            $translations = clone $this->getSourceStrings(true);
            $translations->setLanguage($locale->getID());
            $this->setTranslations($locale, $translations);
        }

        return $translations;
    }
1222235
private function getFromCache( $locale, $context )
    {
        if ( isset( $this->contextCache[$locale][$context] ) )
        {
            return $this->contextCache[$locale][$context];
        }
        return null;
    }
1297937
public function retrieveFieldDescriptors($locale)
    {
        $fieldDescriptors = [];

        $fieldDescriptors['id'] = new DoctrineFieldDescriptor(
            'id',
            'id',
            static::$attributeEntityName,
            null,
            [
                static::$attributeEntityName => new DoctrineJoinDescriptor(
                    static::$attributeEntityName,
                    static::$productEntityName . '.variantAttributes'
                ),
            ],
            true,
            false,
            'integer'
        );

        $fieldDescriptors['name'] = new DoctrineFieldDescriptor(
            'name',
            'name',
            static::$attributeTranslationEntityName,
            null,
            [
                static::$attributeEntityName => new DoctrineJoinDescriptor(
                    static::$attributeEntityName,
                    static::$productEntityName . '.variantAttributes'
                ),
                static::$attributeTranslationEntityName => new DoctrineJoinDescriptor(
                    static::$attributeTranslationEntityName,
                    static::$attributeEntityName . '.translations',
                    static::$attributeTranslationEntityName . '.locale = \'' . $locale . '\'',
                    DoctrineJoinDescriptor::JOIN_METHOD_INNER
                ),
            ],
            false,
            true,
            'string'
        );

        return $fieldDescriptors;
    }
690270
protected function checkLocale($locale)
    {
        $languageFound = null;
        $language = strstr($locale, '_', true);

        foreach ($this->configuration['locales'] as $availableLocale) {
            // If locale matches, the exact matching was found.
            if ($availableLocale === $locale) {
                return $availableLocale;
            }

            // Check if language (without locale) matches.
            if ($language == $availableLocale) {
                $languageFound = $availableLocale;
            }
        }

        if ($languageFound) {
            return $languageFound;
        }

        return null;
    }
130599
public static function setLocale($locale=null)
    {
        global $CFG, $TSUGI_LOCALE, $TSUGI_LOCALE_RELOAD;

        // No internationalization support
        if ( isset($CFG->legacytranslation) ) {
            if ( ! function_exists('bindtextdomain') ) return;
            if ( ! function_exists('textdomain') ) return;
        }

        if ( isset($CFG->legacytranslation) && $locale && 
            strpos($locale, 'UTF-8') === false ) $locale = $locale . '.UTF-8';

        if ( $locale === null && isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ) {

            if ( class_exists('\Locale') ) {
                try {
                    // Symfony may implement a stub for this function that throws an exception
                    $locale = \Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE']);
                } catch (exception $e) { }
            }
            if ($locale === null) { // Crude fallback if we can't use Locale::acceptFromHttp
                $pieces = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
                $locale = $pieces[0];
            }
        }

        if ( $locale === null && isset($CFG->fallbacklocale) && $CFG->fallbacklocale ) {
            $locale = $CFG->fallbacklocale;
        }

        if ( $locale === null ) return;

        $locale = str_replace('-','_',$locale);
        if ( isset($CFG->legacytranslation) ) {
            putenv('LC_ALL='.$locale);
            setlocale(LC_ALL, $locale);
        }
        // error_log("setLocale=$locale");
        if ( $TSUGI_LOCALE != $locale ) $TSUGI_LOCALE_RELOAD = true;
        $TSUGI_LOCALE = $locale;
    }
144083
public function locale($locale = null)
    {
        // Set the locale if a valid local is passed
        if ($locale
            && ($locales = Config::get('decoy.site.locales'))
            && is_array($locales)
            && isset($locales[$locale])) {
            return Session::put('locale', $locale);
        }

        // Return the current locale or default to first one.  Store it in a local var
        // so that multiple calls don't have to do any complicated work.  We're assuming
        // the locale won't change within a single request.
        if (!$this->locale) {
            $this->locale = Session::get('locale', $this->defaultLocale());
        }

        return $this->locale;
    }
569527
public function setLocale($locale = null)
    {
        $locale = self::_prepareLocale($locale);

        if (isset(self::$_localeData[(string) $locale]) === false) {
            $region = substr((string) $locale, 0, 3);
            if (isset($region[2]) === true) {
                if (($region[2] === '_') or ($region[2] === '-')) {
                    $region = substr($region, 0, 2);
                }
            }

            if (isset(self::$_localeData[(string) $region]) === true) {
                $this->_locale = $region;
            } else {
                $this->_locale = 'root';
            }
        } else {
            $this->_locale = $locale;
        }
    }
165554
public function get($key, $locale = null)
    {
        if(!$locale){
            $locale = $this->getLocale();
        }

        if($locale == config('translator.default')){
            return $key;
        }

        $this->load($locale);

        if (!isset($this->languages[$locale][$key])){
            $this->setMissing($key, $locale);
            return $key;
        }

        return $this->languages[$locale][$key]["value"];
    }
304928
public static function getStaticRune( int $rune_id, string $locale = 'en_US', string $version = null) : array
	{
		$data = self::getStaticRunes($locale, $version);
		if (isset($data['data'][$rune_id]) == false)
			throw new ArgumentException('Rune with given ID was not found.', 404);

		return $data['data'][$rune_id];
	}
1253315
public function getchangedI18N($locale=null) {
		if(!$locale)
			return array_keys($this->translationschanged);
		elseif(isset($this->translationschanged[$locale]))
			return array_keys($this->translationschanged[$locale]);
		else
			return [];
	}
29455
public static function getDisplayLanguages($locale)
    {
        if (!isset(self::$languages[$locale])) {
            self::$languages[$locale] = Intl::getLanguageBundle()->getLanguageNames($locale);
        }

        return self::$languages[$locale];
    }
235231
public function load($locale)
    {
        if ($this->files->exists($full = $this->path."/".$locale.".lang")) {
            return $this->loadFileData($this->files->get($full));
        }
        return [];
    }
1279183
public static function get($locale = null)
    {
        $locale = $locale ?: 'en';

        if (!isset(static::$singletons[$locale])) {
            static::$singletons[$locale] = new static($locale ?: 'en');
        }

        return static::$singletons[$locale];
    }
1345358
public function _get($name, $locale=null) {
		$name = strtolower($name);
		
		if(!$locale)
			$locale = $this->getLocale();

		if($this->getDefinition()->hasProperty($name)) {
			if($this->getDefinition()->property($name)->get('i18n') && $locale !== $this->getLocale()) {
				#multiple locales at once
				if(is_array($locale)) {
					$res = [];
					foreach($locale as $locale)
						$res[$locale] = $this->get($name, $locale);
					return $res;
				}
				elseif(isset($this->data['translations'][$locale][$name]))
					return $this->data['translations'][$locale][$name];
				else {
					$this->getDefinition()->trigger('getTranslations', [$this, $name, $locale]);
					if(!isset($this->data['translations'][$locale][$name]))
						return null;
					return $this->data['translations'][$locale][$name];
				}
			}
			elseif(isset($this->data['properties'][$name]))
				return $this->data['properties'][$name];
		}
		elseif(isset($this->data[$name]))
			return $this->data[$name];
	}
1344509
public function LocaleInformation($locale = null)
    {
        // Check locale and get object
        if ($locale) {
            $localeObj = Locale::getByLocale($locale);
        } else {
            $localeObj = Locale::getDefault();
        }
        $locale = $localeObj->getLocale();

        // Check linking mode
        $linkingMode = $this->getLinkingMode($locale);

        // Check link
        $link = $this->LocaleLink($locale);

        // Store basic locale information
        return ArrayData::create([
            'Locale' => $locale,
            'LocaleRFC1766' => i18n::convert_rfc1766($locale),
            'URLSegment' => $localeObj->getURLSegment(),
            'Title' => $localeObj->getTitle(),
            'LanguageNative' => $localeObj->getNativeName(),
            'Language' => i18n::getData()->langFromLocale($locale),
            'Link' => $link,
            'AbsoluteLink' => $link ? Director::absoluteURL($link) : null,
            'LinkingMode' => $linkingMode
        ]);
    }
685444
public static function setLocale(string $locale, string $backup) : array {
		$result = [
			'locale_locales' => [],
			'locale_locale_js' => null,
			'locale_set_name' => null,
			'locale_options' => [],
			'locale_override_class' => null
		];
		$temp = $locale;
		$result['locale_locales'] = [];
		$result['locale_locales'][] = $temp;
		if (strpos($temp, '@') !== false) {
			$temp = explode('@', $temp);
			$temp = $temp[0];
			$result['locale_locales'][] = $temp;
		}
		if (strpos($temp, '.') !== false) {
			$temp = explode('.', $temp);
			$temp = $temp[0];
			$result['locale_locales'][] = $temp;
		}
		$result['locale_locale_js'] = str_replace('_', '-', $temp);
		$result['locale_set_name'] = setlocale(LC_ALL, $result['locale_locales']);
		// grab settings
		$result['locale_options'] = localeconv();
		// form a class name from locale name
		// todo: finilize locale
		$class = str_replace('-', '', $locale);
		$class = str_replace('.', '_', $class);
		$class = strtolower($class);
		// see if class exists
		$override_format_filename = __DIR__ . '/Object/Format/Locales/' . $class . '.php';
		if (file_exists($override_format_filename)) {
			require_once($override_format_filename);
			$class = 'object_format_locales_' . $class;
			$result['locale_override_class'] = $class;
			// grab overrides
			$result['locale_options'] = $class::localeconv($result['locale_options']);
			// if locale does not exists but we have override we simply accept it
			if (empty($result['locale_set_name'])) {
				$result['locale_set_name'] = $locale;
			}
		} else if (empty($result['locale_set_name']) && !empty($backup)) {
			$result = self::setLocale($backup, '');
		}
		return $result;
	}