API / Minn\Admin / LanguageChoices

LanguageChoices final class

Minn\Admin\LanguageChoices · public/minn/src/Minn/Admin/LanguageChoices.php · 42 lines

The language picker's markup. English always leads the list and carries the empty value, because "no locale" and "American English" are the same choice. When the picker also offers what could be downloaded, the two halves split into named groups; otherwise every option sits in one flat list.

The attribute order is not tidy and is not ours to tidy: the English option carries `data-installed` before `selected`, an installed translation carries it after, and themes and plugins have been matching on that markup for years.

Uses 1

Constants and properties

privateENGLISH = 'English (United States)'

Public

staticdropdown(string $name, string $id, array $installed, array $available, string $selected, bool $offerAvailable): string#

The language select's HTML, installed languages first.

$installedlist<string>locale codes the site already holds
$availablearray<string, array{language: string, native_name: string, iso: array<int|string, string>}>every translation the directory offers, keyed by locale

Internals 1

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

privateoption(string $locale, array $translation, string $selected, bool $installed): string#
$translationarray{native_name: string, iso: array<int|string, string>}