API / Minn\Admin / LanguageController

LanguageController final readonly class

Minn\Admin\LanguageController · public/minn/src/Minn/Admin/LanguageController.php · 98 lines

Languages: what is installed, what a person reads in, what the site defaults to.

Used by 1

Constants and properties

privatereadonly Minn\Admin\Translations $translations

Promoted from the constructor.

privatereadonly Minn\Content\Users $users

Promoted from the constructor.

privatereadonly Minn\Content\Site $site

Promoted from the constructor.

privatereadonly Minn\Auth\Capabilities $capabilities

Promoted from the constructor.

privatereadonly Minn\Rest\Caller $caller

Promoted from the constructor.

Public

new__construct(Minn\Admin\Translations $translations, Minn\Content\Users $users, Minn\Content\Site $site, Minn\Auth\Capabilities $capabilities, Minn\Rest\Caller $caller)#
methodlanguages(Minn\Http\Request $request): Minn\Http\ResponseGET /minn-admin/v1/languages (floor edit_posts)#

The languages a user may pick, installed and available.

methodbootLocale(Minn\Http\Request $request): Minn\Http\ResponseGET /minn-admin/v1/boot-locale (floor edit_posts)#

The slice of the boot payload a language switch repaints from.

methodmine(Minn\Http\Request $request): Minn\Http\ResponsePOST /minn-admin/v1/me/language (floor edit_posts)#

Sets the caller's own locale.

methoduser(Minn\Http\Request $request, string $id): Minn\Http\ResponsePOST /minn-admin/v1/users/{id:\d+}/language (floor edit_posts)#

Sets another user's locale.

methodsite(Minn\Http\Request $request): Minn\Http\ResponsePOST /minn-admin/v1/site/language (floor edit_posts + manage_options)#

Sets the site's locale.

Internals 2

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatesetUserLocale(Minn\Http\Request $request, int $userId): Minn\Http\Response#
privateensure(Minn\Http\Request $request): array#

The requested locale, installed if it was not; '' means the site default. @return array{0: string, 1: bool}

@return array{0: string, 1: bool}