Documentation

LocaleUtil
in package

Table of Contents

Methods

pickClosest()  : string
Figure out which of $langs is the closest to $lang.

Methods

pickClosest()

Figure out which of $langs is the closest to $lang.

public static pickClosest(string $preferredLang, array<string|int, mixed> $availLangs[, string $default = 'en_US' ]) : string
Parameters
$preferredLang : string

The user's preferred language. Ex: en, fr, or fr_CA.

$availLangs : array<string|int, mixed>

List of available languages. Ex: ['en_US' => 'English (US)', 'fr_CA' => 'French (Canadian)'].

$default : string = 'en_US'

The locale to use if none other can be determined. Ex: 'en_US'.

Return values
string

Ex: 'en_US'.


        
On this page

Search results