public getCurrentLocale ( ) : string | ||
return | string | current language |
public function getCurrentLocale()
{
if ($this->currentLocale) {
return $this->currentLocale;
}
if ($this->useAcceptLanguageHeader()) {
$negotiator = new LanguageNegotiator($this->defaultLocale, $this->getSupportedLocales(), $this->request);
return $negotiator->negotiateLanguage();
}
// or get application default language
return $this->configRepository->get('app.locale');
}
/** * Returns current language * * @return string current language * @static */ public static function getCurrentLocale() { return \Mcamara\LaravelLocalization\LaravelLocalization::getCurrentLocale(); }