Skip to content

Commit

Permalink
Implemented json, yaml, PHP and MySQL dumpers.
Browse files Browse the repository at this point in the history
  • Loading branch information
umpirsky committed Mar 2, 2012
1 parent 80974bf commit 50807f2
Show file tree
Hide file tree
Showing 18 changed files with 616 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[submodule "vendor/Symfony/Component/Locale"]
path = vendor/Symfony/Component/Locale
url = https://github.com/symfony/Locale.git
[submodule "vendor/Symfony/Component/Yaml"]
path = vendor/Symfony/Component/Yaml
url = https://github.com/symfony/Yaml.git
[submodule "vendor/Symfony/Component/ClassLoader"]
path = vendor/Symfony/Component/ClassLoader
url = https://github.com/symfony/ClassLoader.git
[submodule "vendor/Symfony/Component/Filesystem"]
path = vendor/Symfony/Component/Filesystem
url = https://github.com/symfony/Filesystem.git
[submodule "vendor/Symfony/Component/Finder"]
path = vendor/Symfony/Component/Finder
url = https://github.com/symfony/Finder.git
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) Саша Стаменковић <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Country List
============

List of all countries with names and ISO 3166-1 codes in all languages and data formats.
21 changes: 21 additions & 0 deletions autoload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

/**
* This file is part of the Country List project.
*
* (c) Саша Стаменковић <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

require_once __DIR__ . '/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php';

use Symfony\Component\ClassLoader\UniversalClassLoader;

$loader = new UniversalClassLoader();
$loader->registerNamespaces(array(
'Symfony' => __DIR__ . '/vendor',
'Umpirsky' => __DIR__ . '/vendor'
));
$loader->register();
29 changes: 29 additions & 0 deletions build
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env php
<?php

/**
* This file is part of the Country List project.
*
* (c) Саша Стаменковић <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

require_once __DIR__ . '/autoload.php';

use Symfony\Component\Locale\Locale;
use Symfony\Component\Filesystem\Filesystem;
use Umpirsky\Country\Dumper\Iterator;

$locale = new Locale();
$filesystem = new Filesystem();
$dumperIterator = new Iterator();
foreach ($locale->getLocales() as $language) {
$countries = $locale->getDisplayCountries($language);
foreach($dumperIterator as $dumper) {
$file = sprintf('%s/country/country.%s.%s', __DIR__, $language, $dumper->getFormat());
$filesystem->touch($file);
file_put_contents($file, $dumper->dump($countries));
}
}
255 changes: 255 additions & 0 deletions country/country.af.yaml~
Original file line number Diff line number Diff line change
@@ -0,0 +1,255 @@
AF: Afganistan
AX: 'Åland Islands'
AL: Albanië
DZ: Algerië
AS: 'Amerikaans Samoa'
AD: Andorra
AO: Angola
AI: Anguilla
AQ: Antarktika
AG: 'Antigua en Barbuda'
AR: Argentinië
AM: Armenië
AW: Aruba
AC: 'Ascension Island'
AZ: Aserbeidjan
AU: Australië
BS: Bahamas
BH: Bahrein
BD: Bangladesj
BB: Barbados
BE: België
BZ: Belize
BJ: Benin
BM: Bermuda
BT: Bhoetan
BF: 'Boerkina Fasso'
BO: Bolivië
BA: 'Bosnië en Herzegowina'
BW: Botswana
BV: 'Bouvet Island'
BR: Brasilië
IO: 'Britse Indiese Oseaan Gebied'
VG: 'Britse Maagde-eilande'
BN: Broenei
BG: Bulgarye
BI: Burundi
IC: 'Canary Islands'
EA: 'Ceuta and Melilla'
CL: Chili
CX: 'Christmas Island'
CY: Ciprus
CP: 'Clipperton Island'
CC: 'Cocos [Keeling] Islands'
KM: Comore
CK: Cookeilande
CR: 'Costa Rica'
CD: 'Demokratiese Republiek van die Kongo'
DK: Denemarke
DG: 'Diego Garcia'
DJ: Djiboeti
DM: Dominika
DO: 'Dominikaanse Republiek'
DE: Duitsland
EC: Ecuador
EG: Egipte
GQ: Ekwatoriaal-Guinee
ER: Eritrea
EE: Estland
ET: Ethiopië
EU: 'European Union'
FK: Falklandeilande
FO: Faroëreilande
FJ: Fidji
PH: Filippyne
FI: Finland
FR: Frankryk
GF: Frans-Guyana
PF: Frans-Polinesië
TF: 'French Southern Territories'
GA: Gaboen
GM: Gambië
GE: Georgië
GH: Ghana
GI: Gibraltar
GD: Grenada
GR: Griekeland
GL: Groenland
GB: Groot-Brittanje
GP: Guadeloupe
GU: Guam
GT: Guatemala
GG: Guernsey
GN: Guinee
GW: Guinee-Bissau
GY: Guyana
HT: Haïti
HM: 'Heard Island and McDonald Islands'
HN: Honduras
HU: Hongarye
HK: Hongkong
IE: Ierland
IN: Indië
ID: Indonesië
IQ: Irak
IR: Iran
IM: 'Isle of Man'
IL: Israel
IT: Italië
CI: Ivoorkus
JM: Jamaika
JP: Japan
YE: Jemen
JE: Jersey
JO: Jordanië
KY: Kaaimanseilande
CV: 'Kaap Verde'
KH: Kambodja
CM: Kameroen
CA: Kanada
KZ: Kasakstan
QA: Katar
KE: Kenia
KG: Kirgisië
KI: Kiribati
KW: Koeweit
CO: Kolombië
CG: Kongo
HR: Kroasië
CU: Kuba
LA: Laos
LS: Lesotho
LV: Letland
LB: Libanon
LR: Liberië
LY: Libië
LI: Liechtenstein
LT: Litaue
LU: Luxemburg
MO: 'Macau SAR China'
MK: Macedonië
MG: Madagaskar
MW: Malawi
MV: Maledive
MY: Maleisië
ML: Mali
MT: Malta
MA: Marokko
MH: Marshall-eilande
MQ: Martinique
MU: Mauritius
YT: Mayotte
MX: Meksiko
MM: Mianmar
FM: Mikronesië
MD: Moldova
MC: Monaco
MN: Mongolië
ME: Montenegro
MS: Montserrat
MZ: Mosambiek
MR: Mouritanië
NA: Namibië
NR: Naoeroe
NL: Nederland
AN: Nederlands-Antille
NP: Nepal
NI: Nicaragua
NC: Nieu-Kaledonië
NZ: Nieu-Seeland
NE: Niger
NG: Nigerië
NU: Niue
KP: Noord-Korea
MP: 'Noordelike Marianaeilande'
NO: Noorweë
NF: Norfolk-eiland
UA: Oekraine
UZ: Oesbekistan
OM: Oman
TL: Oos-Timor
AT: Oostenryk
QO: 'Outlying Oceania'
PK: Pakistan
PW: Palau
PS: Palestina
PA: Panama
PG: 'Papoea Nieu-Guinee'
PY: Paraguay
PE: Peru
PN: Pitcairn
PL: Pole
PT: Portugal
PR: 'Puerto Rico'
RE: Réunion
RO: Roemenië
RU: Rusland
RW: Rwanda
BL: 'Saint Barthélemy'
KN: 'Saint Kitts en Nevis'
MF: 'Saint Martin'
VC: 'Saint Vincent en die Grenadine'
SV: Salvador
WS: Samoa
SM: 'San Marino'
ST: 'Sao Tome en Principe'
SA: Saoedi-Arabië
SN: Senegal
CF: 'Sentraal-Afrikaanse Republiek'
RS: Serbia
CS: 'Serwië en Montenegro'
SC: Seychelle
SL: 'Sierra Leone'
SG: Singapoer
SH: 'Sint Helena'
LC: 'Sint Lucia'
PM: 'Sint-Pierre en Miquelon'
SY: Sirië
CN: Sjina
SK: Slowakye
SI: Slowenië
SD: Soedan
SB: 'Solomon Eilande'
SO: Somalië
GS: 'South Georgia and the South Sandwich Islands'
ES: Spanje
LK: 'Sri Lanka'
ZA: Suid-Afrika
KR: Suid-Korea
SR: Suriname
SJ: 'Svalbard and Jan Mayen'
SZ: Swaziland
SE: Swede
CH: Switserland
TJ: Tadjikistan
TW: Taiwan
TZ: Tanzanië
TH: Thailand
CZ: 'Tjeggiese Republiek'
TG: Togo
TK: Tokelau
TO: Tonga
TT: 'Trinidad en Tobago'
TA: 'Tristan da Cunha'
TD: Tsjaad
TN: Tunisië
TM: Turkmenië
TC: 'Turks en Caicos Eilande'
TR: Turkye
TV: Tuvalu
UM: 'U.S. Minor Outlying Islands'
UG: Uganda
UY: Uruguay
VI: 'V.S. Maagde-eilande'
VU: Vanuatu
VA: Vatikaan
VE: Venezuela
AE: 'Verenigde Arabiese Emirate'
US: 'Verenigde State van Amerika'
VN: Viëtnam
WF: 'Wallis en Futuna'
EH: Wes-Sahara
BY: Wit-Rusland
IS: Ysland
ZM: Zambië
ZW: Zimbabwe
1 change: 1 addition & 0 deletions vendor/Symfony/Component/ClassLoader
Submodule ClassLoader added at 8bceaa
1 change: 1 addition & 0 deletions vendor/Symfony/Component/Filesystem
Submodule Filesystem added at f475e8
1 change: 1 addition & 0 deletions vendor/Symfony/Component/Finder
Submodule Finder added at b3adc8
1 change: 1 addition & 0 deletions vendor/Symfony/Component/Locale
Submodule Locale added at b7ea9a
1 change: 1 addition & 0 deletions vendor/Symfony/Component/Yaml
Submodule Yaml added at 2552c6
34 changes: 34 additions & 0 deletions vendor/Umpirsky/Country/Dumper/Dumper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

/**
* This file is part of the Country List project.
*
* (c) Саша Стаменковић <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Umpirsky\Country\Dumper;

use Umpirsky\Country\Dumper\DumperInterface;

/**
* Abstract dumper.
*
* @author Саша Стаменковић <[email protected]>
*/
abstract class Dumper implements DumperInterface {

/**
* Gets dumper format.
*
* @return string
*/
public function getFormat() {

$className = get_class($this);
return strtolower(substr($className, strrpos($className, '\\') + 1));
}

}
Loading

0 comments on commit 50807f2

Please sign in to comment.