File Coverage

blib/lib/DDG/Meta/CountryCodes.pm
Criterion Covered Total %
statement 3 3 100.0
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 4 4 100.0


line stmt bran cond sub pod time code
1             package DDG::Meta::CountryCodes;
2             our $AUTHORITY = 'cpan:DDG';
3             # ABSTRACT: Master list of country renames and aliases for all IAs
4             $DDG::Meta::CountryCodes::VERSION = '1017';
5 11     11   4793 use Locale::Country 'country2code';
  11         220717  
  11         2247  
6              
7             unless(country2code('DuckDuckGo')){
8            
9             # Add aliases
10             Locale::Country::add_country_alias('Antigua and Barbuda' => 'Antigua');
11             Locale::Country::add_country_alias('Antigua and Barbuda' => 'Barbuda');
12             Locale::Country::add_country_alias('Trinidad and Tobago' => 'Tobago');
13             Locale::Country::add_country_alias('Trinidad and Tobago' => 'Trinidad');
14             Locale::Country::add_country_alias('Vatican City' => 'Vatican');
15             Locale::Country::add_country_alias('Virgin Islands, U.S.' => 'US Virgin Islands');
16             Locale::Country::add_country_alias('United States' => 'America');
17            
18             # Rename countries
19            
20             # These are the only 2 countries which officially have 'The' in their name
21             # Source: http://www.bbc.co.uk/news/magazine-18233844
22             Locale::Country::rename_country('bs' => 'The Bahamas');
23             Locale::Country::rename_country('gm' => 'The Gambia');
24             Locale::Country::rename_country('ae' => 'the United Arab Emirates');
25             Locale::Country::rename_country('do' => 'the Dominican Republic');
26             Locale::Country::rename_country('gb' => 'the United Kingdom');
27             Locale::Country::rename_country('kp' => "the Democratic People's Republic of Korea"); # North Korea
28             Locale::Country::rename_country('kr' => 'the Republic of Korea'); # South Korea
29             Locale::Country::rename_country('ky' => 'the Cayman Islands');
30             Locale::Country::rename_country('mp' => 'the Northern Mariana Islands');
31             Locale::Country::rename_country('nl' => 'the Netherlands');
32             Locale::Country::rename_country('ph' => 'the Philippines');
33             Locale::Country::rename_country('ru' => 'the Russian Federation');
34             Locale::Country::rename_country('tw' => 'Taiwan');
35             Locale::Country::rename_country('us' => 'the United States');
36             Locale::Country::rename_country('va' => 'the Holy See (Vatican City State)');
37             Locale::Country::rename_country('vg' => 'the British Virgin Islands');
38             Locale::Country::rename_country('vi' => 'the US Virgin Islands');
39            
40             # Easter eggs
41             Locale::Country::add_country_alias('Russian Federation' => 'Kremlin');
42             Locale::Country::add_country_alias('United States' => 'murica');
43             Locale::Country::add_country_alias('Canada' => 'Canadia');
44             Locale::Country::add_country_alias('Australia' => 'down under');
45             Locale::Country::add_country_alias('Canada' => 'DuckDuckGo');
46             }
47              
48             1;
49              
50             __END__