Upgrade to 3.0.3
This commit is contained in:
@@ -58,7 +58,8 @@ trait AppTranslations
|
||||
*/
|
||||
public function setCurrentLanguage(string $languageCode = null)
|
||||
{
|
||||
if ($languageCode === null) {
|
||||
if ($this->multilang() === false) {
|
||||
$this->setLocale($this->option('locale', 'en_US.utf-8'));
|
||||
return $this->language = null;
|
||||
}
|
||||
|
||||
@@ -69,7 +70,7 @@ trait AppTranslations
|
||||
}
|
||||
|
||||
if ($this->language) {
|
||||
setlocale(LC_ALL, $this->language->locale());
|
||||
$this->setLocale($this->language->locale());
|
||||
}
|
||||
|
||||
return $this->language;
|
||||
@@ -86,6 +87,22 @@ trait AppTranslations
|
||||
I18n::$locale = $translationCode ?? 'en';
|
||||
}
|
||||
|
||||
/**
|
||||
* Set locale settings
|
||||
*
|
||||
* @param string|array $locale
|
||||
*/
|
||||
public function setLocale($locale)
|
||||
{
|
||||
if (is_array($locale) === true) {
|
||||
foreach ($locale as $key => $value) {
|
||||
setlocale($key, $value);
|
||||
}
|
||||
} else {
|
||||
setlocale(LC_ALL, $locale);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a specific translation by locale
|
||||
*
|
||||
|
Reference in New Issue
Block a user