openbookprices / country-data Goto Github PK
View Code? Open in Web Editor NEWCountry related data such as ISO codes, currencies etc
License: MIT License
Country related data such as ISO codes, currencies etc
License: MIT License
Propose the addition of these two:
{
code: 'CNH',
decimals: 2,
name: 'Chinese yuan (offshore)',
},
{
code: 'EEK',
decimals: 2,
name: 'Estonian kroon',
}
The CNH entry is justified by this discussion of how Chinese currency works on international markets.
Assuming that multiple versions of country names become available, it would be nice to include a popularity index, e.g. http://www.google.com/trends/explore#q=%22Lithuania%22%2C%20%22Republic%20of%20Lithuania%22&cmpt=q&tz=.
Knowing which name is more popular, together with language property, would be useful when determining which name to choose to display in which language. This index could be updated once a week or so using an automated script.
I am happy to contribute a library that would abstract querying of the data (assuming such does not exist already).
See http://stackoverflow.com/a/15844287/5349 for possible approach.
Is introducing different behaviour between strict
and normal mode worse that allowing modifications to the data?
import countryData from 'country-data';
console.log(countryData.languages.nl.name); //outputs Flemish instead of Dutch
This is because the languages.csv file has the entries Dutch and Flemish with identical values
alpha2=nl
alpha3=nld
bibliographic=dut
I suggest removing the Flemish entry since Flemish it's considered not a language but rather an adjective/thesaurus to define Dutch dialects.
Dutch is the correct English word to define the Dutch language spoken in both The Netherlands and Belgium.
I can prepare a Pull Request with the Flemish entry removed from the languages.csv file.
Perhaps you could merge with the support we have here at https://github.com/getprove/node-country-codes. I used cheerio to crawl a page that had the data.
As per request in #47 (comment)
Wikipedia http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#GB suggests that GB is correct and UK is not, so I think that removing the UK is good enough.
Would you like a PR?
the full question on: http://stackoverflow.com/questions/43144036/in-react-how-to-convert-country-code-to-country-name-using-country-data
It is:
I thought I could do
npm install --save country-data
and then in the code:
import CountryData from "country-data";
and use
CountryData.countries["TW"]
to get the country data, and
CountryData.countries["TW"].name
to get the name. But CountryData.countries["TW"]
gets undefined already. How can it be done?
Hi,
I am not getting how to use it with webpack&c:
import CountryData from 'country-data';
CountryData.lookup.countries({currencies: 'EUR'});
generates:
Uncaught (in promise) TypeError: data.filter is not a function(…)
Am I doing something wrong?
Hi there,
I took a look at the WIP to see if I could notch it off the list and it raised a q's.
How can you have a dialing code for a region?
Are the codes correct? I could not correlate the data to any meaningful source. Could you provide this?
There are also also a few regions missing.
Happy to contrib if I can get some data.
Hey why did you guys remove the grouping by region such as Europe ?
It was really handy grabbing all European countries at once...
I just found out maybe Malaysia is not on the ALL list, but available in the object.
You may consider as well some countries other than malaysia.
So far so good this library is awesome.
Hello,
I am working on a translation management system and therefore I need all available languages and it's ISO codes. However this list var languageList = languages.all
contains entries like:
alpha2=, alpha3=zxx, bibliographic=, name=No linguistic content
alpha2=, alpha3=zxx, bibliographic=, name=Not applicable
alpha2=, alpha3=und, bibliographic=, name=Undetermined
alpha2=, alpha3=gmh, bibliographic=, name=German, Middle High (ca.1050-1500)
All these entries are obviously very irrelevant for my purpose. Instead I want to get English (USA), English (GB) and such. Is there a way to get only the official languages including differences like American vs British English?
import countryData from 'country-data';
console.log(countryData.languages.el.name); //outputs Greek, Modern (1453-) instead of Greek
The name of the modern Greek language should simply be Greek instead of Greek, Modern (1453-).
All other languages have modern and ancient versions of them. We do not constantly specify Modern English, Modern German when we refer to English and German. The same should be true for Greek.
At countries.csv
line 253
Why use Viet Nam
instead of more common Vietnam
?
If it can be updated, I should submit PR.
Thanks!
United Kingdom,GB,GBR,,+44,GBP,🇬🇧,GBR,"eng,cor,gle,gla,cym",assigned
United Kingdom,UK,,.uk,,GBP,,,"eng,cor,gle,gla,cym",reserved
Also, I believe the official name is "United Kingdom of Great Britain". Perhaps you can assign this name to the "GB" country code, so users who search for "Great Britain" will still get a result.
currently the root of the data is region. id like to add continent data as the root but think I should run it by you before making a PR
Hello,
Why this country has é symbol?
Usually, we have Saint Barthelemy spelling every time.
Maybe we need to improve the system and add another name.
Thx, Vitaly
These countries are obsolete: ["AFI","ATB","BUR","BYS","CSK","SCG","CTE","DDR","DHY","GEL","HVO","JTN","MID","NHB","ATN","NTZ","PCI","PUS","PCZ","RHO","SKM","TMP","VDR","WAK","YMD","YUG","ZAR"]
e.g. DDR - East Germany
Please update the list.
It would be extremely useful to have some common lookups in the library. For instance I needed to get a alpha3 based on country name. I ended up writing something like this:
function findAlpha3(name) {
for(var code in countries) {
var country = countries[code];
if(country.name == name && code) return country.alpha3;
}
if(name == 'United Kingdom') return 'GBR';
}
I would much rather write something like countries.find({name: 'Germany'}).alpha3
.
In https://github.com/OpenBookPrices/country-data/blob/master/data/countries.json#L526 alpha3 should be "ATB"
and not " ATB"
Have you ever seen this? I npm install --save country-data
then var countries = require('country-data').countries;
, and countries.all
looks like {}
.
Malay is missing for Malaysia (countries.json) (http://en.wikipedia.org/wiki/Malay_language)
{
"alpha2": "MY",
"alpha3": "MYS",
"countryCallingCodes": [
"+60"
],
"currencies": [
"MYR"
],
"ioc": "MAS",
"languages": [
"eng"
],
"name": "Malaysia",
"status": "assigned"
},
country-data/data/currencies.json
Line 149 in 011dbb6
The new currency is BYN (Br 1.00)
It would be nice to implement a search by IOC code as well as the alpha2 and alpha3 code.
Maybe implement as countries.IOC.code
Multiple sources online report that the current number of countries is 195 or 196 if you include Taiwan. Is there a way to return a list of just these countries? Or must I maintain a separate array of countries in my app and query based on that?
Any plans to include valid phone number lengths by country? Are you open to contributions? My plan would be to port the data already available in node-phone to country-data.
I don't know if it would be too hard to maintain that information up to date.
As of the most recent ISO change, the name of SZ has changed.
That should be GBR.
Do you plan to add internationalization support to your package?
I think it may be very useful for non-english development targets.
thanks for the great lib. Missing one "country" (I know its borderline cuz its a temp one):
Hi, while Lithuania already has EUR instead of LTL, LTL is not valid anymore.
2015 January 1st LTL was replaced by EUR
Since 0.0.25, the 2-digit ISO code SK
had changed from Slovakia to Sikkim:
> require('country-data').countries.SK.name
'Slovakia'
> require('country-data').countries.SK.name
'Sikkim'
According to Wikipedia, SK still belongs to Slovakia and SK was actually assigned to Sikkim before 1993. Maybe this change was unintentional?
As I understand this package is not maintained anymore (and the author didn't care to find a new maintainer). Still the number of stars and npm downloads can trick a user to consider this to be a reliable library.
Its a good idea for the author to mark the package as 'deprecated' and recommend another (maintained) package instead.
IR numeric is 98 but you set 364
The level of detail in this library is great! The only thing missing that I can see would be SVG flags for each country. Is this a possibility?
Having no case preference would be nice:
e.g
lookup({name: 'Antigua and Barbuda'})
doesn't find a match because the source data uses 'And'
I have a branch cut with a fix for this if you want to incorporate it.
The lookup using remote sources will often fail because rarely does anyone use the official name (e.g. Russian Federation vs Russian and People's Republic of China vs China).
CountryData.lookup.countries({name: 'Russia'}); // Russian Federation
CountryData.lookup.countries({name: 'China'}); // People's Republic of China
CountryData.lookup.countries({name: 'USA'}); // The United States of America, United States, America
CountryData.lookup.countries({name: 'Iran'}); // Persia, Islamic Republic of Iran
CountryData.lookup.countries({name: 'Vietnam'}); // Socialist Republic of Vietnam
It would make sense to have "name_aka" field in JSON that would describe common variations.
var countries = require('country-data').countries;
console.log( countries.all );
Should be sorted alphabetically. Now sort is uncompleted
Some observations to improve countries.json:
alpha2: "IC"
and alpha2: "EA"
are not countries. Canary Islands, Ceuta and Melilla are Spain's regions.alpha2: "GB"
and alpha2: "UK"
are the same country. The correct ISO Code is GB
.alpha2: "EU"
isn't a country (it's a politico-economic union of 28 countries).Can you give an example which would allow me to fetch country flag emoji
You've got many countries listed elsewhere, but no Canada or US.
http://en.wikipedia.org/wiki/List_of_sovereign_states_and_dependent_territories_in_North_America
This is a great little library, but it's been almost a year since the last release and some issues are stacking up.
Do you still plan to maintain this library?
Just to inform you that I have just made a project using a fork of the raw data with a few formatting changes, but the main change as far as the data is concerned is a new 'eurozone' region grouping:
https://github.com/vijinho/ISO-Country-Data/blob/master/regions.json#L474
Hi All,
First of all thanks for the country data which you made it . I have some css requirement which i am not able to distinguish here. My issue is as below.
I am basically from INDIA and which I saw my country has INR as currency and Currency Type is Rupees. So like Database should have this as well.
Country :- INDIA , Currency :- INR, Currency Type :- Rupee
Country :- BANGALADESH Currency :- Currency :- BDT Type :- TAKA
Country :- Pakistan Currency :- PKR, Currency Type :- Rupee
Please advise.
Thanks
Would be nice to load this lib via bower.
Following UIT-T E.164 Mexico Country Code is 52.
Why do you have two values 52 and 521 as countryCallingCodes in countries.json?
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.