<h2>Languages</h2>

Album can run in a variety of <a href="Docs/Section_8.html">languages</a>,
which can change the user output of album as well as the HTML output.
<p>
If a language file isn't complete, then you'll still see messages in
english (or whatever backup language you've chosen).
<p>
Here is a list of the current languages that come packaged with album.
<p>
<font color=red><b>Languages require v4.00 or higher to run!</b></font>
<p>

<table border width=700><tr><td>

<table width=100%>
  <tr>
    <th>Language</th>
    <th colspan=2>Complete</th>
    <th>Translators</th>
  </tr>
<:
	my $alb = "/data/proj/album/album";
	$alb = "/WWW/web/MarginalHacks.com/bin/album" unless -x $alb;
	$alb = "album" unless -x $alb;

sub nowrap {
	my (@str) = @_;
	map { "<span style='white-space: nowrap'>$_</span>"; } @str;
}

sub percent {
	my ($perc) = @_;

	my $width = 200;
	my $fin = $width/100*$perc;
	my $unfin = $width/100*(100-$perc);

	my @ret;
	push(@ret, "<table cellpadding=0 cellspacing=0 border=0 width=200><tr>");
	push(@ret, "<td style=\"background-image: url('Pics/green-bar.png');\" bgcolor='#bbbbff' width='$fin'><font size='-2'>$perc\%</font></td>");
	push(@ret, "<td style=\"background-image: url('Pics/red-bar.png');\" bgcolor='#ffbbbb' width='$unfin'></td>") if $unfin;
	push(@ret, "</tr></table>");
	return join("\n",@ret);
}

	open(LIST,"$alb -list_langs |") || die("Couldn't run $alb -list_langs\n");
	my $plugins = 0;
	my $show = 1;
	while (<LIST>) {
		next if /Available languages:/;
		if (/^\s+(\S+):\s*(\S.*?)\s*\((.+)\)$/) {
			my ($code,$lang,$eng_lang) = ($1,$2,$3);
			my $comp = scalar <LIST>;
			die("Couldn't understand completion line:\n$_")
				unless $comp =~ /Complete:\s*([\d\.]+)%\s+HTML:\s([\d\.]+)%/;
			my ($complete,$html) = ($1,$2);
			($complete,$html) = (percent($complete),percent($html));
			my (@translators);
			while (<LIST>) {
				last unless /translator:\s*(\S.*?)\s*<([^>]+)>/;
				my ($translator,$href) = ($1,$2);
				unless ($href =~ m|http://getdave.com/|i) {
					$href =~ s|http://||g;
					$href = $href =~ /(.+)\@(.+)/ ? "mailto://$1 AT NOSPAM$2" : "/redir.cgi?$href";
				}
				push(@translators, $href ? "<a href=\"$href\">$translator</a>" : $translator);
			}
			my $translator = join("<br>", nowrap(@translators));

			print <<LANG unless $code eq "banner";
	<tr>
		<td colspan=4><hr></td>
	</tr>
	<tr>
		<td rowspan=2 valign=top>
			$code<br />
			<span style='white-space: nowrap'>$lang</span>
			<span style='white-space: nowrap'>($eng_lang)</span>
		</td>
		<td valign=middle align=right>
			<font size='-2'>
				Complete:
			</font>
		</td>
		<td valign=middle>
			$complete
		</td>
		<td rowspan=2 valign=top>
			$translator
		</td>
	</tr>
	<tr>
		<td valign=middle align=right>
			<font size='-2'>
				HTML:
			</font>
		</td>
		<td valign=middle>
			$html
		</td>
	</tr>
LANG
		}
	}
:>
</table>

</td></tr></table>

