How to use the i18n-iso-countries.getNames function in i18n-iso-countries

To help you get started, we’ve selected a few i18n-iso-countries examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github topcoder-platform / community-app / src / shared / utils / countries.js View on Github external
/**
 * Provides lookup data for countryies.
 */
import _ from 'lodash';

import countryUtil from 'i18n-iso-countries';
import enCountries from 'i18n-iso-countries/langs/en.json';

countryUtil.registerLocale(enCountries);

const countries = [];

_.forIn(countryUtil.getNames('en'), (name, alpha2) => {
  countries.push({ name, alpha3: countryUtil.alpha2ToAlpha3(alpha2) });
});

export function getCountryObjFromAlpha3(alpha3) {
  if (!alpha3) {
    return null;
  }
  const name = countryUtil.getName(alpha3, 'en');
  if (!name) {
    return null;
  }
  return { name, alpha3 };
}

export function getAllCountryObjects() {
  return countries;
github learningequality / studio / contentcuration / contentcuration / frontend / shared / views / form / CountryField.vue View on Github external
options() {
        return Object.entries(countries.getNames('en')).map(country => {
          return {
            id: country[1],
            name: countries.getName(country[0], window.languageCode),
          };
        });
      },
      rules() {
github elastic / kibana / x-pack / legacy / plugins / siem / public / components / source_destination / country_flag.tsx View on Github external
useEffect(() => {
    if (displayCountryNameOnHover && isEmpty(countries.getNames('en'))) {
      countries.registerLocale(countryJson);
    }
  }, []);
  const flag = getFlag(countryCode);
github philsturgeon / awesome-earth / src / pages / select-your-country.jsx View on Github external
export default ({ data }) => {
  const countries = require('i18n-iso-countries').getNames('en');
  const [searchTerm, setSearchTerm] = useState('');

  const countriesWithContent = flattenDeep([
    ...new Set(
      data.allLinksYaml.edges
        .map(({ node }) => node.countries)
        .filter(countryList => !!countryList)
    ),
  ]).map(countryCode => countryCode.toUpperCase());

  return (
    
      
        {({ country, setCountry, clearCountry }) => (
          <div>
            <div></div></div>
github MyEtherWallet / MyEtherWallet / src / layouts / InterfaceLayout / containers / SwapContainer / components / SwapExitToFiat / SwapExitToFiat.vue View on Github external
data() {
    return {
      localStoreKey: 'linkedPhone',
      previouslyVerified: false,
      addSpace: false,
      finalizingSwap: false,
      countryList: Object.entries(getNames('en')),
      complete: {
        step1: false,
        step2: false
      },
      steps: {
        step1: true,
        step2: false
      },
      inputCountryCode: {
        title: this.$t('swap.exit-to-fiat.country-code'),
        placeHolder: '000'
      },
      inputPhoneNumber: {
        title: this.$t('swap.exit-to-fiat.phone-number'),
        placeHolder: '000-000-0000'
      },
github SwitchbladeBot / switchblade / src / commands / games / steamladder / steamladder.js View on Github external
full: false,
        whitelist: ladders,
        required: false,
        missingError: ({ t, prefix }) => {
          return new SwitchbladeEmbed().setTitle(t('commands:steamladder.noLadder'))
            .setDescription([
              this.usage(t, prefix),
              '',
              `__**${t('commands:steamladder.availableLadders')}:**__`,
              `**${ladders.map(l => `\`${l}\``).join(', ')}**`
            ].join('\n'))
        }
      }, {
        type: 'string',
        required: false,
        whitelist: Object.keys(countries.getNames('en')).map(c => c.toLowerCase()).concat(Object.keys(countries.getNames('en'))).concat(regions),
        missingError: ({ t, prefix }) => {
          return new SwitchbladeEmbed().setTitle(t('commands:steamladder.noRegion'))
            .setDescription([
              this.usage(t, prefix),
              '',
              `__**${t('commands:steamladder.availableRegions')}:**__`,
              `**${regions.map(l => `\`${l}\``).join(', ')}**`,
              '',
              `[${t('commands:steamladder.youCanAlsoUse')}](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)`
            ].join('\n'))
        }
      }]
    }, client)
  }