Upgrade to 3.0.3

This commit is contained in:
Bastian Allgeier
2019-03-05 10:55:03 +01:00
parent 8e3d86a590
commit 418db4b09b
40 changed files with 704 additions and 144 deletions

View File

@@ -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
*