Coder Social home page Coder Social logo

annexare / countries Goto Github PK

View Code? Open in Web Editor NEW
1.1K 18.0 430.0 2.04 MB

Countries, Languages & Continents data (capital and currency, native name, calling codes).

Home Page: https://annexare.github.io/Countries/

License: MIT License

PHP 2.19% TypeScript 97.75% Shell 0.06%
countries country-codes json sql iso3166 csv currencies continent capital locales

countries's People

Contributors

aetonsi avatar bitofgold avatar cperez87 avatar dependabot[bot] avatar dmythro avatar erikdju avatar hmelenok avatar joakim avatar kudlav avatar michaeljamie avatar mukhammadali avatar orkhan avatar vsulak avatar z-ax avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

countries's Issues

Add alternative country names

Let's work on a discussion started in #31: some countries have the main and alternative names and it's nice to cover this information in a proper way.

List, based on comments below:

  • Belarus, Republic of Belarus
  • Belgium, Kingdom of Belgium; Native names (in local official languages):
    • Belgique, Royaume de Belgique (French)
    • België, Koninkrijk België (Dutch)
    • Belgien, Königreich Belgien (German)
  • Cyprus, Republic of Cyprus
    • Κύπρος, Κυπριακή Δημοκρατία (Greek)
    • Kıbrıs, Kıbrıs Cumhuriyeti (Turkish)
  • Myanmar, Burma
  • Poland, Republic of Poland
  • Russia, Russian Federation
  • United Kingdom, United Kingdom of Great Britain and Northern Ireland, Britain, UK
  • United States of America, United States, America, US

getEmojiFlag is broken in v2.6.0

What's the problem?

https://github.com/renovatebot/renovate just tried to update countries-list 2.5.6 -> 2.6.0 on my project. And suddenly all calls to getEmojiFlag fail with:

TypeError: Cannot read property 'encode' of undefined

I think the error is coming from this line

return ucs2.encode(
which means that
const { ucs2 } = require('punycode');
for whatever reason doesn't work anymore.

What's the expected behaviour?

getEmojiFlag in countries-list 2.6.0 works just like in countries-list 2.5.6

What's my context?

I'm using countries-list in a frontend project in VueJS.

import { getEmojiFlag } from 'countries-list';
// Inside a Vue JS component
getEmojiFlag(country)

Running it with standard https://cli.vuejs.org/ either in browser or in jest tests in node -v v12.7.0

ReferenceError: window is not defined

With the latest update I run into ReferenceError: window is not defined error, when loading countries-list in node environment.

The error is caused in the module exports wrapper in this ./dist/index.es5.min.js

!(function(n, a) {
  "object" == typeof exports && "object" == typeof module
    ? (module.exports = a())
    : "function" == typeof define && define.amd
      ? define("Countries", [], a)
      : "object" == typeof exports
        ? (exports.Countries = a())
        : (n.Countries = a());
})(window, function() {

Here window is used without checking whether it's defined.

Add country code in each Country object

Use case for the feature

Currently countries are listed in key/values with the country code being used as key, but not present in the value object.
This leads to problems when, for example, allowing a user to choose from a list of countries, it is easy to get all countries using Object.values, but then each value does not have its own code.

I would love to make a PR, but don't know where to start? I think we could just update the script (not the data file), to map over all entries just to include the code.

Data source

Use case for the feature

Looks like a great library. I'd just could propose to designate source of the data and its update rate in README.MD. I have read in the issues that you base on ISO information but I don't think that you buy official info for 300 CHF and give it to us free, right?

es5 dist output not es5?

I'm not totally up on my es5, es6 - but I think that the let keyword is es6 only?

yet the main dist/index.es5.min.js contains the let keyword since v2.6.0 - causing my webpack build to fail as it's expecting es5

Screenshot_20210216_104941

Flags not loading

Hello,

We're having some troubles using the package on our Angular web application.

Our custom component:

image

Console (GET requests are returning 522 HTTP codes):

image

http://countryflags.io/ is returning timeout from cloudflare:

image

Any update on what's going on? Cheers

Languages and associated scripts

I needed a package with additional information about scripts and their association to languages, so I made this localization-data, which builds on top of this package and then adds this data.

If you are interested in integrating it directly into this, I could integrate it and make a PR?

Name countries

Hi guys,

The name of some countries are not correct for ISO.

e.g.: Czechia => Czech Republic

Thanks in advance

Windows 7

Hi, I tried on Windows 7 with
Firefox Quantum 60.0.2
IE11 v 11.0.9
Chrome 67.0.33

The flag is not rendered, is it possible that it come from Windows 7 ?

Description Update (Minor)

스크린샷 2021-06-21 오후 3 20 51

It seems to be used ISO-4217 for currencyCodes, so the description would like to be updated with details.

Estonian language

"ee" in languages.json should be Estonian instead of Ewe as "EE" in countries.json is for Estonia.

Add Currency Symbol

Would be nice if you can add Currency symbol of each country in country json file.

Default currency for Countries

Is there a way to add a default/ official currency for all countries?

Example, Switzerland has its official currency as CHF but in the currency array we have ['CHE', 'CHF', 'CHW'], either we can change the alphabetical order of array to have the official currency listed as first ['CHF', 'CHE', 'CHW'] or introduce a new field to only have the official one? This would help in cases where we need to show one of the currencies in form options based on country.

Missing `nb` in languages.json

Norwegian has two official languages (nb and nn) and one macrolanguage (no) in ISO-639-1. This is correctly listed in countries.json, but not in languages.json where nb is missing. Instead there's a listing for no. The native names are also not entirely correct, "riksmål" is not an official language.

For Ethiopia can you add these language codes/

      {
        name: 'Ethiopia',
        native: 'ኢትዮጵያ',
        phone: '251',
        continent: 'AF',
        capital: 'Addis Ababa',
        currency: 'ETB',
        languages: [
          'am',
          'om',
          'ti',
          'so',
        ],
        emoji: '🇪🇹',
        emojiU: 'U+1F1EA U+1F1F9',
      },

Data update

Data changes

Need to update for Malaysia's states
Kuala Lumpur, update to 'WP Kuala Lumpur'

Add two more;
WP Putrajaya
WP Labuan

WP stands for Wilayah Persekutuan.

Links & sources

Here is a valid source for this change:

Feature : You can add more data

{
"alpha2": "AW",
"capital": "Oranjestad",
"region": "Americas",
"locales": [
{
"ianaTimezone": "America/Curacao",
"name": "(GMT-04:00) Curacao"
}
],
"name": "Aruba",
"alpha3": "ABW",
"callingCode": 297,
"latitude": 12.52111,
"longitude": -69.968338,
"numeric": 533,
"currencyCode": "AWG",
"currencyName": "Aruban florin",
"currencySymbol": "ƒ",
"language": "Dutch",
"domain": ".aw"
},

Localized country & capital names

Hey, pretty cool & handy library!

One thing missing is localized country & capital names.
I could provide a .json source file for Dutch. See below for example.
A lot of capital names are identical to the English one, but I think it would be best to explicitly write them down anyway.
Antarctica has no capital - you use an empty string value here, but wouldn't null be more correct?

Please let me know your thoughts, cheers!

./data/i18n/nl/countries.json

{
  "AD": {
    "name": "Andorra",
    "capital": "Andorra la Vella"
  },
  "AE": {
    "name": "Verenigde Arabische Emiraten",
    "capital": "Abu Dhabi"
  },
  "AF": {
    "name": "Afghanistan",
    "capital": "Kabul"
  },
  "AG": {
    "name": "Antigua en Barbuda",
    "capital": "Saint John's"
  },
  "AI": {
    "name": "Anguilla",
    "capital": "The Valley"
  },
  "AL": {
    "name": "Albanië",
    "capital": "Tirana"
  },
  "AM": {
    "name": "Armenië",
    "capital": "Jerevan"
  },
  "AO": {
    "name": "Angola",
    "capital": "Luanda"
  },
  "AQ": {
    "name": "Antarctica",
    "capital": null
  },
  "AR": {
    "name": "Argentinië",
    "capital": "Buenos Aires"
  },
  "AS": {
    "name": "Amerikaans-Samoa",
    "capital": "Pago Pago"
   }
  ...
}

Saudi Arabia native name is incorrect

Hello, and thank you for this great list.

I just noticed that the native name of Saudi Arabia is missing a word. In the countries' list it's العربية السعودية, but it should be المملكة العربية السعودية. Or you can opt to use the single-word version which is السعودية. Both are valid.

Thanks again.

  • Kingdom of Saudi Arabia, Saudi Arabia
    • Full name in Arabic: المملكة العربية السعودية
    • Short name in Arabic: السعودية

Helper functions

Some helper functions would be useful eg: getCode = (countryName: string) => string returning the country code.

Also this would help a lot if paired with #35 so lookups of codes from alternative country names could be much more reliable.

Add country nationality

Hello, Hope u are safe.
Thanks for gathering this package.

Use case for the feature

I want to convert Country to Nationality in some parts of my application.

For example "Canada (CA) => Canadian" or "Iran (IR) => Iranian" or "Great Britain (GB) => British", etc....

I think there are much use cases for such a feature.

Enable tree shaking with countries-list

Use case for the feature

I realised when investigating the size of a bundle (bundled by webpack) countries-list was imported even if it was not directly used. This is because the package is not marked as side effect-free, cf. https://sgom.es/posts/2020-06-15-everything-you-never-wanted-to-know-about-side-effects/.

Would you consider adding the flag to package.json? I'm pretty sure the package is fully side-effect free, and everyone bundling code that uses it would benefit.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.