#use wml::debian::common_tags # should now be used instead of <: my %countries,%countries_in_english; my $arg = ''; $arg = "-l $CUR_ISO_LANG" if $CUR_ISO_LANG ne 'en'; foreach (`isoquery -c $arg 2>/dev/null`) { chomp ; my $code = substr($_,0,2); $_ =~ s/.*\t//; $countries{$code} = $_; } foreach (`isoquery -c`) { chomp ; my $code = substr($_,0,2); $_ =~ s/.*\t//; $countries_in_english{$code} = $_; } sub country_name { my $code=shift; if ($code eq 'WW') { return ''; } else { return $countries{uc $code}; } } use Unicode::Normalize; sub country_list { my $ccodepos = shift; $ccodepos = 'ccafter' unless (defined($ccodepos)); if ($ccodepos eq 'ccafter' or $ccodepos eq 'ccbefore') { foreach $c (sort { Unicode::Normalize::NFKD($countries{$a}) cmp Unicode::Normalize::NFKD($countries{$b}) } keys %countries) { my $localname = $countries{$c}; my $label; if ($ccodepos eq 'ccafter') { $label = "$localname [$c]"; } elsif ($ccodepos eq 'ccbefore') { $label = "[$c] $localname"; } print "\n"; } } else { my @list = split ' ', $ccodepos; my $type = shift @list; my ($list,$pre,$post) = ('','',''); my %count; if ($type eq 'consultants' or $type eq 'vendors') { my @temp; foreach (@list) { my $code = substr($_,0,2); push @temp,$code; $_ =~ s/\w*-//; $count{$code} = $_; } @list = @temp; } ($pre,$post) = ('
  • \n") if $type eq 'consultants'; ($pre,$post) = ('' if $type eq 'consultants' or $type eq 'vendors'; $list .= $countries{uc $_}; $list .= ' ('.$count{$_} if $type eq 'consultants' or $type eq 'vendors'; $list .= $post; } return $list; } } :> <:=country_name('%0'):> <:=country_list('%attributes'):> # The define-country tag defines 2 different thing; # * A tag for pass 2 (mp4h) # * A hash variable %countries{code}{lang} for pass 3 (eperl) c whitespace=delete> %body <: $_ = <<'EOT'; %body EOT s/^\s+//s; s/\s+$//s; $countries{}{} = $_; :> United Arab Emirates Albania Armenia Argentina Austria Australia Bosnia and Herzegovina Bangladesh Belgium Bulgaria Brazil Bahamas Belarus Canada Switzerland Chile China Colombia Costa Rica Czech Republic Germany Denmark Dominican Republic Algeria Ecuador Estonia Egypt Spain Ethiopia Finland Faroe Islands France United Kingdom Grenada Georgia Greenland Greece Guatemala Hong Kong Honduras Croatia Hungary Indonesia Iran Ireland Israel India Iceland Italy Jordan Japan Kenya Kyrgyzstan Cambodia Korea Kuwait Kazakhstan Sri Lanka Lithuania Luxembourg Latvia Morocco Monaco Moldova Montenegro Madagascar Macedonia, Republic of Mongolia Malta Mexico Malaysia New Caledonia Nicaragua Netherlands Norway New Zealand Panama Peru French Polynesia Philippines Pakistan Poland Portugal RĂ©union Romania Serbia Russia Saudi Arabia Sweden Singapore Slovenia Slovakia El Salvador Thailand Tajikistan Tunisia Turkey Taiwan Ukraine United States Uruguay Uzbekistan Venezuela Vietnam Vanuatu South Africa Zimbabwe # These lines generate the countries.def file, only when this file # is processed through # sed -e /^#/d countries.wml | eperl -B '<:' -E ':>' - >/dev/null # WML will skip this block <: if ('$(DUMMY_VAR_DO_NOT_REMOVE)' ne '') { open(GEN, "> countries.def"); print GEN "# File generated automatically. Do not edit!\n"; close(GEN); } :>