Returns the translated country name based on the given two letter country code.

@param string $twoLetterCode The two letter country code

@return string
484778
public function mapTwoLetterToName(string $twoLetterCode): string
    {
        $threeLetterCode = array_search($twoLetterCode, $this->iso3166(), true);
        $threeLetterCode = $threeLetterCode ?: '???';

        return $this->getAllCountries()[$threeLetterCode];
    }
1134092
def get_country_code(longname):
    
    mo = re.search(REGEX, longname, re.I)
    if mo is None:
        raise ValueError('Could not find a valid country in %s' % longname)
    return country2code[COUNTRIES[mo.lastindex - 1]]
941810
public static function countryCode($sCountryName)
    {
        $sCountryName = strtolower($sCountryName);

        $aCountries = array_flip(self::$aCountries);

        if(isset($aCountries[$sCountryName])){
            return $aCountries[$sCountryName];
        }

        return false;
    }
1023747
public function getSecondaryName(): int
    {
        if ($this->getSecondaryName === null) {
            // Generally, the primary and secondary names are the same
            $this->getSecondaryName = $this->getPrimaryName();
            // ....except when there are names with different character sets
            $all_names = $this->getAllNames();
            if (count($all_names) > 1) {
                $primary_script = I18N::textScript($all_names[$this->getPrimaryName()]['sort']);
                foreach ($all_names as $n => $name) {
                    if ($n !== $this->getPrimaryName() && $name['type'] !== '_MARNM' && I18N::textScript($name['sort']) !== $primary_script) {
                        $this->getSecondaryName = $n;
                        break;
                    }
                }
            }
        }

        return $this->getSecondaryName;
    }
417013
public static function getCountryCode($countryName)
    {
        foreach (self::$countries as $key => $value) {
            if (!strcasecmp($value, $countryName)) {
                return $key;
            }
        }
        return '';
    }
751880
public static function country($code, $translate = true): string
    {
        return Locale::getDisplayRegion("_$code", $translate ? Yii::$app->language : 'en');
    }
592374
public function getRegionCode()
    {
        $format_pattern = $this->getFormatPattern();

        if ($format_pattern !== null) {
            $matches = [];

            switch ($format_pattern) {
                case self::FORMAT_PATTERN_1: // X000XX77_OR_X000XX777
                    \preg_match('~(?<region_code>\d{2,3})$~D', $this->value, $matches);
                    break;

                case self::FORMAT_PATTERN_2: // X000XX
                    break;

                case self::FORMAT_PATTERN_3: // XX00077
                case self::FORMAT_PATTERN_4: // 0000XX77
                case self::FORMAT_PATTERN_5: // XX000077
                case self::FORMAT_PATTERN_6: // X000077
                case self::FORMAT_PATTERN_7: // 000X77
                case self::FORMAT_PATTERN_8: // 0000X77
                    \preg_match('~(?<region_code>\d{2})$~D', $this->value, $matches);
                    break;
            }

            if (isset($matches['region_code']) && ! empty($region_code = $matches['region_code'])) {
                return (int) $region_code;
            }
        }
    }
1328025
protected function _getCountryByCode($sCountryCode)
    {
        //default country
        $sCountry = 'international';

        if (!empty($sCountryCode)) {
            $aLangIds = \OxidEsales\Eshop\Core\Registry::getLang()->getLanguageIds();
            $iEnglishId = array_search("en", $aLangIds);
            if (false !== $iEnglishId) {
                $sViewName = getViewName("oxcountry", $iEnglishId);
                $sQ = "select oxtitle from {$sViewName} where oxisoalpha2 = " . \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quote($sCountryCode);
                // Value does not change that often, reading from slave is ok here (see ESDEV-3804 and ESDEV-3822).
                $sCountryName = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->getOne($sQ);
                if ($sCountryName) {
                    $sCountry = $sCountryName;
                }
            } else {
                // handling when english language is deleted
                switch ($sCountryCode) {
                    case 'de':
                        return 'germany';
                    default:
                        return 'international';
                }
            }
        }

        return strtolower($sCountry);
    }
1257642
public function getPNOEncoding()
    {
        $this->_checkLocale();

        $country = KlarnaCountry::getCode($this->_country);

        return KlarnaEncoding::get($country);
    }
1149587
public function country($code, $locale = null)
    {
        $name = Intl::getRegionBundle()->getCountryName($code, $locale ?: $this->localeDetector->getLocale());

        return $name ? $this->fixCharset($name) : '';
    }
819212
private function normalized(string $languageCode): string
    {
        if (\in_array($languageCode, self::LANGUAGE_CODES)) {
            return $languageCode;
        }
        $twoLetters = substr($languageCode, 0, 2);
        if (\in_array($twoLetters, self::LANGUAGE_CODES)) {
            return $twoLetters;
        }
        if ('zh_CN' === $languageCode || 'zh_HK' === $languageCode) {
            return 'zh-CN';
        }
        if ('zh_TW' === $languageCode) {
            return 'zh-TW';
        }
        throw new InvalidLanguageCodeException($languageCode, $this->getServiceAlias());
    }
442429
public static function currencySymbol($code = null)
    {
        $localeCode = \Locale::getDefault();
        if ($code !== null) {
            $localeCode .= '@currency=' . $code;
        }
        $formatter = new \NumberFormatter($localeCode, \NumberFormatter::CURRENCY);
        $symbol = $formatter->getSymbol(\NumberFormatter::CURRENCY_SYMBOL);
        return $symbol != $code
            ? $symbol
            : (static::countryCurrencySymbol(substr($code, 0, 2))
                ?: $symbol);
    }
511558
public function getNumericCountry()
    {
        $country = $this->getCountry();

        if ( !is_null($country) && !is_numeric($country) )
        {
            $iso3166 = new ISO3166();

            if ( strlen($country) == 2 )
            {
                $country = $iso3166->getByAlpha2($country)['numeric'];
            }
            elseif ( strlen($country) == 3 )
            {
                $country = $iso3166->getByAlpha3($country)['numeric'];
            }
            else
            {
                throw new InvalidRequestException("The country parameter must be ISO 3166-1 numeric, aplha2 or alpha3.");
            }
        }

        return $country;
    }
838226
private function removeCountryCode($code)
    {

        // Get the seven first digits
        $first7 = substr($code, 0, 7);

        // Select the right set of rules according to the product code
        foreach ($this->getRanges()->getPrefixes() as $p) {
            if ($p['Prefix'] == $this->getProduct()) {
                $rules = $p['Rules']['Rule'];
                break;
            }
        }

        // If product code was not found, cannot proceed
        if (empty($rules)) {
            return null;
        }

        // Select the right rule
        foreach ($rules as $r) {
            $ra = explode('-', $r['Range']);
            if ($first7 >= $ra[0] && $first7 <= $ra[1]) {
                $length = $r['Length'];
                break;
            }
        }

        // Country code is invalid
        if ($length === "0") {
            $this->setValid(false);
            $this->addError(self::ERROR_INVALID_COUNTRY_CODE);
            return $code;
        }

        $this->setCountry(substr($code, 0, $length));
        $code = substr($code, $length);

        return $code;
    }
927597
public function getCountryName($inLocale = null)
    {
        $inLocale = Locale::sanitizeLocale($inLocale, $this->locale);

        return \Locale::getDisplayRegion($this->locale, $inLocale);
    }
515392
public function col_country($data) {
        if (!empty($this->countries[$data->country])) {
            return $this->countries[$data->country];
        }
        return '';
    }
1194714
def translate_pair(self, code):
        
        name = self.countries[code]
        if code in self.OLD_NAMES:
            # Check if there's an older translation available if there's no
            # translation for the newest name.
            with override(None):
                source_name = force_text(name)
            name = force_text(name)
            if name == source_name:
                for old_name in self.OLD_NAMES[code]:
                    with override(None):
                        source_old_name = force_text(old_name)
                    old_name = force_text(old_name)
                    if old_name != source_old_name:
                        name = old_name
                        break
        else:
            name = force_text(name)
        return CountryTuple(code, name)