Convert country code to name
Note: If code is missing in countries list just return code
@param {String} code - country code
@returns {String} country name
494400
function countryCodeToName (code) {
  const country = countries.find((country) => country.code === code)

  if (!country) {
    return code
  }

  return country.name
}
868556
public static function countryName($sCode)
    {
        $sCode = strtolower($sCode);

        if(isset(self::$aCountries[$sCode])){
            return self::$aCountries[$sCode];
        }

        return false;
    }
1104243
public static function country2locale($code) {
    # http://wiki.openstreetmap.org/wiki/Nominatim/Country_Codes
    $arr = array(
      'ad' => 'ca',
      'ae' => 'ar',
      'af' => 'fa,ps',
      'ag' => 'en',
      'ai' => 'en',
      'al' => 'sq',
      'am' => 'hy',
      'an' => 'nl,en',
      'ao' => 'pt',
      'aq' => 'en',
      'ar' => 'es',
      'as' => 'en,sm',
      'at' => 'de',
      'au' => 'en',
      'aw' => 'nl,pap',
      'ax' => 'sv',
      'az' => 'az',
      'ba' => 'bs,hr,sr',
      'bb' => 'en',
      'bd' => 'bn',
      'be' => 'nl,fr,de',
      'bf' => 'fr',
      'bg' => 'bg',
      'bh' => 'ar',
      'bi' => 'fr',
      'bj' => 'fr',
      'bl' => 'fr',
      'bm' => 'en',
      'bn' => 'ms',
      'bo' => 'es,qu,ay',
      'br' => 'pt',
      'bq' => 'nl,en',
      'bs' => 'en',
      'bt' => 'dz',
      'bv' => 'no',
      'bw' => 'en,tn',
      'by' => 'be,ru',
      'bz' => 'en',
      'ca' => 'en,fr',
      'cc' => 'en',
      'cd' => 'fr',
      'cf' => 'fr',
      'cg' => 'fr',
      'ch' => 'de,fr,it,rm',
      'ci' => 'fr',
      'ck' => 'en,rar',
      'cl' => 'es',
      'cm' => 'fr,en',
      'cn' => 'zh',
      'co' => 'es',
      'cr' => 'es',
      'cu' => 'es',
      'cv' => 'pt',
      'cw' => 'nl',
      'cx' => 'en',
      'cy' => 'el,tr',
      'cz' => 'cs',
      'de' => 'de',
      'dj' => 'fr,ar,so',
      'dk' => 'da',
      'dm' => 'en',
      'do' => 'es',
      'dz' => 'ar',
      'ec' => 'es',
      'ee' => 'et',
      'eg' => 'ar',
      'eh' => 'ar,es,fr',
      'er' => 'ti,ar,en',
      'es' => 'es,ast,ca,eu,gl',
      'et' => 'am,om',
      'fi' => 'fi,sv,se',
      'fj' => 'en',
      'fk' => 'en',
      'fm' => 'en',
      'fo' => 'fo',
      'fr' => 'fr',
      'ga' => 'fr',
      'gb' => 'en,ga,cy,gd,kw',
      'gd' => 'en',
      'ge' => 'ka',
      'gf' => 'fr',
      'gg' => 'en',
      'gh' => 'en',
      'gi' => 'en',
      'gl' => 'kl,da',
      'gm' => 'en',
      'gn' => 'fr',
      'gp' => 'fr',
      'gq' => 'es,fr,pt',
      'gr' => 'el',
      'gs' => 'en',
      'gt' => 'es',
      'gu' => 'en,ch',
      'gw' => 'pt',
      'gy' => 'en',
      'hk' => 'zh,en',
      'hm' => 'en',
      'hn' => 'es',
      'hr' => 'hr',
      'ht' => 'fr,ht',
      'hu' => 'hu',
      'id' => 'id',
      'ie' => 'en,ga',
      'il' => 'he',
      'im' => 'en',
      'in' => 'hi,en',
      'io' => 'en',
      'iq' => 'ar,ku',
      'ir' => 'fa',
      'is' => 'is',
      'it' => 'it,de,fr',
      'je' => 'en',
      'jm' => 'en',
      'jo' => 'ar',
      'jp' => 'ja',
      'ke' => 'sw,en',
      'kg' => 'ky,ru',
      'kh' => 'km',
      'ki' => 'en',
      'km' => 'ar,fr',
      'kn' => 'en',
      'kp' => 'ko',
      'kr' => 'ko,en',
      'kw' => 'ar',
      'ky' => 'en',
      'kz' => 'kk,ru',
      'la' => 'lo',
      'lb' => 'ar,fr',
      'lc' => 'en',
      'li' => 'de',
      'lk' => 'si,ta',
      'lr' => 'en',
      'ls' => 'en,st',
      'lt' => 'lt',
      'lu' => 'lb,fr,de',
      'lv' => 'lv',
      'ly' => 'ar',
      'ma' => 'ar',
      'mc' => 'fr',
      'md' => 'ru,uk,ro',
      'me' => 'srp,sq,bs,hr,sr',
      'mf' => 'fr',
      'mg' => 'mg,fr',
      'mh' => 'en,mh',
      'mk' => 'mk',
      'ml' => 'fr',
      'mm' => 'my',
      'mn' => 'mn',
      'mo' => 'zh,en,pt',
      'mp' => 'ch',
      'mq' => 'fr',
      'mr' => 'ar,fr',
      'ms' => 'en',
      'mt' => 'mt,en',
      'mu' => 'mfe,fr,en',
      'mv' => 'dv',
      'mw' => 'en,ny',
      'mx' => 'es',
      'my' => 'ms,zh,en',
      'mz' => 'pt',
      'na' => 'en,sf,de',
      'nc' => 'fr',
      'ne' => 'fr',
      'nf' => 'en,pih',
      'ng' => 'en',
      'ni' => 'es',
      'nl' => 'nl',
      'no' => 'nb,nn,no,se',
      'np' => 'ne',
      'nr' => 'na,en',
      'nu' => 'niu,en',
      'nz' => 'en,mi',
      'om' => 'ar',
      'pa' => 'es',
      'pe' => 'es',
      'pf' => 'fr',
      'pg' => 'en,tpi,ho',
      'ph' => 'en,tl',
      'pk' => 'en,ur',
      'pl' => 'pl',
      'pm' => 'fr',
      'pn' => 'en,pih',
      'pr' => 'es,en',
      'ps' => 'ar,he',
      'pt' => 'pt',
      'pw' => 'en,pau,ja,sov,tox',
      'py' => 'es,gn',
      'qa' => 'ar',
      're' => 'fr',
      'ro' => 'ro',
      'rs' => 'sr',
      'ru' => 'ru',
      'rw' => 'rw,fr,en',
      'sa' => 'ar',
      'sb' => 'en',
      'sc' => 'fr,en,crs',
      'sd' => 'ar,en',
      'se' => 'sv',
      'sg' => 'en,ms,zh,ta',
      'sh' => 'en',
      'si' => 'sl',
      'sj' => 'no',
      'sk' => 'sk',
      'sl' => 'en',
      'sm' => 'it',
      'sn' => 'fr',
      'so' => 'so,ar',
      'sr' => 'nl',
      'st' => 'pt',
      'ss' => 'en',
      'sv' => 'es',
      'sx' => 'nl,en',
      'sy' => 'ar',
      'sz' => 'en,ss',
      'tc' => 'en',
      'td' => 'fr,ar',
      'tf' => 'fr',
      'tg' => 'fr',
      'th' => 'th',
      'tj' => 'tg,ru',
      'tk' => 'tkl,en,sm',
      'tl' => 'pt,tet',
      'tm' => 'tk',
      'tn' => 'ar',
      'to' => 'en',
      'tr' => 'tr',
      'tt' => 'en',
      'tv' => 'en',
      'tw' => 'zh',
      'tz' => 'sw,en',
      'ua' => 'uk',
      'ug' => 'en,sw',
      'um' => 'en',
      'us' => 'en,es',
      'uy' => 'es',
      'uz' => 'uz,kaa',
      'va' => 'it',
      'vc' => 'en',
      've' => 'es',
      'vg' => 'en',
      'vi' => 'en',
      'vn' => 'vi',
      'vu' => 'bi,en,fr',
      'wf' => 'fr',
      'ws' => 'sm,en',
      'ye' => 'ar',
      'yt' => 'fr',
      'za' => 'zu,xh,af,st,tn,en',
      'zm' => 'en',
      'zw' => 'en,sn,nd'
    );
    #----
    $code = strtolower($code);
    if ($code == 'eu') {
      return 'en_GB';
    }
    elseif ($code == 'ap') { # Asia Pacific
      return 'en_US';
    }
    elseif ($code == 'cs') {
       return 'sr_RS';
    }
    #----
    if ($code == 'uk') {
      $code = 'gb';
    }
    if (array_key_exists($code, $arr)) {
      if (strpos($arr[$code], ',') !== false) {
        $new = explode(',', $arr[$code]);
        $loc = array();
        foreach ($new as $key => $val) {
          $loc[] = $val.'_'.strtoupper($code);
        }
        return implode(',', $loc); # string; comma-separated values 'en_GB,ga_GB,cy_GB,gd_GB,kw_GB'
      }
      else {
        return $arr[$code].'_'.strtoupper($code); # string 'en_US'
      }
    }
    return 'en_US';
  }
736148
function(fn) {
  var code = fn.toString();
  var match = code.match(/^(?:(?:function)?[\s]*\(([^)]*)\)|([^\=\(]+))/);
  var args = (match[1] || match[2]);
  if (typeof args === 'undefined') {
    return [];
  }
  return args.split(',').map(function(item) {
    return item.trim();
  }).filter(function(item) {
    return item;
  });
}
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]]
44388
def get_culture_pair(self, code):
        
        if not any(x in code for x in ('_', '-')):
            raise ValueError("%s is not a valid culture code" % code)

        cc = CultureCode.objects.get(code=code.replace('_', '-'))
        return cc.language, cc.country
1118039
public static function simpleCountries(string $code = null)
    {
        $file = __DIR__ . "/../Assets/Countries.json";
        $json = json_decode(file_get_contents($file), true);

        if ($code) {
            return $json[$code];
        }

        return Collection::make($json);
    }
775567
function findLanguageNameFromCode( languageCode ) {
  var a = 0;
  var b = LANGUAGES.length;
  var m = b;
  var item, code, name;

  languageCode = languageCode.toLowerCase();

  while( b - a > 1 ) {
    m = Math.floor( (a + b) / 2 );
    item = LANGUAGES[m];
    code = item[0];
    name = item[1];
    if( code == languageCode ) return name;
    if( languageCode < code ) b = m;
    else a = m;
  }
  return null;
}
1311072
public function country($code){
		$geo = Geo::getCountry($code);
		$this->applyFilter($geo);
		return \Response::json($geo);
	}
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;
    }
139133
function getCode(code, language) {
    if (prism.languages.hasOwnProperty(language)) {
        code = prism.highlight(code, prism.languages[language]);
        return `<pre class="language-${language}"><code>${code}</code></pre>`;
    } else {
        return `<pre class="language-unknown"><code>${code}</code></pre>`;
    }
}
671079
def country(code, limit, params = {})
      paginating_collection(
        limit,
        PER_PAGE,
        {"ResponseGroup" => "Country", "CountryCode" => code.to_s.upcase},
        params,
        &top_sites_parser
      )
    end
153033
function toknam(code) {
  var keys = Object.keys(C);
  for (var i = 0, l = keys.length; i < l; i++) {
    var key = keys[i];
    if (C[key] === code) { return key; }
  }
  return code && ("0x" + code.toString(16));
}
884167
function createOption(country) {
          var option = document.createElement('option');

          for (var attr in country) {
            option.dataset[attr] = country[attr];
          }
          option.value = country.code;
          option.textContent = country.name;

          return option;
        }
368490
def currency_code=(currency_code)
      validator = EnumAttributeValidator.new('String', ["UNKNOWN_CURRENCY", "AED", "AFN", "ALL", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN", "BAM", "BBD", "BDT", "BGN", "BHD", "BIF", "BMD", "BND", "BOB", "BOV", "BRL", "BSD", "BTN", "BWP", "BYR", "BZD", "CAD", "CDF", "CHE", "CHF", "CHW", "CLF", "CLP", "CNY", "COP", "COU", "CRC", "CUC", "CUP", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ERN", "ETB", "EUR", "FJD", "FKP", "GBP", "GEL", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR", "ILS", "INR", "IQD", "IRR", "ISK", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LTL", "LVL", "LYD", "MAD", "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MRO", "MUR", "MVR", "MWK", "MXN", "MXV", "MYR", "MZN", "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "OMR", "PAB", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG", "QAR", "RON", "RSD", "RUB", "RWF", "SAR", "SBD", "SCR", "SDG", "SEK", "SGD", "SHP", "SLL", "SOS", "SRD", "SSP", "STD", "SVC", "SYP", "SZL", "THB", "TJS", "TMT", "TND", "TOP", "TRY", "TTD", "TWD", "TZS", "UAH", "UGX", "USD", "USN", "USS", "UYI", "UYU", "UZS", "VEF", "VND", "VUV", "WST", "XAF", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "XCD", "XDR", "XOF", "XPD", "XPF", "XPT", "XTS", "XXX", "YER", "ZAR", "ZMK", "ZMW", "BTC"])
      unless validator.valid?(currency_code)
        fail ArgumentError, "invalid value for 'currency_code', must be one of #{validator.allowable_values}."
      end
      @currency_code = currency_code
    end
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)
1009147
function getCodeFromNode(node, renameSources, options) {
    const code_map = getCodeMap(node);
    const rename = renameSources;
    const objMap = code_map.map.toJSON();
    let i, n;

    if (rename) {
        if ('string' === typeof rename) {
            for (i = 0, n = objMap.sources.length; i < n; i++) {
                objMap.sources[i] = rename + objMap.sources[i];
            }
        } else if ('function' === typeof rename) {
            for (i = 0, n = objMap.sources.length; i < n; i++) {
                objMap.sources[i] = rename(objMap.sources[i]);
            }
        } else {
            console.warn('unexpected type of rename: ' + typeof rename);
        }
    }

    return node.toString() +
        convert.fromObject(objMap)
            .toComment(options)
            .replace(/charset=utf-8;/gm, '')
            .replace('data:application/json;', 'data:application/json;charset=utf-8;') + '\n';
}