Upgrade to 4.3.0

This commit is contained in:
Bastian Allgeier
2024-06-13 12:13:00 +02:00
parent 4b55753c46
commit e50c0341fc
87 changed files with 643 additions and 430 deletions

View File

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