Return the native language and country names if available, english name otherwise.

@return string
548547
public function getNativeNames() {
		
		$language = $this->getLanguage();
		$country  = $this->getCountry();
		
		$languageName = $language->nativeName ? $language->nativeName : $language->englishName;
		$countryName  = $country->nativeName ? $country->nativeName : $country->englishName;
		
		return $languageName . ' (' . $countryName . ')';
		
	}
230109
public static function data()
    {
        return [
            'sq' => [
                'code'  => 'sq',
                'english' => 'Albanian',
                'local' => 'Shqip',
                'rtl' => false,
            ],
            'en' => [
                'code'  => 'en',
                'english' => 'English',
                'local' => 'English',
                'rtl' => false,
            ],
            'ar' => [
                'code'  => 'ar',
                'english' => 'Arabic',
                'local' => 'العربية‏',
                'rtl' => true,
            ],
            'hy' => [
                'code'  => 'hy',
                'english' => 'Armenian',
                'local' => 'հայերեն',
                'rtl' => false,
            ],
            'az' => [
                'code'  => 'az',
                'english' => 'Azerbaijani',
                'local' => 'Azərbaycan dili',
                'rtl' => false,
            ],
            'af' => [
                'code'  => 'af',
                'english' => 'Afrikaans',
                'local' => 'Afrikaans',
                'rtl' => false,
            ],
            'eu' => [
                'code'  => 'eu',
                'english' => 'Basque',
                'local' => 'Euskara',
                'rtl' => false,
            ],
            'be' => [
                'code'  => 'be',
                'english' => 'Belarusian',
                'local' => 'Беларуская',
                'rtl' => false,
            ],
            'bg' => [
                'code'  => 'bg',
                'english' => 'Bulgarian',
                'local' => 'български',
                'rtl' => false,
            ],
            'bs' => [
                'code'  => 'bs',
                'english' => 'Bosnian',
                'local' => 'Bosanski',
                'rtl' => false,
            ],
            'cy' => [
                'code'  => 'cy',
                'english' => 'Welsh',
                'local' => 'Cymraeg',
                'rtl' => false,
            ],
            'vi' => [
                'code'  => 'vi',
                'english' => 'Vietnamese',
                'local' => 'Tiếng Việt',
                'rtl' => false,
            ],
            'hu' => [
                'code'  => 'hu',
                'english' => 'Hungarian',
                'local' => 'Magyar',
                'rtl' => false,
            ],
            'ht' => [
                'code'  => 'ht',
                'english' => 'Haitian',
                'local' => 'Kreyòl ayisyen',
                'rtl' => false,
            ],
            'gl' => [
                'code'  => 'gl',
                'english' => 'Galician',
                'local' => 'Galego',
                'rtl' => false,
            ],
            'nl' => [
                'code'  => 'nl',
                'english' => 'Dutch',
                'local' => 'Nederlands',
                'rtl' => false,
            ],
            'el' => [
                'code'  => 'el',
                'english' => 'Greek',
                'local' => 'Ελληνικά',
                'rtl' => false,
            ],
            'ka' => [
                'code'  => 'ka',
                'english' => 'Georgian',
                'local' => 'ქართული',
                'rtl' => false,
            ],
            'da' => [
                'code'  => 'da',
                'english' => 'Danish',
                'local' => 'Dansk',
                'rtl' => false,
            ],
            'he' => [
                'code'  => 'he',
                'english' => 'Hebrew',
                'local' => 'עברית',
                'rtl' => true,
            ],
            'id' => [
                'code'  => 'id',
                'english' => 'Indonesian',
                'local' => 'Bahasa Indonesia',
                'rtl' => false,
            ],
            'ga' => [
                'code'  => 'ga',
                'english' => 'Irish',
                'local' => 'Gaeilge',
                'rtl' => false,
            ],
            'it' => [
                'code'  => 'it',
                'english' => 'Italian',
                'local' => 'Italiano',
                'rtl' => false,
            ],
            'is' => [
                'code'  => 'is',
                'english' => 'Icelandic',
                'local' => 'Íslenska',
                'rtl' => false,
            ],
            'es' => [
                'code'  => 'es',
                'english' => 'Spanish',
                'local' => 'Español',
                'rtl' => false,
            ],
            'kk' => [
                'code'  => 'kk',
                'english' => 'Kazakh',
                'local' => 'Қазақша',
                'rtl' => false,
            ],
            'ca' => [
                'code'  => 'ca',
                'english' => 'Catalan',
                'local' => 'Català',
                'rtl' => false,
            ],
            'ky' => [
                'code'  => 'ky',
                'english' => 'Kyrgyz',
                'local' => 'кыргызча',
                'rtl' => false,
            ],
            'zh' => [
                'code'  => 'zh',
                'english' => 'Simplified Chinese',
                'local' => '中文 (简体)',
                'rtl' => false,
            ],
            'tw' => [
                'code'  => 'tw',
                'english' => 'Traditional Chinese',
                'local' => '中文 (繁體)',
                'rtl' => false,
            ],
            'ko' => [
                'code'  => 'ko',
                'english' => 'Korean',
                'local' => '한국어',
                'rtl' => false,
            ],
            'lv' => [
                'code'  => 'lv',
                'english' => 'Latvian',
                'local' => 'Latviešu',
                'rtl' => false,
            ],
            'lt' => [
                'code'  => 'lt',
                'english' => 'Lithuanian',
                'local' => 'Lietuvių',
                'rtl' => false,
            ],
            'mg' => [
                'code'  => 'mg',
                'english' => 'Malagasy',
                'local' => 'Malagasy',
                'rtl' => false,
            ],
            'ms' => [
                'code'  => 'ms',
                'english' => 'Malay',
                'local' => 'Bahasa Melayu',
                'rtl' => false,
            ],
            'mt' => [
                'code'  => 'mt',
                'english' => 'Maltese',
                'local' => 'Malti',
                'rtl' => false,
            ],
            'mk' => [
                'code'  => 'mk',
                'english' => 'Macedonian',
                'local' => 'Македонски',
                'rtl' => false,
            ],
            'mn' => [
                'code'  => 'mn',
                'english' => 'Mongolian',
                'local' => 'Монгол',
                'rtl' => false,
            ],
            'de' => [
                'code'  => 'de',
                'english' => 'German',
                'local' => 'Deutsch',
                'rtl' => false,
            ],
            'no' => [
                'code'  => 'no',
                'english' => 'Norwegian',
                'local' => 'Norsk',
                'rtl' => false,
            ],
            'fa' => [
                'code'  => 'fa',
                'english' => 'Persian',
                'local' => 'فارسی',
                'rtl' => true,
            ],
            'pl' => [
                'code'  => 'pl',
                'english' => 'Polish',
                'local' => 'Polski',
                'rtl' => false,
            ],
            'pt' => [
                'code'  => 'pt',
                'english' => 'Portuguese',
                'local' => 'Português',
                'rtl' => false,
            ],
            'ro' => [
                'code'  => 'ro',
                'english' => 'Romanian',
                'local' => 'Română',
                'rtl' => false,
            ],
            'ru' => [
                'code'  => 'ru',
                'english' => 'Russian',
                'local' => 'Русский',
                'rtl' => false,
            ],
            'sr' => [
                'code'  => 'sr',
                'english' => 'Serbian',
                'local' => 'Српски',
                'rtl' => false,
            ],
            'sk' => [
                'code'  => 'sk',
                'english' => 'Slovak',
                'local' => 'Slovenčina',
                'rtl' => false,
            ],
            'sl' => [
                'code'  => 'sl',
                'english' => 'Slovenian',
                'local' => 'Slovenščina',
                'rtl' => false,
            ],
            'sw' => [
                'code'  => 'sw',
                'english' => 'Swahili',
                'local' => 'Kiswahili',
                'rtl' => false,
            ],
            'tg' => [
                'code'  => 'tg',
                'english' => 'Tajik',
                'local' => 'Тоҷикӣ',
                'rtl' => false,
            ],
            'th' => [
                'code'  => 'th',
                'english' => 'Thai',
                'local' => 'ภาษาไทย',
                'rtl' => false,
            ],
            'tl' => [
                'code'  => 'tl',
                'english' => 'Tagalog',
                'local' => 'Tagalog',
                'rtl' => false,
            ],
            'tt' => [
                'code'  => 'tt',
                'english' => 'Tatar',
                'local' => 'Tatar',
                'rtl' => false,
            ],
            'tr' => [
                'code'  => 'tr',
                'english' => 'Turkish',
                'local' => 'Türkçe',
                'rtl' => false,
            ],
            'uz' => [
                'code'  => 'uz',
                'english' => 'Uzbek',
                'local' => 'O\'zbek',
                'rtl' => false,
            ],
            'uk' => [
                'code'  => 'uk',
                'english' => 'Ukrainian',
                'local' => 'Українська',
                'rtl' => false,
            ],
            'fi' => [
                'code'  => 'fi',
                'english' => 'Finnish',
                'local' => 'Suomi',
                'rtl' => false,
            ],
            'fr' => [
                'code'  => 'fr',
                'english' => 'French',
                'local' => 'Français',
                'rtl' => false,
            ],
            'hr' => [
                'code'  => 'hr',
                'english' => 'Croatian',
                'local' => 'Hrvatski',
                'rtl' => false,
            ],
            'cs' => [
                'code'  => 'cs',
                'english' => 'Czech',
                'local' => 'Čeština',
                'rtl' => false,
            ],
            'sv' => [
                'code'  => 'sv',
                'english' => 'Swedish',
                'local' => 'Svenska',
                'rtl' => false,
            ],
            'et' => [
                'code'  => 'et',
                'english' => 'Estonian',
                'local' => 'Eesti',
                'rtl' => false,
            ],
            'ja' => [
                'code'  => 'ja',
                'english' => 'Japanese',
                'local' => '日本語',
                'rtl' => false,
            ],
            'hi' => [
                'code'  => 'hi',
                'english' => 'Hindi',
                'local' => 'हिंदी',
                'rtl' => false,
            ],
            'ur' => [
                'code'  => 'ur',
                'english' => 'Urdu',
                'local' => 'اردو',
                'rtl' => false,
            ],
            'co' => [
                'code'  => 'co',
                'english' => 'Corsican',
                'local' => 'Corsu',
                'rtl' => false,
            ],
            'fj' => [
                'code'  => 'fj',
                'english' => 'Fijian',
                'local' => 'Vosa Vakaviti',
                'rtl' => false,
            ],
            'hw' => [
                'code'  => 'hw',
                'english' => 'Hawaiian',
                'local' => '‘Ōlelo Hawai‘i',
                'rtl' => false,
            ],
            'ig' => [
                'code'  => 'ig',
                'english' => 'Igbo',
                'local' => 'Igbo',
                'rtl' => false,
            ],
            'ny' => [
                'code'  => 'ny',
                'english' => 'Chichewa',
                'local' => 'chiCheŵa',
                'rtl' => false,
            ],
            'ps' => [
                'code'  => 'ps',
                'english' => 'Pashto',
                'local' => 'پښت',
                'rtl' => false,
            ],
            'sd' => [
                'code'  => 'sd',
                'english' => 'Sindhi',
                'local' => 'سنڌي، سندھی, सिन्धी',
                'rtl' => false,
            ],
            'sn' => [
                'code'  => 'sn',
                'english' => 'Shona',
                'local' => 'chiShona',
                'rtl' => false,
            ],
            'to' => [
                'code'  => 'to',
                'english' => 'Tongan',
                'local' => 'faka-Tonga',
                'rtl' => false,
            ],
            'yo' => [
                'code'  => 'yo',
                'english' => 'Yoruba',
                'local' => 'Yorùbá',
                'rtl' => false,
            ],
            'zu' => [
                'code'  => 'zu',
                'english' => 'Zulu',
                'local' => 'isiZulu',
                'rtl' => false,
            ],
            'ty' => [
                'code'  => 'ty',
                'english' => 'Tahitian',
                'local' => 'te reo Tahiti, te reo Māʼohi',
                'rtl' => false,
            ],
            'sm' => [
                'code'  => 'sm',
                'english' => 'Samoan',
                'local' => 'gagana fa\'a Samoa',
                'rtl' => false,
            ],
            'ku' => [
                'code'  => 'ku',
                'english' => 'Kurdish',
                'local' => 'كوردی',
                'rtl' => false,
            ],
            'ha' => [
                'code'  => 'ha',
                'english' => 'Hausa',
                'local' => 'هَوُسَ',
                'rtl' => false,
            ],
            'bn' => [
                'code'  => 'bn',
                'english' => 'Bengali',
                'local' => 'বাংলা',
                'rtl' => false,
            ],
            'st' => [
                'code'  => 'st',
                'english' => 'Southern Sotho',
                'local' => 'seSotho',
                'rtl' => false,
            ],
            'ba' => [
                'code'  => 'ba',
                'english' => 'Bashkir',
                'local' => 'башҡорт теле',
                'rtl' => false,
            ],
            'jv' => [
                'code'  => 'jv',
                'english' => 'Javanese',
                'local' => 'Wong Jawa',
                'rtl' => false,
            ],
            'kn' => [
                'code'  => 'kn',
                'english' => 'Kannada',
                'local' => 'ಕನ್ನಡ',
                'rtl' => false,
            ],
            'la' => [
                'code'  => 'la',
                'english' => 'Latin',
                'local' => 'Latine',
                'rtl' => false,
            ],
            'lo' => [
                'code'  => 'lo',
                'english' => 'Lao',
                'local' => 'ພາສາລາວ',
                'rtl' => false,
            ],
            'mi' => [
                'code'  => 'mi',
                'english' => 'Māori',
                'local' => 'te reo Māori',
                'rtl' => false,
            ],
            'ml' => [
                'code'  => 'ml',
                'english' => 'Malayalam',
                'local' => 'മലയാളം',
                'rtl' => false,
            ],
            'mr' => [
                'code'  => 'mr',
                'english' => 'Marathi',
                'local' => 'मराठी',
                'rtl' => false,
            ],
            'ne' => [
                'code'  => 'ne',
                'english' => 'Nepali',
                'local' => 'नेपाली',
                'rtl' => false,
            ],
            'pa' => [
                'code'  => 'pa',
                'english' => 'Punjabi',
                'local' => 'ਪੰਜਾਬੀ',
                'rtl' => false,
            ],
            'so' => [
                'code'  => 'so',
                'english' => 'Somali',
                'local' => 'Soomaaliga',
                'rtl' => false,
            ],
            'su' => [
                'code'  => 'su',
                'english' => 'Sundanese',
                'local' => 'Sundanese',
                'rtl' => false,
            ],
            'te' => [
                'code'  => 'te',
                'english' => 'Telugu',
                'local' => 'తెలుగు',
                'rtl' => false,
            ],
            'yi' => [
                'code'  => 'yi',
                'english' => 'Yiddish',
                'local' => 'ייִדיש',
                'rtl' => false,
            ],
            'am' => [
                'code'  => 'am',
                'english' => 'Amharic',
                'local' => 'አማርኛ',
                'rtl' => false,
            ],
            'eo' => [
                'code'  => 'eo',
                'english' => 'Esperanto',
                'local' => 'Esperanto',
                'rtl' => false,
            ],
            'fy' => [
                'code'  => 'fy',
                'english' => 'Western Frisian',
                'local' => 'frysk',
                'rtl' => false,
            ],
            'gd' => [
                'code'  => 'gd',
                'english' => 'Scottish Gaelic',
                'local' => 'Gàidhlig',
                'rtl' => false,
            ],
            'gu' => [
                'code'  => 'gu',
                'english' => 'Gujarati',
                'local' => 'ગુજરાતી',
                'rtl' => false,
            ],
            'km' => [
                'code'  => 'km',
                'english' => 'Central Khmer',
                'local' => 'ភាសាខ្មែរ',
                'rtl' => false,
            ],
            'lb' => [
                'code'  => 'lb',
                'english' => 'Luxembourgish',
                'local' => 'Lëtzebuergesch',
                'rtl' => false,
            ],
            'my' => [
                'code'  => 'my',
                'english' => 'Burmese',
                'local' => 'မျန္မာစာ',
                'rtl' => false,
            ],
            'si' => [
                'code'  => 'si',
                'english' => 'Sinhalese',
                'local' => 'සිංහල',
                'rtl' => false,
            ],
            'ta' => [
                'code'  => 'ta',
                'english' => 'Tamil',
                'local' => 'தமிழ்',
                'rtl' => false,
            ],
            'xh' => [
                'code'  => 'xh',
                'english' => 'Xhosa',
                'local' => 'isiXhosa',
                'rtl' => false,
            ],
            'fl' => [
                'code'  => 'fl',
                'english' => 'Filipino',
                'local' => 'Pilipino',
                'rtl' => false,
            ]
        ];
    }
1176465
protected function getFieldName(): string
    {
        if ($this->language === null) {
            return $this->name;
        }

        return $this->name . '_' . strtolower($this->language->getShortName());
    }
436531
public function languageDetection() {
        $current_url = $this->getSession()->getCurrentUrl();
        $base_url = $this->getMinkParameter('base_url');
        // Checks whether the last symbol in the base_url is /, if not it adds it
        if (substr($base_url, -1) != "/") {
            $base_url = $base_url."/";
        }
        $base_url_length = strlen($base_url);
        //Get the 2 symbols in current URL after the base_url when Clean URLs is enabled
        $clean_url_language_code = substr($current_url,$base_url_length,2);
        $not_clean_url_language_code = substr($current_url,$base_url_length+3,2);
        if(in_array($clean_url_language_code,$this->languages_iso_codes) && substr($current_url,$base_url_length+2,1) == "/") {
            return $clean_url_language_code;
        }
        else if (in_array($not_clean_url_language_code,$this->languages_iso_codes) && substr($current_url,$base_url_length+5,1) == "/"){
            return $not_clean_url_language_code;
        }
        else return $this->multilingual_parameters['default_language'];
    }
371264
public function getNames(): array
    {
        if (!$this->names) {
            $this->names = static::all()[$this->code] ?? [
                'isoName' => $this->code,
                'nativeName' => $this->code,
            ];
        }

        return $this->names;
    }
1338537
public function list_languages()
    {
        static $sa_languages = array();

        if (!count($sa_languages)) {
            @include(RCUBE_LOCALIZATION_DIR . 'index.inc');

            if ($dh = @opendir(RCUBE_LOCALIZATION_DIR)) {
                while (($name = readdir($dh)) !== false) {
                    if ($name[0] == '.' || !is_dir(RCUBE_LOCALIZATION_DIR . $name)) {
                        continue;
                    }

                    if ($label = $rcube_languages[$name]) {
                        $sa_languages[$name] = $label;
                    }
                }
                closedir($dh);
            }
        }

        return $sa_languages;
    }
721664
public function fullName(): string
    {
        if ($this->canShowName()) {
            $tmp = $this->getAllNames();

            return $tmp[$this->getPrimaryName()]['full'];
        }

        return I18N::translate('Private');
    }
188393
private function getAvailableLanguages()
    {
        if ($this->availableLanguages === null) {
            $this->availableLanguages = [];

            if (!empty($this->LLkey)) {
                $this->availableLanguages[] = $this->LLkey;
            }
            // The key for English is "default", not "en".
            $this->availableLanguages = str_replace(
                'en',
                'default',
                $this->availableLanguages
            );
            // Remove duplicates in case the default language is the same as the fall-back language.
            $this->availableLanguages = array_unique($this->availableLanguages);

            // Now check that we only keep languages for which we have
            // translations.
            foreach ($this->availableLanguages as $index => $code) {
                if (!isset($this->LOCAL_LANG[$code])) {
                    unset($this->availableLanguages[$index]);
                }
            }
        }

        return $this->availableLanguages;
    }
332024
protected static String getLang() {
        Locale locale = Locale.getDefault();

        if (null == locale)
            return DEFAULT_LANGUAGE_CODE;

        String language = locale.getLanguage();
        String country = locale.getCountry();
        String localeString = String.format("%s_%s",
                language != null ? language.toLowerCase(Locale.ENGLISH) : "",
                country != null ? country.toUpperCase(Locale.ENGLISH) : "");

        // 1. if no language is specified, return the default language
        if (null == language)
            return DEFAULT_LANGUAGE_CODE;

        // 2. try to match the language or the entire locale string among the
        // list of available language codes
        String matchedLanguageCode = null;
        for (String languageCode : VALID_LANGUAGE_CODES) {
            if (languageCode.equals(localeString)) {
                // return here as this is the most precise match we can get
                return localeString;
            }

            if (languageCode.equals(language)) {
                // set the matched language code, and continue iterating as we
                // may match the localeString in a later iteration.
                matchedLanguageCode = language;
            }
        }

        if (null != matchedLanguageCode)
            return matchedLanguageCode;

        return DEFAULT_LANGUAGE_CODE;
    }
763034
public function getAmazonLanguage()
    {
        //Get all languages from module settings
        $aLanguages = $this->getConfig()->getConfigParam('aAmazonLanguages');
        $sLanguageAbbr = $this->getLanguage()->getLanguageAbbr();

        //Return Amazon Lang string if it exists in array else return null
        return isset($aLanguages[$sLanguageAbbr]) ? $aLanguages[$sLanguageAbbr] : $sLanguageAbbr;
    }
804367
public function languageName()
    {
        /** @var eZContentLanguage $language */
        $language = eZContentLanguage::fetchByLocale( $this->attribute( 'locale' ) );

        if ( $language instanceof eZContentLanguage )
            return array( 'locale' => $language->attribute( 'locale' ), 'name' => $language->attribute( 'name' ) );

        return false;
    }
1254425
public function getTranslationsList()
    {
        $data = "";
        $melisCmsAuth = $this->getServiceLocator()->get('MelisCoreAuth');
        $melisCmsRights = $this->getServiceLocator()->get('MelisCoreRights');

        return $data;

    }
311924
public static function getNameMap(): array
    {
        if (self::$nameMap === null) {
            self::$nameMap = [];
            $countries     = self::getLoader()->all();

            foreach ($countries as $country) {
                self::$nameMap[$country['alpha2']] = $country['name'];
            }

            self::$alpha2CodeMap = array_flip(self::$nameMap);
        }

        return self::$nameMap;
    }
1034719
public function getNativeOfficialName($languageCode = null): ?string
    {
        $languageCode = $languageCode ? mb_strtolower($languageCode) : null;

        return $this->get("name.native.{$languageCode}.official")
            ?: (current($this->get('name.native', []))['official'] ?: $this->get('native_official_name'));
    }
704620
private function getLanguages()
    {
        $directories = glob($this->basePath.'/*', GLOB_ONLYDIR);

        $languages = array_map(function ($dir) {
            $name = basename($dir);

            return in_array($name, $this->excluded, true) ? null : $name;
        }, $directories);

        return array_filter($languages);
    }
264530
public function getLanguage()
    {
        if ($this->language)
            return $this->language;
        if ($this->defaultLanguage)
            return $this->defaultLanguage;
        $prefered = $this->getPreferredLanguage();
        if (in_array($prefered, $this->availableLanguages))
            return $prefered;
        return $this->availableLanguages[0]; // if nothing works return first language from the list
    }
836406
public function getCountry()
    {
        if (strstr(Yii::app()->language, '_')) {
            return substr(strstr(Yii::app()->language, '_'), 1);
        } else {
            return null;
        }
    }