--- gnatsweb.pl.orig Tue Sep 21 09:28:34 2004 +++ gnatsweb.pl Wed Sep 29 12:32:01 2004 @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/pkg/bin/perl -w # # Gnatsweb - web front-end to GNATS # @@ -39,6 +39,8 @@ $global_cookie_expires $global_cookie_path $textwidth $site_allow_remote_debug $attachment_delimiter %mark_urls $gnats_info_top %site_pr_submission_address $VERSION); +# Addon for Gnatsweb localization, overridable from gnatsweb-site.pl too +use vars qw($site_html_language $site_html_charset); # dynamic configuration switches, set during initial gnatsd # communication and general setup @@ -93,6 +95,10 @@ # released, you won't need to edit them again. # +# Internationalization. +$site_html_language = 'en-US'; +$site_html_charset = 'ISO-8859-1'; + # Info about your gnats host. $site_gnats_host = 'localhost'; $site_gnats_port = 1529; @@ -984,7 +990,7 @@ # in the expected way. It needs a content-disposition of "file". ($ENV{'HTTP_USER_AGENT'} =~ "MSIE 5.5") ? ($disp = 'file') : ($disp = 'attachment'); # Now serve the attachment, with the appropriate headers. - print_header(-type => 'application/octet-stream', + print_generic_header(-type => 'application/octet-stream', -content_disposition => "$disp; filename=\"$$hash_ref{'filename'}\""); print $$hash_ref{'data'}; } @@ -3002,10 +3008,10 @@ $val; } -# print_header - +# print_generic_header - # Print HTTP header unless it's been printed already. # -sub print_header +sub print_generic_header { # Protect against multiple calls. return if $print_header_done; @@ -3014,6 +3020,17 @@ print $q->header(@_); } +# print_header - +# Print HTTP header for HTML pages +sub print_header +{ + my @header_opts = @_; + push(@header_opts, -charset => $site_html_charset) + if (defined $site_html_charset); + + print_generic_header(@header_opts); +} + # page_start_html - # # Print the HTML which starts off each page (...). @@ -3049,6 +3066,11 @@ # Call start_html, with -bgcolor if we need to override that. my @args = (-title=>"$title - $site_banner_text"); + push(@args, -head=>$q->meta({-http_equiv=>'Content-Type', + -content=>"text/html; charset=$site_html_charset"})) + if defined($site_html_charset); + push(@args, -lang=>$site_html_language) + if defined($site_html_language); push(@args, -bgcolor=>$site_background) if defined($site_background); push(@args, -style=>{-src=>$site_stylesheet})