Upgrade to 4.3.0
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
namespace Kirby\Cms;
|
||||
|
||||
use Kirby\Toolkit\I18n;
|
||||
use Kirby\Toolkit\Locale;
|
||||
use Kirby\Toolkit\Str;
|
||||
|
||||
/**
|
||||
@@ -104,33 +103,6 @@ trait AppTranslations
|
||||
return $this->option('panel.language', $defaultCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load and set the current language if it exists
|
||||
* Otherwise fall back to the default language
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public function setCurrentLanguage(
|
||||
string $languageCode = null
|
||||
): Language|null {
|
||||
if ($this->multilang() === false) {
|
||||
Locale::set($this->option('locale', 'en_US.utf-8'));
|
||||
return $this->language = null;
|
||||
}
|
||||
|
||||
$this->language = $this->language($languageCode);
|
||||
$this->language ??= $this->defaultLanguage();
|
||||
|
||||
if ($this->language) {
|
||||
Locale::set($this->language->locale());
|
||||
}
|
||||
|
||||
// add language slug rules to Str class
|
||||
Str::$language = $this->language->rules();
|
||||
|
||||
return $this->language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current translation
|
||||
*
|
||||
@@ -148,7 +120,7 @@ trait AppTranslations
|
||||
*/
|
||||
public function translation(string|null $locale = null): Translation
|
||||
{
|
||||
$locale = $locale ?? I18n::locale();
|
||||
$locale ??= I18n::locale();
|
||||
$locale = basename($locale);
|
||||
|
||||
// prefer loading them from the translations collection
|
||||
|
||||
Reference in New Issue
Block a user