[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: all of the web pages will now have a mirror list.



On Fri, Jun 08, 2001 at 10:16:58PM +0200, Josip Rodin wrote:
[...]
> > > Same problem applies to ie. consultants page where countries are in
> > > wrong order in translations[1].  Basically problem is same, so it would
> > > be useful to think enough general solution for this.  With my
> > > knowledge about WML it would be some kind of Perl function to sort
> > > those things that would be used everywhere when needed.
> > 
> > Yes, I think it can be done the way it's done in the languages template.
> > I'll look into it, unless someone beats me to it.
> 
> It could have been done, were it not for the dreaded slices[1].
[...]
> Maybe Denis can show us an elegant way to do this?

Hi Josip,

not sure this is elegant, but it seems to work.

Denis
<define-tag selectserver whitespace=delete>
	[EN:Select a server near you:]
	[EL:ÅðéëÝîôå åíáí êïíôéíü óáò  åîõðçñåôçôÞ:]
	[RO:Alegeþi un server apropiat:]
	[EO:Elektu servilon proksiman:]
	[TR:Yakýnýnýzda bir sunucu seçiniz:]
	[FI:Valitse läheinen palvelin:]
	[PT:Escolha um servidor próximo de você:]
	[HR:Izaberite vama blizak poslu¾itelj:]
	[FR:Sélectionnez un serveur proche de vous:]
	[NL:Kies een server dicht bij jou:]
	[DE:W&auml;hlen Sie einen Server in Ihrer N&auml;he:]
	[IT:Scegli il server più vicino:]
	[JA:¤ª¶á¤¯¤Î¥µ¡¼¥Ð¤ò¤ªÁª¤Ó²¼¤µ¤¤:]
	[PL:Wybierz najbli¿szy serwer:]
	[ES:Elija un servidor cerca de usted:]
	[DA:Vælg en server nær dig:]
	[NO:Velg en tjenere nær deg:]
	[ZH:½Ð[CN:´Nªñ¿ï¾ÜªA°È¾¹:][HKTW:¿ï¾Ü´Nªñªº¦øªA¾¹:]:]
	[SV:Välj en server nära dig:]
	[KO:°¡±î¿î °÷À» ¼±ÅÃÇϼ¼¿ä:]
	[HU:Válassz hozzád közeli szervert:]
	[AR:ÍÏøÏ ÎÇÏãÇ ÞÑíÈÇ ãäøß:]
	[RU:÷ÙÂÅÒÉÔÅ&nbsp;ÂÌÉÖÁÊÛÉÊ&nbsp;ÓÅÒ×ÅÒ:]
</define-tag>

# Don't change anything below this point.

#use wml::debian::countries

<perl>
my %mirrors = (
    "<ATc>" => "at",
    "<AUc>" => "au",
    "<BGc>" => "bg",
    "<CNc>" => "cn",
    "<DKc>" => "dk",
    "<FRc>" => "fr",
    "<DEc>" => "de",
    "<JPc>" => "jp",
    "<KRc>" => "kr",
    "<ITc>" => "it",
    "<NLc>" => "nl",
    "<PLc>" => "pl",
    "<RUc>" => "ru",
    "<ZAc>" => "za",
    "<ESc>" => "es",
    "<TRc>" => "tr",
    "<UKc>" => "uk",
              );

#   Transform this list
my $mirrors_lang = {};
foreach $m (keys %mirrors) {
    while ($m =~ m/\[([A-Z_]+):(.*?):\]/g) {
        $mirrors_lang->{$1}->{$2} = $mirrors{$m};
    }
}
</perl>

<define-tag mirrordroplist>
<form method="GET" action="http://cgi.debian.org/cgi-bin/redirect.pl";>
<input type="hidden" name="page" value="%0">
<if "$(usefonts)" "<font"><if "$(fontface)" " face="$(fontface)""><if "$(fontcolor)" " color="$(fontcolor)""><if "$(usefonts)" ">">
<if "$(small)" "<small>">
<selectserver>:
<if "$(small)" "</small>">
<if "$(usefonts)" "</font>">
<br>
# note: the values for site don't have an ending slash on purpose, that's page
<select name="site"<if "$(small)" " style=font-size:90%;">>
<perl>
foreach $l (keys %$mirrors_lang) {
  foreach $m (sort langcmp keys %{$mirrors_lang->{$l}}) {
  <perl:print>  [$l:<option value=\"http://www.$mirrors_lang->{$l}->{$m}.debian.org\">$m</option>\n:]</perl:print>
  }
}
</perl>
	<option value="http://www.debian.org"; selected>www.debian.org</option>
</select>
<input type="SUBMIT" value=" <go> "<if "$(small)" " style=font-size:90%;">>
<br>
</form>
</define-tag>

#use wml::sup::path

<perl>
  my $rootdir = &canonpath('$(WML_SRC_DIRNAME)/$(HOME)');
#    print STDERR "rootdir = $rootdir\n";
  my $curdir = &relpath($rootdir, '$(WML_SRC_DIRNAME)');
#    print STDERR "curdir = $curdir\n";
  my $file = "/".$curdir."/".'$(WML_SRC_BASENAME)';
#    print STDERR "file = $file\n";
  (my $path = &canonpath($file)) =~ s/index$//;
#    print STDERR "path = $path\n";
  <perl:print>
  <mirrordroplist $path>
  </perl:print>
</perl>

Reply to: