Which alphabet is used in a locale?

@return array
506416
public function alphabet(): array
    {
        $locale = $this->locale->languageTag();
        $script = $this->locale->script()->code();

        return self::ALPHABETS_FOR_LOCALE[$locale] ?? self::ALPHABETS_FOR_SCRIPT[$script] ?? self::LATIN_ALPHABET;
    }
488078
public function getTextSettings()
    {
        $description = sprintf($this->_(
                "Use the %%-sign to search for zero or more random characters and an _ for a single random character."
                ));

        return array(
            'gaf_filter_text1' => array(
                'label'       => $this->_('Activity'),
                'description' => $description,
                'required'    => true,
                ),
            'gaf_filter_text2' => array(
                'label'       => $this->_('Procedure'),
                'description' => $description,
                ),
            'gaf_filter_text3' => array(
                'label'       => $this->_('But not when'),
                'description' => sprintf($this->_("But skip when this text is found - use %%-sign as well.")),
                ),
            );
    }
277120
function languages()
    {
        // trust configuration
        $configured = $this->rc->config->get('spellcheck_languages');
        if (!empty($configured) && is_array($configured) && !$configured[0]) {
            return $configured;
        }
        else if (!empty($configured)) {
            $langs = (array)$configured;
        }
        else if ($this->backend) {
            $langs = $this->backend->languages();
        }

        // load index
        @include(RCUBE_LOCALIZATION_DIR . 'index.inc');

        // add correct labels
        $languages = array();
        foreach ($langs as $lang) {
            $langc = strtolower(substr($lang, 0, 2));
            $alias = $rcube_language_aliases[$langc];
            if (!$alias) {
                $alias = $langc.'_'.strtoupper($langc);
            }
            if ($rcube_languages[$lang]) {
                $languages[$lang] = $rcube_languages[$lang];
            }
            else if ($rcube_languages[$alias]) {
                $languages[$lang] = $rcube_languages[$alias];
            }
            else {
                $languages[$lang] = ucfirst($lang);
            }
        }

        // remove possible duplicates (#1489395)
        $languages = array_unique($languages);

        asort($languages);

        return $languages;
    }
645798
protected function _getPossibleLocales() {
        $bootstrap = $this->getBootstrap();
        $bootstrap->bootstrap('FrontController');
        $frontController = $bootstrap->getContainer()->frontcontroller;
        $locales = $frontController->getParam('locales');
        return $locales;
    }
226324
protected function _localesPattern()
    {
        $cacheKey = '_localesPattern';
        $cache = static::cache($cacheKey);
        if ($cache) {
            return $cache;
        }

        $pattern = '(' . implode(
            '|',
            array_map(
                'preg_quote',
                array_keys(
                    quickapps('languages')
                )
            )
        ) . ')';

        return static::cache($cacheKey, $pattern);
    }
801469
public function getTranslations(): array
    {
        // Get english name
        $name = [
            'eng' => [
                'common' => $this->getName(),
                'official' => $this->getOfficialName(),
            ],
        ];

        // Get native names
        $natives = $this->getNativeNames() ?: [];

        // Get other translations
        $file = __DIR__.'/../resources/translations/'.mb_strtolower($this->getIsoAlpha2()).'.json';
        $translations = file_exists($file) ? json_decode(file_get_contents($file), true) : [];

        // Merge all names together
        $result = array_merge($translations, $natives, $name);

        // Sort alphabetically
        ksort($result);

        return $result;
    }
817404
public function getLanguages()
    {
        $source = $this->server['HTTP_ACCEPT_LANGUAGE'];

        if (strpos($source, ',') !== false) {
            $langs = explode(',', $source);
            return $langs;
        } else {
            return array($source);
        }
    }
226091
public function getAvailableLangs(): array
    {
        $langs = ['en'];
        $scan = Directory::scan(root . '/I18n/' . env_name . '/', GLOB_ONLYDIR, true);
        foreach ($scan as $row) {
            $langs[] = trim($row, '/');
        }
        return $langs;
    }
252692
public function getCharsets()
    {
        if (!isset($this->_charsets))
        {
            $this->_charsets = array();

            if($this->_headers->has('Accept-Charset'))
            {
                $accept   = $this->_headers->get('Accept-Charset');
                $charsets = $this->_parseAccept($accept);

                $this->_charsets = array_keys($charsets);
            }
        }

        return $this->_charsets;
    }
572260
protected function detectCharacterEncoding()
    {
        $encoding = null;

        if (function_exists('nl_langinfo') && is_callable('nl_langinfo')) {
            $encoding = nl_langinfo(CODESET);
        } else {
            // try to detect encoding from locale identifier
            $lc_ctype = null;
            $lc_all = self::setlocale(LC_ALL, '0');
            $lc_all_exp = explode(';', $lc_all);
            if (count($lc_all_exp) === 1) {
                $lc_ctype = reset($lc_all_exp);
            } else {
                foreach ($lc_all_exp as $lc) {
                    if (strncmp($lc, 'LC_CTYPE', 8) === 0) {
                        $lc_ctype = $lc;
                        break;
                    }
                }
            }

            if ($lc_ctype !== null) {
                $lc_ctype_exp = explode('.', $lc_ctype, 2);
                if (count($lc_ctype_exp) === 2) {
                    $encoding = $lc_ctype_exp[1];
                }
            }
        }

        // assume encoding is a code-page if encoding is numeric
        if ($encoding !== null && ctype_digit($encoding)) {
            $encoding = 'CP' . $encoding;
        }

        return $encoding;
    }
246261
public function locale()
    {
        $lang    = $this->lang();
        $locales = $this->translator()->locales();

        if (isset($locales[$lang]['locale'])) {
            $locale = $locales[$lang]['locale'];
            if (is_array($locale)) {
                $locale = implode(' ', $locale);
            }
        } else {
            $locale = 'en-US';
        }

        return $locale;
    }
955428
public function getAllLocalizations()
    {
        $localizations = [];
        foreach ($this->getLocalizations() as $child) {
            $localizations[] = $child;
            $localizations = array_merge($localizations, $child->getAllLocalizations());
        }

        return $localizations;
    }
962288
public function getCharsets()
    {
        if (null !== $this->charsets) {
            return $this->charsets;
        }

        $charsets = $this->headers->getParameterListAsObject('Accept-Charset');

        return $this->charsets = $charsets->getParameterKeys();
    }
401363
protected function getChars()
    {
        if (isset($this->chars) === true) {
            return $this->chars;
        }

        $this->chars = [
            'a' => [
                        'à', 'á', 'ả', 'ã', 'ạ', 'ă', 'ắ', 'ằ', 'ẳ', 'ẵ',
                        'ặ', 'â', 'ấ', 'ầ', 'ẩ', 'ẫ', 'ậ', 'ä', 'ā', 'ą',
                        'å', 'α', 'ά', 'ἀ', 'ἁ', 'ἂ', 'ἃ', 'ἄ', 'ἅ', 'ἆ',
                        'ἇ', 'ᾀ', 'ᾁ', 'ᾂ', 'ᾃ', 'ᾄ', 'ᾅ', 'ᾆ', 'ᾇ', 'ὰ',
                        'ά', 'ᾰ', 'ᾱ', 'ᾲ', 'ᾳ', 'ᾴ', 'ᾶ', 'ᾷ', 'а', 'أ', ],
            'b' => ['б', 'β', 'Ъ', 'Ь', 'ب'],
            'c' => ['ç', 'ć', 'č', 'ĉ', 'ċ'],
            'd' => ['ď', 'ð', 'đ', 'ƌ', 'ȡ', 'ɖ', 'ɗ', 'ᵭ', 'ᶁ', 'ᶑ',
                        'д', 'δ', 'د', 'ض', ],
            'e' => ['é', 'è', 'ẻ', 'ẽ', 'ẹ', 'ê', 'ế', 'ề', 'ể', 'ễ',
                        'ệ', 'ë', 'ē', 'ę', 'ě', 'ĕ', 'ė', 'ε', 'έ', 'ἐ',
                        'ἑ', 'ἒ', 'ἓ', 'ἔ', 'ἕ', 'ὲ', 'έ', 'е', 'ё', 'э',
                        'є', 'ə', ],
            'f' => ['ф', 'φ', 'ف'],
            'g' => ['ĝ', 'ğ', 'ġ', 'ģ', 'г', 'ґ', 'γ', 'ج'],
            'h' => ['ĥ', 'ħ', 'η', 'ή', 'ح', 'ه'],
            'i' => ['í', 'ì', 'ỉ', 'ĩ', 'ị', 'î', 'ï', 'ī', 'ĭ', 'į',
                            'ı', 'ι', 'ί', 'ϊ', 'ΐ', 'ἰ', 'ἱ', 'ἲ', 'ἳ', 'ἴ',
                            'ἵ', 'ἶ', 'ἷ', 'ὶ', 'ί', 'ῐ', 'ῑ', 'ῒ', 'ΐ', 'ῖ',
                            'ῗ', 'і', 'ї', 'и', ],
            'j' => ['ĵ', 'ј', 'Ј'],
            'k' => ['ķ', 'ĸ', 'к', 'κ', 'Ķ', 'ق', 'ك'],
            'l' => ['ł', 'ľ', 'ĺ', 'ļ', 'ŀ', 'л', 'λ', 'ل'],
            'm' => ['м', 'μ', 'م'],
            'n' => ['ñ', 'ń', 'ň', 'ņ', 'ŉ', 'ŋ', 'ν', 'н', 'ن'],
            'o' => ['ó', 'ò', 'ỏ', 'õ', 'ọ', 'ô', 'ố', 'ồ', 'ổ', 'ỗ',
                            'ộ', 'ơ', 'ớ', 'ờ', 'ở', 'ỡ', 'ợ', 'ø', 'ō', 'ő',
                            'ŏ', 'ο', 'ὀ', 'ὁ', 'ὂ', 'ὃ', 'ὄ', 'ὅ', 'ὸ', 'ό',
                            'ö', 'о', 'و', 'θ', ],
            'p' => ['п', 'π'],
            'r' => ['ŕ', 'ř', 'ŗ', 'р', 'ρ', 'ر'],
            's' => ['ś', 'š', 'ş', 'с', 'σ', 'ș', 'ς', 'س', 'ص'],
            't' => ['ť', 'ţ', 'т', 'τ', 'ț', 'ت', 'ط'],
            'u' => ['ú', 'ù', 'ủ', 'ũ', 'ụ', 'ư', 'ứ', 'ừ', 'ử', 'ữ',
                            'ự', 'ü', 'û', 'ū', 'ů', 'ű', 'ŭ', 'ų', 'µ', 'у', ],
            'v' => ['в'],
            'w' => ['ŵ', 'ω', 'ώ'],
            'x' => ['χ'],
            'y' => ['ý', 'ỳ', 'ỷ', 'ỹ', 'ỵ', 'ÿ', 'ŷ', 'й', 'ы', 'υ',
                            'ϋ', 'ύ', 'ΰ', 'ي', ],
            'z' => ['ź', 'ž', 'ż', 'з', 'ζ', 'ز'],
            'aa' => ['ع'],
            'ae' => ['æ'],
            'ch' => ['ч'],
            'dj' => ['ђ', 'đ'],
            'dz' => ['џ'],
            'gh' => ['غ'],
            'kh' => ['х', 'خ'],
            'lj' => ['љ'],
            'nj' => ['њ'],
            'oe' => ['œ'],
            'ps' => ['ψ'],
            'sh' => ['ш'],
            'shch' => ['щ'],
            'ss' => ['ß'],
            'th' => ['þ', 'ث', 'ذ', 'ظ'],
            'ts' => ['ц'],
            'ya' => ['я'],
            'yu' => ['ю'],
            'zh' => ['ж'],
            '(c)' => ['©'],
            'A' => ['Á', 'À', 'Ả', 'Ã', 'Ạ', 'Ă', 'Ắ', 'Ằ', 'Ẳ', 'Ẵ',
                            'Ặ', 'Â', 'Ấ', 'Ầ', 'Ẩ', 'Ẫ', 'Ậ', 'Ä', 'Å', 'Ā',
                            'Ą', 'Α', 'Ά', 'Ἀ', 'Ἁ', 'Ἂ', 'Ἃ', 'Ἄ', 'Ἅ', 'Ἆ',
                            'Ἇ', 'ᾈ', 'ᾉ', 'ᾊ', 'ᾋ', 'ᾌ', 'ᾍ', 'ᾎ', 'ᾏ', 'Ᾰ',
                            'Ᾱ', 'Ὰ', 'Ά', 'ᾼ', 'А', ],
            'B' => ['Б', 'Β'],
            'C' => ['Ç', 'Ć', 'Č', 'Ĉ', 'Ċ'],
            'D' => ['Ď', 'Ð', 'Đ', 'Ɖ', 'Ɗ', 'Ƌ', 'ᴅ', 'ᴆ', 'Д', 'Δ'],
            'E' => ['É', 'È', 'Ẻ', 'Ẽ', 'Ẹ', 'Ê', 'Ế', 'Ề', 'Ể', 'Ễ',
                            'Ệ', 'Ë', 'Ē', 'Ę', 'Ě', 'Ĕ', 'Ė', 'Ε', 'Έ', 'Ἐ',
                            'Ἑ', 'Ἒ', 'Ἓ', 'Ἔ', 'Ἕ', 'Έ', 'Ὲ', 'Е', 'Ё', 'Э',
                            'Є', 'Ə', ],
            'F' => ['Ф', 'Φ'],
            'G' => ['Ğ', 'Ġ', 'Ģ', 'Г', 'Ґ', 'Γ'],
            'H' => ['Η', 'Ή'],
            'I' => ['Í', 'Ì', 'Ỉ', 'Ĩ', 'Ị', 'Î', 'Ï', 'Ī', 'Ĭ', 'Į',
                            'İ', 'Ι', 'Ί', 'Ϊ', 'Ἰ', 'Ἱ', 'Ἳ', 'Ἴ', 'Ἵ', 'Ἶ',
                            'Ἷ', 'Ῐ', 'Ῑ', 'Ὶ', 'Ί', 'И', 'І', 'Ї', ],
            'K' => ['К', 'Κ'],
            'L' => ['Ĺ', 'Ł', 'Л', 'Λ', 'Ļ'],
            'M' => ['М', 'Μ'],
            'N' => ['Ń', 'Ñ', 'Ň', 'Ņ', 'Ŋ', 'Н', 'Ν'],
            'O' => ['Ó', 'Ò', 'Ỏ', 'Õ', 'Ọ', 'Ô', 'Ố', 'Ồ', 'Ổ', 'Ỗ',
                            'Ộ', 'Ơ', 'Ớ', 'Ờ', 'Ở', 'Ỡ', 'Ợ', 'Ö', 'Ø', 'Ō',
                            'Ő', 'Ŏ', 'Ο', 'Ό', 'Ὀ', 'Ὁ', 'Ὂ', 'Ὃ', 'Ὄ', 'Ὅ',
                            'Ὸ', 'Ό', 'О', 'Θ', 'Ө', ],
            'P' => ['П', 'Π'],
            'R' => ['Ř', 'Ŕ', 'Р', 'Ρ'],
            'S' => ['Ş', 'Ŝ', 'Ș', 'Š', 'Ś', 'С', 'Σ'],
            'T' => ['Ť', 'Ţ', 'Ŧ', 'Ț', 'Т', 'Τ'],
            'U' => ['Ú', 'Ù', 'Ủ', 'Ũ', 'Ụ', 'Ư', 'Ứ', 'Ừ', 'Ử', 'Ữ',
                            'Ự', 'Û', 'Ü', 'Ū', 'Ů', 'Ű', 'Ŭ', 'Ų', 'У', ],
            'V' => ['В'],
            'W' => ['Ω', 'Ώ'],
            'X' => ['Χ'],
            'Y' => ['Ý', 'Ỳ', 'Ỷ', 'Ỹ', 'Ỵ', 'Ÿ', 'Ῠ', 'Ῡ', 'Ὺ', 'Ύ',
                            'Ы', 'Й', 'Υ', 'Ϋ', ],
            'Z' => ['Ź', 'Ž', 'Ż', 'З', 'Ζ'],
            'AE' => ['Æ'],
            'CH' => ['Ч'],
            'DJ' => ['Ђ'],
            'DZ' => ['Џ'],
            'KH' => ['Х'],
            'LJ' => ['Љ'],
            'NJ' => ['Њ'],
            'PS' => ['Ψ'],
            'SH' => ['Ш'],
            'SHCH' => ['Щ'],
            'SS' => ['ẞ'],
            'TH' => ['Þ'],
            'TS' => ['Ц'],
            'YA' => ['Я'],
            'YU' => ['Ю'],
            'ZH' => ['Ж'],
            ' ' => ["\xC2\xA0", "\xE2\x80\x80", "\xE2\x80\x81",
                            "\xE2\x80\x82", "\xE2\x80\x83", "\xE2\x80\x84",
                            "\xE2\x80\x85", "\xE2\x80\x86", "\xE2\x80\x87",
                            "\xE2\x80\x88", "\xE2\x80\x89", "\xE2\x80\x8A",
                            "\xE2\x80\xAF", "\xE2\x81\x9F", "\xE3\x80\x80", ],
        ];

        return $this->chars;
    }
453517
public function getAvailableLanguages()
    {
        $languages = [];

        $paths = $this->fileSystem->getDirectories($this->getLanguagesPath());

        foreach ($paths as $path) {
            $languages[] = substr($path, strlen($this->getLanguagesPath()) + 1);
        }

        return $languages;
    }
1172586
public static function charAsciiControlArray()
    {
        static $result = array();

        if (!$result) {
            for ($i = 0; $i < 32; ++$i) {
                $result[] = \chr($i);
            }
            $result[] = \chr(127);
        }

        return $result;
    }
1066812
protected function getLanguageHelpers()
    {
        return [
            'lang' => function ($args, $named) {
                return Lang::get($args[0], $named);
            },
            'choice' => function ($args, $named) {
                return Lang::choice($args[0], $args[1], $named);
            }
        ];
    }