@param Difference $difference
@param string     $locale

@return string
423340
public function formatDifference(Difference $difference, $locale = 'en')
    {
        $translationKey = \sprintf('%s.%s', $difference->getUnit()->getName(), $difference->isPast() ? 'past' : 'future');

        return $this->translator->transChoice(
            $translationKey,
            $difference->getQuantity(),
            ['%count%' => $difference->getQuantity()],
            'difference',
            $locale
        );
    }
591944
public function setLocale($locale)
    {
        if ($locale instanceof Locale) {
            $this->locale = $locale;
            return $this;
        }
        $this->locale = strtolower($locale);
        return $this;
    }
352687
public function switchLocale($locale = null)
    {
        if (null === $locale) {
            $locale = $this->getLocale();
        } elseif ($this->getLocale() != $locale) {
            $this->setLocale($locale);
        }

        $this->locale->setLocale($locale);
        $this->translateAdapter->setLocale($locale);

        return \Gems_Cookies::setLocale($locale, $this->basepath->getBasePath());
    }
53234
public function findUsagesByLocales( $locale = null )
    {
        if ( empty( $locale ) )
        {
            $locale = $this->getLocale();
        }

        return $this->getMapper()
                    ->findUsagesByLocales( (array) $locale );
    }
118918
public function translate($locale = null)
    {
        if (!$locale) {
            $locale = \localizer\locale()->id();
        } else {
            $locale = (int)$locale;
        }

        return $this->getTranslation($locale);
    }
650461
public function locale($locale = null)
    {
        if ($locale) {
            $this->_locale = $locale;
        }
        if ($this->_locale) {
            return $this->_locale;
        }
        if (isset($this->_params['locale'])) {
            return $this->_params['locale'];
        }
    }
1159374
private function resolveLocaleClassName($locale)
    {
        $locale = implode('\\', array_map(function ($element) {
            return ucfirst(strtolower($element));
        }, explode('_', $locale)));

        $class = 'NumberToWords\\Legacy\\Numbers\\Words\\Locale\\' . $locale;

        if (!class_exists($class)) {
            throw new NumberToWordsException(sprintf('Unable to load locale class %s', $class));
        }

        return $class;
    }
729915
private function getFormatter($locale = 'de-AT')
    {
        $formatter = new \NumberFormatter($locale, \NumberFormatter::DECIMAL);
        $formatter->setAttribute(\NumberFormatter::MIN_FRACTION_DIGITS, 2);
        $formatter->setAttribute(\NumberFormatter::DECIMAL_ALWAYS_SHOWN, 1);

        return $formatter;
    }
369208
public function switchLocale($locale)
    {
        if (in_array($locale, $this->config['locales'])) {
            app('session')->put('administrator_locale', $locale);
        }

        return redirect()->back();
    }
69694
public function setLocale($locale)
    {
        $locale = substr($locale, 0, 2);
        if (in_array($locale, $this->locales)) {
            $this->locale = $locale;
            return true;
        }
        return false;
    }
507807
protected function getTranslationOrNew( $locale )
    {
        if( ( $translation = $this->getTranslation( $locale, false ) ) === null )
        {
            $translation = $this->getNewTranslation( $locale );
        }

        return $translation;
    }
250676
public function setLocale($locale = 'en_us') {
		//	Identify our locale and language
		$language = $locale = strtolower($locale);
		if (strpos($locale,'_') !== FALSE) {
			list($language) = explode('_',$locale);
		}

		if (count(self::$_validLocaleLanguages) == 1)
			self::_loadLocales();

		//	Test whether we have any language data for this language (any locale)
		if (in_array($language,self::$_validLocaleLanguages)) {
			//	initialise language/locale settings
			self::$_localeFunctions = array();
			self::$_localeArgumentSeparator = ',';
			self::$_localeBoolean = array('TRUE' => 'TRUE', 'FALSE' => 'FALSE', 'NULL' => 'NULL');
			//	Default is English, if user isn't requesting english, then read the necessary data from the locale files
			if ($locale != 'en_us') {
				//	Search for a file with a list of function names for locale
				$functionNamesFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.str_replace('_',DIRECTORY_SEPARATOR,$locale).DIRECTORY_SEPARATOR.'functions';
				if (!file_exists($functionNamesFile)) {
					//	If there isn't a locale specific function file, look for a language specific function file
					$functionNamesFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.$language.DIRECTORY_SEPARATOR.'functions';
					if (!file_exists($functionNamesFile)) {
						return FALSE;
					}
				}
				//	Retrieve the list of locale or language specific function names
				$localeFunctions = file($functionNamesFile,FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
				foreach ($localeFunctions as $localeFunction) {
					list($localeFunction) = explode('##',$localeFunction);	//	Strip out comments
					if (strpos($localeFunction,'=') !== FALSE) {
						list($fName,$lfName) = explode('=',$localeFunction);
						$fName = trim($fName);
						$lfName = trim($lfName);
						if ((isset(self::$_PHPExcelFunctions[$fName])) && ($lfName != '') && ($fName != $lfName)) {
							self::$_localeFunctions[$fName] = $lfName;
						}
					}
				}
				//	Default the TRUE and FALSE constants to the locale names of the TRUE() and FALSE() functions
				if (isset(self::$_localeFunctions['TRUE'])) { self::$_localeBoolean['TRUE'] = self::$_localeFunctions['TRUE']; }
				if (isset(self::$_localeFunctions['FALSE'])) { self::$_localeBoolean['FALSE'] = self::$_localeFunctions['FALSE']; }

				$configFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.str_replace('_',DIRECTORY_SEPARATOR,$locale).DIRECTORY_SEPARATOR.'config';
				if (!file_exists($configFile)) {
					$configFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.$language.DIRECTORY_SEPARATOR.'config';
				}
				if (file_exists($configFile)) {
					$localeSettings = file($configFile,FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
					foreach ($localeSettings as $localeSetting) {
						list($localeSetting) = explode('##',$localeSetting);	//	Strip out comments
						if (strpos($localeSetting,'=') !== FALSE) {
							list($settingName,$settingValue) = explode('=',$localeSetting);
							$settingName = strtoupper(trim($settingName));
							switch ($settingName) {
								case 'ARGUMENTSEPARATOR' :
									self::$_localeArgumentSeparator = trim($settingValue);
									break;
							}
						}
					}
				}
			}

			self::$functionReplaceFromExcel = self::$functionReplaceToExcel =
			self::$functionReplaceFromLocale = self::$functionReplaceToLocale = NULL;
			self::$_localeLanguage = $locale;
			return TRUE;
		}
		return FALSE;
	}
593490
public function translate(string $key, array $params, string $locale = null): string
    {
        $realKey = $this->getRealKey($key, $locale);
        $message = ArrayHelper::get($this->messages, $realKey);
        
        // not exist, return key
        if (!\is_string($message)) {
            return $key;
        }

        // no params
        if (!$params) {
            return $message;
        }

        return $this->formatMessage($message, $params);
    }
1069185
private function getFallbackLocale($locale = null)
    {
        if ($locale && $this->isLocaleCountryBased($locale)) {
            if ($fallback = $this->getLanguageFromCountryBasedLocale($locale)) {
                return $fallback;
            }
        }

        return config('translatable.fallback_locale');
    }
1154585
protected function getFormatter($locale, $digits)
    {
        $formatter = $this->retrieveDecimalFormatter($locale);
        $formatter->setAttribute(NumberFormatter::MIN_FRACTION_DIGITS, $digits);
        $formatter->setAttribute(NumberFormatter::MAX_FRACTION_DIGITS, $digits);
        $formatter->setAttribute(NumberFormatter::DECIMAL_ALWAYS_SHOWN, 1);

        return $formatter;
    }
1002439
private function getCurrencySymbol(string $currencyCode, string $locale): string
    {
        $formatter = new NumberFormatter($locale.'@currency='.$currencyCode, NumberFormatter::CURRENCY);

        return $formatter->getSymbol(NumberFormatter::CURRENCY_SYMBOL);
    }
1227704
public static function getLanguage($locale)
    {
        return isset(self::$locales[$locale])
            ? self::$locales[$locale]
            : $locale;
    }