diff options
author | David Prévot <taffit> | 2011-12-31 06:09:28 +0000 |
---|---|---|
committer | David Prévot <taffit> | 2011-12-31 06:09:28 +0000 |
commit | 87ef869bb421c2c57329e11441b4139c1970877f (patch) | |
tree | 15d0326ff09bdf51ef645ea6933a56de587fa408 /english/template/debian/countries.wml | |
parent | 746e80354c44c4c98698bb78ab6f8d252c64fd82 (diff) |
Handle and translate countries with isoquery, closes: #474766
CVS version numbers
english/consultants/Makefile: 1.20 -> 1.21
english/consultants/consultant.data: 1.1600 -> 1.1601
english/consultants/count: 1.5 -> 1.6
english/template/debian/countries.wml: 1.201 -> 1.202
Diffstat (limited to 'english/template/debian/countries.wml')
-rw-r--r-- | english/template/debian/countries.wml | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/english/template/debian/countries.wml b/english/template/debian/countries.wml index 0e606a10561..b068cdbd258 100644 --- a/english/template/debian/countries.wml +++ b/english/template/debian/countries.wml @@ -1,5 +1,62 @@ #use wml::debian::common_tags +# <country-name XX> should now be used instead of <XXc> + +<: +my %countries,%codes; + +my $arg = ''; +$arg = "-l $CUR_ISO_LANG" if $CUR_ISO_LANG ne 'en'; + +foreach (`isoquery $arg`) { + chomp ; + my $code = substr($_,0,2); + $_ =~ s/.*\t//; + $countries{$code} = $_; +} + +sub country_name { + my $code=shift; + return $countries{uc $code}; +} + +sub country_list { + my @list = split ' ', shift; + my $type = shift @list; + my ($list,$pre,$post) = ('','',''); + + my %count; + if ($type eq 'consultants') { + my @temp; + foreach (@list) { + my $code = substr($_,0,2); + push @temp,$code; + $_ =~ s/\w*-//; + $count{$code} = $_; + } + @list = @temp; + } + + ($pre,$post) = ('<li><a href="#',")</li>\n") if $type eq 'consultants'; + foreach (sort { $countries{uc $a} cmp $countries{uc $b} } @list) { + $list .= $pre; + $list .= uc $_.'">' if $type eq 'consultants'; + $list .= $countries{uc $_}; + $list .= '</a> ('.$count{$_} if $type eq 'consultants'; + $list .= $post; + } + return $list; +} +:> + +<define-tag country-name whitespace=delete> +<:=country_name('%0'):> +</define-tag> + +<define-tag country-list whitespace=delete> +<:=country_list('%attributes'):> +</define-tag> + <bind-gettext-domain domain="countries" /> # The define-country tag defines 2 different thing; |