From 3bb6c9d9922b0487901c02962b1d64c525f1bdd7 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Wed, 22 Feb 2006 01:41:28 +0000 Subject: [PATCH] Replace _() with _g() everywhere. Oddly enough, it works under mod_perl, but not anywhere else --- cgi-bin/dispatcher.pl | 12 ++-- lib/Packages/DoDownload.pm | 80 ++++++++++++------------- lib/Packages/DoFilelist.pm | 14 ++--- lib/Packages/DoSearch.pm | 42 ++++++------- lib/Packages/DoShow.pm | 118 ++++++++++++++++++------------------- 5 files changed, 133 insertions(+), 133 deletions(-) diff --git a/cgi-bin/dispatcher.pl b/cgi-bin/dispatcher.pl index 3198d2a..3873c49 100755 --- a/cgi-bin/dispatcher.pl +++ b/cgi-bin/dispatcher.pl @@ -86,10 +86,10 @@ if (my $path = $input->path_info() || $input->param('PATH_INFO')) { shift @components; $what_to_do = 'search'; # Done - fatal_error( _( "search doesn't take any more path elements" ) ) + fatal_error( _g( "search doesn't take any more path elements" ) ) if @components > 0; } elsif (@components == 0) { - fatal_error( _( "We're supposed to display the homepage here, instead of getting dispatch.pl" ) ); + fatal_error( _g( "We're supposed to display the homepage here, instead of getting dispatch.pl" ) ); } elsif (@components == 1) { $what_to_do = 'search'; } else { @@ -114,7 +114,7 @@ if (my $path = $input->path_info() || $input->param('PATH_INFO')) { sub set_param_once { my ($cgi, $params_set, $key, $val) = @_; if ($params_set->{$key}++) { - fatal_error( sprintf( _( "%s set more than once in path" ), $key ) ); + fatal_error( sprintf( _g( "%s set more than once in path" ), $key ) ); } else { $cgi->param( $key, $val ); } @@ -144,7 +144,7 @@ if (my $path = $input->path_info() || $input->param('PATH_INFO')) { @components = @tmp; if (@components > 1) { - fatal_error( sprintf( _( "two or more packages specified (%s)" ), "@components" ) ); + fatal_error( sprintf( _g( "two or more packages specified (%s)" ), "@components" ) ); } } # else if (@components == 1) @@ -230,12 +230,12 @@ unless (@Packages::CGI::fatal_errors) { &{"do_$what_to_do"}( \%params, \%opts, \%html_header, \$menu, \$page_content ); } else { - %html_header = ( title => _('Error'), + %html_header = ( title => _g('Error'), lang => $opts{lang}, print_title => 1, print_search_field => 'packages', search_field_values => { - keywords => _('search for a package'), + keywords => _g('search for a package'), searchon => 'default', arch => 'any', suite => 'all', diff --git a/lib/Packages/DoDownload.pm b/lib/Packages/DoDownload.pm index 8b1d6f6..ab3ab73 100644 --- a/lib/Packages/DoDownload.pm +++ b/lib/Packages/DoDownload.pm @@ -200,19 +200,19 @@ sub do_download { my ($params, $opts, $html_header, $menu, $page_content) = @_; if ($params->{errors}{package}) { - fatal_error( _( "package not valid or not specified" ) ); + fatal_error( _g( "package not valid or not specified" ) ); } if ($params->{errors}{suite}) { - fatal_error( _( "suite not valid or not specified" ) ); + fatal_error( _g( "suite not valid or not specified" ) ); } if ($params->{errors}{arch}) { - fatal_error( _( "architecture not valid or not specified" ) ); + fatal_error( _g( "architecture not valid or not specified" ) ); } if (@{$opts->{suite}} > 1) { - fatal_error( sprintf( _( "more than one suite specified for download (%s)" ), "@{$opts->{suite}}" ) ); + fatal_error( sprintf( _g( "more than one suite specified for download (%s)" ), "@{$opts->{suite}}" ) ); } if (@{$opts->{arch}} > 1) { - fatal_error( sprintf( _( "more than one architecture specified for download (%s)" ), "@{$opts->{arch}}" ) ); + fatal_error( sprintf( _g( "more than one architecture specified for download (%s)" ), "@{$opts->{arch}}" ) ); } $opts->{h_sections} = { map { $_ => 1 } @SECTIONS }; @@ -233,8 +233,8 @@ sub do_download { read_entry( \%packages, $pkg, \@results, $opts ); unless (@results) { - fatal_error( _( "No such package." )."
". - sprintf( _( 'Search for the package' ), "$SEARCH_URL/$pkg" ) ); + fatal_error( _g( "No such package." )."
". + sprintf( _g( 'Search for the package' ), "$SEARCH_URL/$pkg" ) ); } else { my $final_result = shift @results; foreach (@results) { @@ -253,99 +253,99 @@ sub do_download { } } - %$html_header = ( title => _( "Package Download Selection" ), + %$html_header = ( title => _g( "Package Download Selection" ), lang => $opts->{lang}, print_title => 1 ); if ($file) { if ($arch ne 'all') { - $$page_content .= '

'.sprintf( _('Download Page for %s on %s machines'), $filen, $arches{$arch} ).'

'; + $$page_content .= '

'.sprintf( _g('Download Page for %s on %s machines'), $filen, $arches{$arch} ).'

'; } else { - $$page_content .= '

'.sprintf( _('Download Page for %s'), $filen ).'

'; + $$page_content .= '

'.sprintf( _g('Download Page for %s'), $filen ).'

'; } my $directory = join( '/', @file_components).'/'; if ($archive ne 'security' ) { - $$page_content .= "

".sprintf( _( 'You can download the requested file from the %s subdirectory at any of these sites:' ), $directory )."

\n"; + $$page_content .= "

".sprintf( _g( 'You can download the requested file from the %s subdirectory at any of these sites:' ), $directory )."

\n"; } else { - $$page_content .= "

".sprintf( _( 'You can download the requested file from the %s subdirectory at:' ), $directory )."

\n"; + $$page_content .= "

".sprintf( _g( 'You can download the requested file from the %s subdirectory at:' ), $directory )."

\n"; } if ($archive eq 'security') { $$page_content .= ""; - $$page_content .= '

'._( 'Debian security updates are currently officially distributed only via security.debian.org.' ).'

'; + $$page_content .= '

'._g( 'Debian security updates are currently officially distributed only via security.debian.org.' ).'

'; } elsif ($arch eq 'amd64') { - $$page_content .= print_links( _( "North America" ), $file, @amd64_north_american_sites ); - $$page_content .= print_links( _( "Europe" ), $file, @amd64_european_sites ); + $$page_content .= print_links( _g( "North America" ), $file, @amd64_north_american_sites ); + $$page_content .= print_links( _g( "Europe" ), $file, @amd64_european_sites ); # $$page_content .= print_links( "Australia and New Zealand", $file, # @nonus_australian_sites ); - $$page_content .= print_links( _( "Asia" ), $file, @amd64_asian_sites ); + $$page_content .= print_links( _g( "Asia" ), $file, @amd64_asian_sites ); # $$page_content .= print_links( "South America", $file, @nonus_south_american_sites ); - $$page_content .= '

'._( 'Note that AMD64 is not officialy included in the Debian archive yet, but the AMD64 porter group keeps their archive in sync with the official archive as close as possible. See the AMD64 ports page for current information.' ).'

'; + $$page_content .= '

'._g( 'Note that AMD64 is not officialy included in the Debian archive yet, but the AMD64 porter group keeps their archive in sync with the official archive as close as possible. See the AMD64 ports page for current information.' ).'

'; } elsif ($arch eq 'kfreebsd-i386') { - $$page_content .= print_links( _( "North America" ), $file, @kfreebsd_north_american_sites ); - $$page_content .= print_links( _( "Europe" ), $file, @kfreebsd_european_sites ); + $$page_content .= print_links( _g( "North America" ), $file, @kfreebsd_north_american_sites ); + $$page_content .= print_links( _g( "Europe" ), $file, @kfreebsd_european_sites ); # $$page_content .= print_links( "Australia and New Zealand", $file, # @nonus_australian_sites ); # $$page_content .= print_links( "Asia", $file, @amd64_asian_sites ); # $$page_content .= print_links( "South America", $file, @nonus_south_american_sites ); - $$page_content .= '

'._( 'Note that GNU/kFreeBSD is not officialy included in the Debian archive yet, but the GNU/kFreeBSD porter group keeps their archive in sync with the official archive as close as possible. See the GNU/kFreeBSD ports page for current information.' ).'

'; + $$page_content .= '

'._g( 'Note that GNU/kFreeBSD is not officialy included in the Debian archive yet, but the GNU/kFreeBSD porter group keeps their archive in sync with the official archive as close as possible. See the GNU/kFreeBSD ports page for current information.' ).'

'; } elsif ($archive eq 'non-US') { - $$page_content .= print_links( _( "North America" ), $file, @nonus_north_american_sites ); - $$page_content .= print_links( _( "Europe" ), $file, @nonus_european_sites ); - $$page_content .= print_links( _( "Australia and New Zealand" ), $file, + $$page_content .= print_links( _g( "North America" ), $file, @nonus_north_american_sites ); + $$page_content .= print_links( _g( "Europe" ), $file, @nonus_european_sites ); + $$page_content .= print_links( _g( "Australia and New Zealand" ), $file, @nonus_australian_sites ); - $$page_content .= print_links( _( "Asia" ), $file, @nonus_asian_sites ); - $$page_content .= print_links( _( "South America" ), $file, @nonus_south_american_sites ); + $$page_content .= print_links( _g( "Asia" ), $file, @nonus_asian_sites ); + $$page_content .= print_links( _g( "South America" ), $file, @nonus_south_american_sites ); - $$page_content .= '

'.sprintf( _('If none of the above sites are fast enough for you, please see our complete mirror list.' ), 'http://www.debian.org/mirror/list-non-US' ).'

'; + $$page_content .= '

'.sprintf( _g('If none of the above sites are fast enough for you, please see our complete mirror list.' ), 'http://www.debian.org/mirror/list-non-US' ).'

'; } elsif ($archive eq 'backports') { # $$page_content .= print_links( "North America", $file, @nonus_north_american_sites ); $$page_content .= '
'; - $$page_content .= print_links( _( "Europe" ), $file, @backports_european_sites ); + $$page_content .= print_links( _g( "Europe" ), $file, @backports_european_sites ); $$page_content .= '
'; - $$page_content .= print_links( _( "Australia and New Zealand" ), $file, + $$page_content .= print_links( _g( "Australia and New Zealand" ), $file, @backports_australian_sites ); - $$page_content .= print_links( _( "Asia" ), $file, @backports_asian_sites ); + $$page_content .= print_links( _g( "Asia" ), $file, @backports_asian_sites ); # $$page_content .= print_links( "South America", $file, @nonus_south_american_sites ); $$page_content .= '
'; - $$page_content .= '

'.sprintf( _( 'If none of the above sites are fast enough for you, please see our complete mirror list.'), 'http://www.backports.org/debian/README.mirrors.html' ).'

'; + $$page_content .= '

'.sprintf( _g( 'If none of the above sites are fast enough for you, please see our complete mirror list.'), 'http://www.backports.org/debian/README.mirrors.html' ).'

'; } elsif ($archive eq 'volatile') { # $$page_content .= print_links( "North America", $file, @nonus_north_american_sites ); - $$page_content .= print_links( _( "Europe" ), $file, @volatile_european_sites ); + $$page_content .= print_links( _g( "Europe" ), $file, @volatile_european_sites ); # $$page_content .= print_links( "Australia and New Zealand", $file, # @nonus_australian_sites ); # $$page_content .= print_links( "Asia", $file, @nonus_asian_sites ); # $$page_content .= print_links( "South America", $file, @nonus_south_american_sites ); - $$page_content .= '

'.sprintf( _( 'If none of the above sites are fast enough for you, please see our complete mirror list.' ), 'http://volatile.debian.net/mirrors.html' ).'

'; + $$page_content .= '

'.sprintf( _g( 'If none of the above sites are fast enough for you, please see our complete mirror list.' ), 'http://volatile.debian.net/mirrors.html' ).'

'; } elsif ($archive eq 'us') { $$page_content .= '
'; - $$page_content .= print_links( _( "North America" ), $file, @north_american_sites ); + $$page_content .= print_links( _g( "North America" ), $file, @north_american_sites ); $$page_content .= '
'; - $$page_content .= print_links( _( "Europe" ), $file, @european_sites ); + $$page_content .= print_links( _g( "Europe" ), $file, @european_sites ); $$page_content .= '
'; - $$page_content .= print_links( _( "Australia and New Zealand" ), $file, @australian_sites ); + $$page_content .= print_links( _g( "Australia and New Zealand" ), $file, @australian_sites ); $$page_content .= '
'; - $$page_content .= print_links( _( "Asia" ), $file, @asian_sites ); + $$page_content .= print_links( _g( "Asia" ), $file, @asian_sites ); $$page_content .= '
'; - $$page_content .= print_links( _( "South America" ), $file, @south_american_sites ); + $$page_content .= print_links( _g( "South America" ), $file, @south_american_sites ); $$page_content .= '
'; - $$page_content .= '

'.sprintf( _( 'If none of the above sites are fast enough for you, please see our complete mirror list.' ), 'http://www.debian.org/mirror/list' ).'

'; + $$page_content .= '

'.sprintf( _g( 'If none of the above sites are fast enough for you, please see our complete mirror list.' ), 'http://www.debian.org/mirror/list' ).'

'; } - $$page_content .= '

'._( 'Note that in some browsers you will need to tell your browser you want the file saved to a file. For example, in Firefox or Mozilla, you should hold the Shift key when you click on the URL.' ).'

'; - $$page_content .= "

".sprintf( _( 'The MD5sum for %s is %s' ), $filen, $md5sum ).'

' + $$page_content .= '

'._g( 'Note that in some browsers you will need to tell your browser you want the file saved to a file. For example, in Firefox or Mozilla, you should hold the Shift key when you click on the URL.' ).'

'; + $$page_content .= "

".sprintf( _g( 'The MD5sum for %s is %s' ), $filen, $md5sum ).'

' if $md5sum; } } diff --git a/lib/Packages/DoFilelist.pm b/lib/Packages/DoFilelist.pm index 7fb1a8f..20eb67f 100644 --- a/lib/Packages/DoFilelist.pm +++ b/lib/Packages/DoFilelist.pm @@ -28,13 +28,13 @@ sub do_filelist { my ($params, $opts, $html_header, $menu, $page_content) = @_; if ($params->{errors}{package}) { - fatal_error( _( "package not valid or not specified" ) ); + fatal_error( _g( "package not valid or not specified" ) ); } if ($params->{errors}{suite}) { - fatal_error( _( "suite not valid or not specified" ) ); + fatal_error( _g( "suite not valid or not specified" ) ); } if ($params->{errors}{arch}) { - fatal_error( _( "architecture not valid or not specified" ) ); + fatal_error( _g( "architecture not valid or not specified" ) ); } $$menu = ''; @@ -42,8 +42,8 @@ sub do_filelist { my $suite = $opts->{suite}[0]; my $arch = $opts->{arch}[0] ||''; - %$html_header = ( title => sprintf( _( "Filelist of package %s in %s of architecture %s" ), $pkg, $suite, $arch ), - title_tag => sprintf( _( "Filelist of of package %s/%s/%s" ), $pkg, $suite, $arch ), + %$html_header = ( title => sprintf( _g( "Filelist of package %s in %s of architecture %s" ), $pkg, $suite, $arch ), + title_tag => sprintf( _g( "Filelist of of package %s/%s/%s" ), $pkg, $suite, $arch ), lang => $opts->{lang}, keywords => "debian, $suite, $arch, filelist", print_title => 1, @@ -54,7 +54,7 @@ sub do_filelist { O_RDONLY, 0666, $DB_BTREE) { unless (exists $contents{$pkg}) { - fatal_error( _( "No such package in this suite on this architecture." ) ); + fatal_error( _g( "No such package in this suite on this architecture." ) ); } else { my @files = unpack "L/(CC/a)", $contents{$pkg}; my $file = ""; @@ -66,7 +66,7 @@ sub do_filelist { $$page_content .= ''; } } else { - fatal_error( _( "Invalid suite/architecture combination" ) ); + fatal_error( _g( "Invalid suite/architecture combination" ) ); } } } diff --git a/lib/Packages/DoSearch.pm b/lib/Packages/DoSearch.pm index 60052c5..64160c1 100644 --- a/lib/Packages/DoSearch.pm +++ b/lib/Packages/DoSearch.pm @@ -27,9 +27,9 @@ sub do_search { $Params::Search::too_many_hits = 0; if ($params->{errors}{keywords}) { - fatal_error( _( "keyword not valid or missing" ) ); + fatal_error( _g( "keyword not valid or missing" ) ); } elsif (length($opts->{keywords}) < 2) { - fatal_error( _( "keyword too short (keywords need to have at least two characters)" ) ); + fatal_error( _g( "keyword too short (keywords need to have at least two characters)" ) ); } $$menu = ""; @@ -102,16 +102,16 @@ sub do_search { } if ($Packages::Search::too_many_hits) { - error( sprintf( _( "Your search was too wide so we will only display exact matches. At least %s results have been omitted and will not be displayed. Please consider using a longer keyword or more keywords." ), $Packages::Search::too_many_hits ) ); + error( sprintf( _g( "Your search was too wide so we will only display exact matches. At least %s results have been omitted and will not be displayed. Please consider using a longer keyword or more keywords." ), $Packages::Search::too_many_hits ) ); } if (!@Packages::CGI::fatal_errors && !@results) { if ($searchon eq "names") { unless (@non_results) { - error( _( "Can't find that package." ) ); + error( _g( "Can't find that package." ) ); } else { - hint( _( "Can't find that package." )." ". - sprintf( _( '%s'. + hint( _g( "Can't find that package." )." ". + sprintf( _g( '%s'. " results have not been displayed due to the". " search parameters." ), "$SEARCH_URL/$keyword_esc" , $#non_results+1 ) ); @@ -121,24 +121,24 @@ sub do_search { if (($suites_enc eq 'all') && ($archs_enc eq 'any') && ($sections_enc eq 'all')) { - error( _( "Can't find that string." ) ); + error( _g( "Can't find that string." ) ); } else { - error( sprintf( _( "Can't find that string, at least not in that suite (%s, section %s) and on that architecture (%s)." ), + error( sprintf( _g( "Can't find that string, at least not in that suite (%s, section %s) and on that architecture (%s)." ), $suites_enc, $sections_enc, $archs_enc ) ); } if ($opts->{exact}) { - hint( sprintf( _( 'You have searched only for words exactly matching your keywords. You can try to search allowing subword matching.' ), + hint( sprintf( _g( 'You have searched only for words exactly matching your keywords. You can try to search allowing subword matching.' ), encode_entities("$SEARCH_URL?exact=0&$opts->{common_params}") ) ); } } - hint( sprintf( _( 'You can try a different search on the Packages search page.' ), "$SEARCH_PAGE#search_packages" ) ); + hint( sprintf( _g( 'You can try a different search on the Packages search page.' ), "$SEARCH_PAGE#search_packages" ) ); } - %$html_header = ( title => _( 'Package Search Results' ) , + %$html_header = ( title => _g( 'Package Search Results' ) , lang => $opts->{lang}, - title_tag => _( 'Debian Package Search Results' ), + title_tag => _g( 'Debian Package Search Results' ), print_title => 1, print_search_field => 'packages', search_field_values => { @@ -226,21 +226,21 @@ sub print_packages { #my ($start, $end) = multipageheader( $input, scalar @pkgs, \%opts ); my $str = '
'; - $str .= "

".sprintf( _( "Found %s matching packages." ), + $str .= "

".sprintf( _g( "Found %s matching packages." ), scalar @$pkgs_list )."

"; #my $count = 0; my $have_exact; if (grep { $_ eq $keyword } @$pkgs_list) { $have_exact = 1; - $str .= '

'._( "Exact hits" ).'

'; + $str .= '

'._g( "Exact hits" ).'

'; $str .= &$print_func( $keyword, $pkgs->{$keyword}||{}, map { $_->{$keyword}||{} } @func_args ); @$pkgs_list = grep { $_ ne $keyword } @$pkgs_list; } if (@$pkgs_list && (($opts->{searchon} ne 'names') || !$opts->{exact})) { - $str .= '

'._( 'Other hits' ).'

' + $str .= '

'._g( 'Other hits' ).'

' if $have_exact; foreach my $pkg (@$pkgs_list) { @@ -250,7 +250,7 @@ sub print_packages { map { $_->{$pkg}||{} } @func_args ); } } elsif (@$pkgs_list) { - $str .= "

".sprintf( _( '%s results have not been displayed because you requested only exact matches.' ), + $str .= "

".sprintf( _g( '%s results have not been displayed because you requested only exact matches.' ), encode_entities("$SEARCH_URL?exact=0&$opts->{common_params}"), scalar @$pkgs_list )."

"; } @@ -262,7 +262,7 @@ sub print_packages { sub print_package { my ($pkg, $pkgs, $provided_by, $archives, $sect, $subsect, $desc) = @_; - my $str = '

'.sprintf( _( 'Package %s' ), $pkg ).'

'; + my $str = '

'.sprintf( _g( 'Package %s' ), $pkg ).'

'; $str .= '