[COMPONENT][Collection] Use current locale
This commit is contained in:
parent
c835fc6aca
commit
da6d3bd351
@ -14,7 +14,7 @@ class Collection extends Controller
|
||||
public function query(string $query, ?string $locale = null, ?Actor $actor = null)
|
||||
{
|
||||
$actor ??= Common::actor();
|
||||
$locale ??= $actor?->getTopLanguage()?->getLocale();
|
||||
$locale ??= $actor?->getTopLanguage()?->getLocale() ?? Common::currentLanguage()->getLocale();
|
||||
return CollectionModule::query($query, $this->int('page') ?? 1, $locale, $actor);
|
||||
}
|
||||
}
|
||||
|
@ -323,6 +323,6 @@ abstract class Common
|
||||
|
||||
public static function currentLanguage(): Language
|
||||
{
|
||||
return self::actor()?->getTopLanguage() ?? Language::getByLocale(!\is_null(self::$request->headers->get('accept-language')) ? I18n::clientPreferredLanguage(self::$request->headers->get('accept-language')) : self::config('site', 'language'));
|
||||
return self::actor()?->getTopLanguage() ?? Language::getByLocale(self::$request->headers->has('accept-language') ? I18n::clientPreferredLanguage(self::$request->headers->get('accept-language')) : self::config('site', 'language'));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user