lithium\g11n\Locale::_preferredConsole PHP Метод

_preferredConsole() защищенный статический Метод

The locales of the 'LC_ALL' and the 'LANG' are formatted according to the posix standard: language(_territory)(.encoding)(@modifier). Locales having such a format are automatically canonicalized and transformed into the Locale class' format.
protected static _preferredConsole ( Request $request ) : array
$request lithium\console\Request
Результат array Preferred locales in their canonical form (i.e. `'fr_CA'`).
    protected static function _preferredConsole($request)
    {
        $regex = '(?P<locale>[\\w\\_]+)(\\.|@|$)+';
        $result = array();
        if ($value = $request->env('LANGUAGE')) {
            return explode(':', $value);
        }
        foreach (array('LC_ALL', 'LANG') as $variable) {
            $value = $request->env($variable);
            if (!$value || $value === 'C' || $value === 'POSIX') {
                continue;
            }
            if (preg_match("/{$regex}/", $value, $matches)) {
                return (array) $matches['locale'];
            }
        }
        return $result;
    }