annexare / countries Goto Github PK
View Code? Open in Web Editor NEWCountries, Languages & Continents data (capital and currency, native name, calling codes).
Home Page: https://annexare.github.io/Countries/
License: MIT License
Countries, Languages & Continents data (capital and currency, native name, calling codes).
Home Page: https://annexare.github.io/Countries/
License: MIT License
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
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
Line 19 in 11a7011
Line 7 in 11a7011
getEmojiFlag in countries-list 2.6.0 works just like in countries-list 2.5.6
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
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.
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.
Can you add country capital's coords in the package?
http://techslides.com/demos/country-capitals.json
https://github.com/Ginden/capitals/
http://techslides.com/list-of-countries-and-capitals
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?
found 3 countries language is empty
BV, AQ, MY
Work as PHP array or static class.
Would be nice to include these.
From:
Country name: Turkey
To:
Country name: Türkiye
Here is a valid source for this change:
Hello,
We're having some troubles using the package on our Angular web application.
Our custom component:
Console (GET requests are returning 522 HTTP codes):
http://countryflags.io/ is returning timeout from cloudflare:
Any update on what's going on? Cheers
Simplified the import process rather than needing multiple.
import { countries } from 'countries-list';
import countries2to3 from 'countries-list/dist/countries2to3.json';
Other JSON files are exported.
https://github.com/annexare/Countries/blob/master/dist/index.js#L3-L6
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?
Hi guys,
The name of some countries are not correct for ISO.
e.g.: Czechia => Czech Republic
Thanks in advance
A lot of countries have languages which are spoken by meaningful amount of people.
Often useful to choose the best fit for automatic localization selection.
Right now, currencies are a comma-separated list. It would be nice if this were a proper array.
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 ?
Would be nice to bundle with a .d.ts
file, allowing for out the box TypeScript support.
Countries with territory that straddles more than one continent, are known as transcontinental states or intercontinental states.
Here is a valid source for this change:
"ee" in languages.json should be Estonian instead of Ewe as "EE" in countries.json is for Estonia.
Please, change country currency code to the correct. Please, use BYN
instead of BYR
.
See https://en.wikipedia.org/wiki/Belarusian_ruble
Would be nice if you can add Currency symbol of each country in country json file.
Swaziland has been renamed to Eswatini.
Here is a valid source for this change:
https://www.iso.org/obp/ui/#iso:code:3166:SZ
any possibility of compiling the dist directory to es5 so that this can be used client-side with uglifyjs?
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.
Australia is missing from continents.
"gibraltar" country does not have country phone code.
Country Code: +350
Got this error on es5.min.js load (v2.3.0). Should I load some dependencies before? And if yes - anyway it would be more useful If you could load this without external dependencies.
index.es5.min.js:2 Uncaught TypeError: Cannot set property 'Countries' of undefined
Please update Egypt's currency, we use the £ symbol and not EGP.
Also, refer to this link for other counties symbols
https://www.xe.com/symbols.php
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.
{
name: 'Ethiopia',
native: 'ኢትዮጵያ',
phone: '251',
continent: 'AF',
capital: 'Addis Ababa',
currency: 'ETB',
languages: [
'am',
'om',
'ti',
'so',
],
emoji: '🇪🇹',
emojiU: 'U+1F1EA U+1F1F9',
},
Adding the geometry as a GeoJSON (Multi)Polygon (data eg from natural earth data) would be a great addon for this dataset.
I think some countries can be written like that:
Åland -> Aland
São Tomé and Príncipe -> Sao Tome and Principe
Réunion -> Reunion
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.
Here is a valid source for this change:
Please, Kirghiz should be changed to (exactly) Kyrgyz. Cus Kyrgyz is the official language of Kyrgyz Republic.
https://github.com/annexare/Countries/blob/master/data/languages.json#L366
Here is a valid source for this change:
https://en.wikipedia.org/wiki/Kyrgyz_language
Need to change the Default Currency of Croatia from HRK to EUR
Here is a valid source for this change:
https://news.bloombergtax.com/payroll/croatia-prepares-for-euro-switch-with-transition-period
{
"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"
},
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"
}
...
}
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
المملكة العربية السعودية
السعودية
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.
Hello, Hope u are safe.
Thanks for gathering this package.
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.
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.
Åland it's an independent territory part of Finland but not considered as country
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.