-
Notifications
You must be signed in to change notification settings - Fork 432
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from annexare/add-languages
V2.0: Add Languages data, rework structure and generation
- Loading branch information
Showing
35 changed files
with
15,628 additions
and
5,379 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# EditorConfig is awesome: http://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 2 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
{ | ||
"env": { | ||
"node": true | ||
}, | ||
"extends": ["eslint:recommended"], | ||
"parserOptions": { | ||
"ecmaVersion": 6, | ||
"sourceType": "script" | ||
} | ||
} | ||
"env": { | ||
"node": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended" | ||
], | ||
"parserOptions": { | ||
"ecmaVersion": 6, | ||
"sourceType": "script" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
data/ | ||
.editorconfig | ||
.eslintrc.json | ||
.gitignore | ||
bower.json | ||
composer.json | ||
gulpfile.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,111 @@ | ||
# Countries | ||
# Countries, Languages & Continents data | ||
|
||
[![Monthly Downloads](https://img.shields.io/npm/dm/countries-list.svg)](https://www.npmjs.com/package/countries-list) | ||
[![NPM](https://img.shields.io/npm/v/countries-list.svg "NPM package version")](https://www.npmjs.com/package/countries-list) | ||
[![Packagist](https://img.shields.io/packagist/v/annexare/countries-list.svg "Packagist version")](https://packagist.org/packages/annexare/countries-list) | ||
[![Twitter](https://img.shields.io/twitter/follow/annexare.svg?label=follow+@annexare)](https://twitter.com/annexare) | ||
|
||
Continents & countries: ISO 3166-1 alpha-2 code, name, languages, capital and currency, native name, calling codes. | ||
Continents & countries: **ISO 3166-1 alpha-2** code, name, **ISO 639-1** languages, capital and currency, native name, calling codes. | ||
Lists are available in JSON, CSV and SQL formats. | ||
Also, contains separate JSON files with additional country **Emoji** flags data. | ||
|
||
**Note**: Languages, currencies, calling codes may be a comma-separated list. | ||
## Version 2.0: Breaking changes | ||
|
||
## Usage | ||
This version changes a lot in the data structures, and placement of the files. | ||
So, if your projects depend on the old structure — specify previous versions, `<2.0.0`. | ||
|
||
Here you have ready to use JSON for the most of web apps, CSV and SQL files for some backend stuff. | ||
## Installation | ||
|
||
Package is available via: | ||
|
||
* **NPM** `npm install countries-list` | ||
* **Composer / Packagist** `composer require annexare/countries-list` | ||
* **Bower** `bower install countries` | ||
|
||
## Examples | ||
## Usage | ||
|
||
``` | ||
{ | ||
"continents": { | ||
"AF": "Africa", | ||
"AN": "Antarctica", | ||
"AS": "Asia", | ||
"EU": "Europe", | ||
"NA": "North America", | ||
"OC": "Oceania", | ||
"SA": "South America" | ||
}, | ||
"countries": { | ||
"AD": { | ||
"name": "Andorra", | ||
"native": "Andorra", | ||
"phone": "376", | ||
"continent": "EU", | ||
"capital": "Andorra la Vella", | ||
"currency": "EUR", | ||
"languages": "ca" | ||
}, | ||
... | ||
"CH": { | ||
"name": "Switzerland", | ||
"native": "Schweiz", | ||
"phone": "41", | ||
"continent": "EU", | ||
"capital": "Bern", | ||
"currency": "CHE,CHF,CHW", | ||
"languages": "de,fr,it" | ||
}, | ||
... | ||
} | ||
} | ||
``` | ||
Module exports `continents`, `countries`, `languages`, `languagesAll` and functions: | ||
* `getEmojiFlag(countryCode)`, where `countryCode` is alpha-2 `String` | ||
* `getUnicode(emoji)`, where `emoji` is alpha-2 emoji flag `String` | ||
|
||
Built files are in the `./dist` directory. | ||
The `./data` directory contains source data. | ||
|
||
Also, there's a minimal JSON file with only country by code object: | ||
The consistent data is available from `./dist/data.*` files (JSON, SQL). | ||
|
||
**Note**: Country item `languages` field is an `Array` in JSON files to easily count and match items with a Language item. | ||
But `currency` and `phone` calling codes may be a comma-separated `String`. | ||
|
||
**Note**: Languages list only contains languages used in Countries data. Full list of known languages is exported as `languagesAll` from `./dist/languages.all.json`. | ||
|
||
## Data example | ||
|
||
``` | ||
{ | ||
... | ||
"UA":"Ukraine", | ||
... | ||
"US":"United States" | ||
... | ||
"continents": { | ||
"AF": "Africa", | ||
"AN": "Antarctica", | ||
"AS": "Asia", | ||
"EU": "Europe", | ||
"NA": "North America", | ||
"OC": "Oceania", | ||
"SA": "South America" | ||
}, | ||
"countries": { | ||
"AE": { | ||
"name": "United Arab Emirates", | ||
"native": "دولة الإمارات العربية المتحدة", | ||
"phone": "971", | ||
"continent": "AS", | ||
"capital": "Abu Dhabi", | ||
"currency": "AED", | ||
"languages": [ | ||
"ar" | ||
], | ||
"emoji": "🇦🇪", | ||
"emojiU": "U+1F1E6 U+1F1EA" | ||
}, | ||
... | ||
"UA": { | ||
"name": "Ukraine", | ||
"native": "Україна", | ||
"phone": "380", | ||
"continent": "EU", | ||
"capital": "Kyiv", | ||
"currency": "UAH", | ||
"languages": [ | ||
"uk" | ||
], | ||
"emoji": "🇺🇦", | ||
"emojiU": "U+1F1FA U+1F1E6" | ||
} | ||
}, | ||
"languages": { | ||
"ar": { | ||
"name": "Arabic", | ||
"native": "العربية", | ||
"rtl": 1 | ||
}, | ||
... | ||
"uk": { | ||
"name": "Ukrainian", | ||
"native": "Українська" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Contributing | ||
|
||
Everything's generated from `countries.json`, including SQL file. | ||
But generated files are in repository, so in future please make changes to this file and | ||
run `gulp` default command. | ||
Everything is generated from files in `./data`, including SQL file. | ||
|
||
Everything in `./dist` is generated, | ||
so please make data related changes **ONLY** to files from `./data` | ||
and then run `gulp` default command to commit generated files as well. | ||
|
||
## Credits | ||
|
||
Prepared by [Annexare Studio](https://annexare.com/) from different public sources. Feel free to use it as you need in your apps or send updates into [this](https://github.com/annexare/Countries) public repository. It's under MIT license. | ||
Prepared by [Annexare Studio](https://annexare.com/) from different public sources. | ||
Feel free to use it as you need in your apps | ||
or send updates into [this](https://github.com/annexare/Countries) public repository. | ||
It's under MIT license. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,28 @@ | ||
{ | ||
"name": "Countries", | ||
"version": "1.4.1", | ||
"homepage": "http://annexare.github.io/Countries/", | ||
"author": { | ||
"name": "Dmytro", | ||
"email": "[email protected]", | ||
"url": "https://github.com/z-ax" | ||
}, | ||
"description": "Continents & countries: ISO 3166-1 alpha-2 code, name, languages, capital and currency, native name, calling codes. Available in JSON, CSV and SQL formats.", | ||
"keywords": [ | ||
"country", | ||
"countries", | ||
"continent", | ||
"emoji", | ||
"languages", | ||
"capital", | ||
"currency", | ||
"data", | ||
"csv", | ||
"json", | ||
"sql", | ||
"ISO 3166-1", | ||
"node" | ||
], | ||
"license": "MIT" | ||
"name": "Countries", | ||
"version": "2.0.0", | ||
"homepage": "http://annexare.github.io/Countries/", | ||
"author": { | ||
"name": "Dmytro", | ||
"email": "[email protected]", | ||
"url": "https://github.com/z-ax" | ||
}, | ||
"description": "Continents & countries: ISO 3166-1 alpha-2 code, name, ISO 639-1 languages, capital and currency, native name, calling codes. Available in JSON, CSV and SQL formats.", | ||
"keywords": [ | ||
"country", | ||
"countries", | ||
"continent", | ||
"emoji", | ||
"languages", | ||
"capital", | ||
"currency", | ||
"data", | ||
"csv", | ||
"json", | ||
"sql", | ||
"ISO 3166-1", | ||
"ISO 639-1", | ||
"node" | ||
], | ||
"license": "MIT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,36 @@ | ||
{ | ||
"name": "annexare/countries-list", | ||
"version": "1.4.1", | ||
"description": "Continents & countries: ISO 3166-1 alpha-2 code, name, languages, capital and currency, native name, calling codes. Available in JSON, CSV and SQL formats.", | ||
"type": "library", | ||
"keywords": [ | ||
"country", | ||
"countries", | ||
"continent", | ||
"emoji", | ||
"languages", | ||
"capital", | ||
"currency", | ||
"data", | ||
"csv", | ||
"json", | ||
"sql", | ||
"ISO 3166-1", | ||
"node" | ||
], | ||
"authors": [ | ||
{ | ||
"name": "Dmytro", | ||
"email": "[email protected]", | ||
"homepage": "https://github.com/z-ax" | ||
} | ||
], | ||
"license": "MIT", | ||
"support": { | ||
"source": "https://github.com/annexare/Countries", | ||
"issues": "https://github.com/annexare/Countries/issues" | ||
}, | ||
"require": {}, | ||
"homepage": "http://annexare.github.io/Countries/" | ||
"name": "annexare/countries-list", | ||
"version": "2.0.0", | ||
"description": "Continents & countries: ISO 3166-1 alpha-2 code, name, ISO 639-1 languages, capital and currency, native name, calling codes. Available in JSON, CSV and SQL formats.", | ||
"type": "library", | ||
"keywords": [ | ||
"country", | ||
"countries", | ||
"continent", | ||
"emoji", | ||
"languages", | ||
"capital", | ||
"currency", | ||
"data", | ||
"csv", | ||
"json", | ||
"sql", | ||
"ISO 3166-1", | ||
"ISO 639-1", | ||
"node" | ||
], | ||
"authors": [ | ||
{ | ||
"name": "Dmytro", | ||
"email": "[email protected]", | ||
"homepage": "https://github.com/z-ax" | ||
} | ||
], | ||
"license": "MIT", | ||
"support": { | ||
"source": "https://github.com/annexare/Countries", | ||
"issues": "https://github.com/annexare/Countries/issues" | ||
}, | ||
"require": {}, | ||
"homepage": "http://annexare.github.io/Countries/" | ||
} |
Oops, something went wrong.