diff options
-rwxr-xr-x | bin/gettext-extract | 4 | ||||
-rw-r--r-- | perllib/Page.pm | 57 | ||||
-rwxr-xr-x | web/contact.cgi | 5 | ||||
-rwxr-xr-x | web/index.cgi | 30 |
4 files changed, 55 insertions, 41 deletions
diff --git a/bin/gettext-extract b/bin/gettext-extract index 8433e4ca9..7c85626a8 100755 --- a/bin/gettext-extract +++ b/bin/gettext-extract @@ -7,7 +7,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: gettext-extract,v 1.4 2008-11-17 11:48:33 matthew Exp $ +# $Id: gettext-extract,v 1.5 2009-02-02 10:59:15 matthew Exp $ if [ -e ../../locale ] then @@ -40,7 +40,7 @@ PO=locale/FixMyStreet.po rm -f $PO # Extract from Perl -xgettext --add-comments=TRANS --language=Perl --keyword=_ --from-code=utf-8 -o $PO perllib/mySociety/*.pm bci/perllib/*.pm bci/web/*.cgi bci/bin/send-reports +xgettext --add-comments=TRANS --language=Perl --keyword=_ --keyword=nget:1,2 --from-code=utf-8 -o $PO perllib/mySociety/*.pm bci/perllib/*.pm bci/web/*.cgi bci/bin/send-reports # Fix headers TEMP=`tempfile` diff --git a/perllib/Page.pm b/perllib/Page.pm index 47388b25b..107d5cd0a 100644 --- a/perllib/Page.pm +++ b/perllib/Page.pm @@ -6,7 +6,7 @@ # Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: Page.pm,v 1.136 2009-01-26 14:22:54 matthew Exp $ +# $Id: Page.pm,v 1.137 2009-02-02 10:59:15 matthew Exp $ # package Page; @@ -74,13 +74,16 @@ sub report_error { warn "aborting"; ent($msg); my $contact_email = mySociety::Config::get('CONTACT_EMAIL'); + my $trylater = sprintf(_("Please try again later, or <a href=\"mailto:%s\">email us</a> to let us know."), $contact_email); + my $somethingwrong = _("Sorry! Something's gone wrong."); + my $errortext = _("The text of the error was:"); print "Status: 500\nContent-Type: text/html; charset=iso-8859-1\n\n", - q(<html><head><title>Sorry! Something's gone wrong.</title></head></html>), + qq(<html><head><title>$somethingwrong</title></head></html>), q(<body>), - q(<h1>Sorry! Something's gone wrong.</h1>), - qq(<p>Please try again later, or <a href="mailto:$contact_email">email us</a> to let us know.</p>), + qq(<h1>$somethingwrong</h1>), + qq(<p>$trylater</p>), q(<hr>), - q(<p>The text of the error was:</p>), + qq(<p>$errortext</p>), qq(<blockquote class="errortext">$msg</blockquote>), q(</body></html>); } @@ -148,13 +151,14 @@ sub header ($%) { close FP; $html =~ s#<!-- TITLE -->#$title#; } else { + my $fixmystreet = _('FixMyStreet'); $html = <<EOF; <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en-gb"> <head> <script type="text/javascript" src="/yui/utilities.js"></script> <script type="text/javascript" src="/js.js"></script> - <title>${title}FixMyStreet</title> + <title>${title}$fixmystreet</title> <style type="text/css">\@import url("/css/core.css"); \@import url("/css/main.css");</style> <!--[if LT IE 7]> <style type="text/css">\@import url("/css/ie6.css");</style> @@ -165,7 +169,7 @@ sub header ($%) { <body> EOF $html .= $home ? '<h1 id="header">' : '<div id="header"><a href="/">'; - $html .= 'Fix<span id="my">My</span>Street'; + $html .= _('Fix<span id="my">My</span>Street'); $html .= $home ? '</h1>' : '</a></div>'; $html .= '<div id="wrapper"><div id="content">'; } @@ -173,7 +177,7 @@ EOF $html =~ s#<!-- RSS -->#<link rel="alternate" type="application/rss+xml" title="$params{rss}[0]" href="$params{rss}[1]">#; } if (mySociety::Config::get('STAGING_SITE')) { - $html .= '<p id="error">This is a developer site; things might break at any time.</p>'; + $html .= '<p id="error">' . _("This is a developer site; things might break at any time.") . '</p>'; } return $html; } @@ -221,22 +225,29 @@ piwik_log(piwik_action_name, piwik_idsite, piwik_url); EOF } + my $navigation = _('Navigation'); + my $report = _("Report a problem"); + my $reports = _("All reports"); + my $alerts = _("Local alerts"); + my $help = _("Help"); + my $contact = _("Contact"); + my $orglogo = _('<a href="http://www.mysociety.org/"><img id="logo" src="/i/mysociety-dark.png" alt="View mySociety.org"><span id="logoie"></span></a>'); + my $creditline = _('Built by <a href="http://www.mysociety.org/">mySociety</a>, using some <a href="https://secure.mysociety.org/cvstrac/dir?d=mysociety/bci">clever</a> <a href="https://secure.mysociety.org/cvstrac/dir?d=mysociety/services/TilMa">code</a>.'); + return <<EOF; </div></div> -<h2 class="v">Navigation</h2> +<h2 class="v">$navigation</h2> <ul id="navigation"> -<li><a href="/">Report a problem</a></li> -<li><a href="/reports">All reports</a></li> -<li><a href="/alert$pc">Local alerts</a></li> -<li><a href="/faq">Help</a></li> -<li><a href="/contact">Contact</a></li> +<li><a href="/">$report</a></li> +<li><a href="/reports">$reports</a></li> +<li><a href="/alert$pc">$alerts</a></li> +<li><a href="/faq">$help</a></li> +<li><a href="/contact">$contact</a></li> </ul> -<a href="http://www.mysociety.org/"><img id="logo" src="/i/mysociety-dark.png" alt="View mySociety.org"><span id="logoie"></span></a> +$orglogo -<p id="footer">Built by <a href="http://www.mysociety.org/">mySociety</a>, -using some <a href="https://secure.mysociety.org/cvstrac/dir?d=mysociety/bci">clever</a> <a -href="https://secure.mysociety.org/cvstrac/dir?d=mysociety/services/TilMa">code</a>.</p> +<p id="footer">$creditline</p> $track @@ -284,7 +295,7 @@ sub display_map { my $url = mySociety::Config::get('TILES_URL'); my $tiles_url = $url . $x . '-' . ($x+1) . ',' . $y . '-' . ($y+1) . '/RABX'; my $tiles = LWP::Simple::get($tiles_url); - return '<div id="map_box"> <div id="map"><div id="drag"> </div></div></div><div id="side">' if !$tiles; + return '<div id="map_box"> <div id="map"><div id="drag">' . _("Unable to fetch the map tiles from the tile server.") . '</div></div></div><div id="side">' if !$tiles; my $tileids = RABX::unserialise($tiles); my $tl = $x . '.' . ($y+1); my $tr = ($x+1) . '.' . ($y+1); @@ -712,9 +723,9 @@ sub geocode_string { } if (!$js) { - $error = 'Sorry, we had a problem parsing that location. Please try again.'; + $error = _('Sorry, we had a problem parsing that location. Please try again.'); } elsif ($js !~ /"code": *200/) { - $error = 'Sorry, we could not find that location.'; + $error = _('Sorry, we could not find that location.'); } elsif ($js =~ /}, *{/) { # Multiple while ($js =~ /"address": *"(.*?)",\s*"AddressDetails":.*?"PostalCodeNumber": *"(.*?)"/g) { my $address = $1; @@ -722,14 +733,14 @@ sub geocode_string { $address =~ s/UK/$pc, UK/; push (@$error, $address) unless $address =~ /BT\d/; } - $error = 'Sorry, we could not find that location.' unless $error; + $error = _('Sorry, we could not find that location.') unless $error; } elsif ($js =~ /BT\d/) { # Northern Ireland, hopefully $error = "We do not cover Northern Ireland, I'm afraid, as our licence doesn't include any maps for the region."; } else { my ($accuracy) = $js =~ /"Accuracy": *(\d)/; if ($accuracy < 4) { - $error = 'Sorry, that location appears to be too general; please be more specific.'; + $error = _('Sorry, that location appears to be too general; please be more specific.'); } else { $js =~ /"coordinates" *: *\[ *(.*?), *(.*?),/; my $lon = $1; my $lat = $2; diff --git a/web/contact.cgi b/web/contact.cgi index 1cd53187a..da3055b28 100755 --- a/web/contact.cgi +++ b/web/contact.cgi @@ -6,7 +6,7 @@ # Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: contact.cgi,v 1.37 2009-01-26 14:31:19 matthew Exp $ +# $Id: contact.cgi,v 1.38 2009-02-02 10:59:16 matthew Exp $ use strict; use Standard; @@ -120,8 +120,7 @@ homes; use the box accessed from <a href="/">the front page</a>.'); $out .= $q->p(_('Please do <strong>not</strong> report problems through this form; messages go to the team behind FixMyStreet, not a council. To report a problem, please <a href="/">go to the front page</a> and follow the instructions.')); - $out .= $q->p(_("We'd love to hear what you think about this site. Just fill in the form, or -send an email to <a href='mailto:$mailto'>$mailto</a>:")); + $out .= $q->p(sprintf(_("We'd love to hear what you think about this site. Just fill in the form, or send an email to <a href='mailto:%s'>%s</a>:"), $mailto, $mailto)); } my $label_name = _('Your name:'); my $label_email = _('Your email:'); diff --git a/web/index.cgi b/web/index.cgi index a2d5f449e..5c9867432 100755 --- a/web/index.cgi +++ b/web/index.cgi @@ -6,7 +6,7 @@ # Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: index.cgi,v 1.241 2009-01-26 14:29:35 matthew Exp $ +# $Id: index.cgi,v 1.242 2009-02-02 10:59:16 matthew Exp $ use strict; use Standard; @@ -23,6 +23,7 @@ use mySociety::AuthToken; use mySociety::Config; use mySociety::DBHandle qw(select_all); use mySociety::EmailUtil; +use mySociety::Locale; use mySociety::MaPit; use mySociety::PostcodeUtil; use mySociety::Random; @@ -120,28 +121,30 @@ EOF my $updates = Problems::number_comments(); $updates =~ s/(?<=\d)(?=(?:\d\d\d)+$)/,/g; my $new = Problems::recent_new('1 week'); - my $new_text = 'in past week'; + my $new_text = sprintf(mySociety::Locale::nget('<big>%s</big> report in past week', + '<big>%s</big> reports in past week', $new), $new); if ($q->{site} ne 'emptyhomes' && $new > $fixed) { $new = Problems::recent_new('3 days'); - $new_text = 'recently'; + $new_text = sprintf(mySociety::Locale::nget('<big>%s</big> report recently', '<big%s</big> reports recently', $new), $new); } $out .= '<form action="/" method="get" id="postcodeForm">'; if (my $token = $q->param('partial')) { my $id = mySociety::AuthToken::retrieve('partial', $token); if ($id) { + my $thanks = _("Thanks for uploading your photo. We now need to locate your problem, so please enter a nearby street name or postcode in the box below :"); $out .= <<EOF; -<p style="margin-top: 0; color: #cc0000;"><img align="right" src="/photo?id=$id" hspace="5"> -Thanks for uploading your photo. We now need to locate your problem, -so please enter a nearby street name or postcode in the box below :</p> +<p style="margin-top: 0; color: #cc0000;"><img align="right" src="/photo?id=$id" hspace="5">$thanks</p> <input type="hidden" name="partial_token" value="$token"> EOF } } + my $question = _("Enter a nearby GB postcode, or street name and area:"); + my $activate = _("Go"); $out .= <<EOF; -<label for="pc">Enter a nearby GB postcode, or street name and area:</label> +<label for="pc">$question</label> <input type="text" name="pc" value="$pc_h" id="pc" size="10" maxlength="200"> - <input type="submit" value="Go" id="submit"> + <input type="submit" value="$activate" id="submit"> </form> <div id="front_intro"> @@ -159,10 +162,11 @@ EOF $out .= $q->h2(_('FixMyStreet updates')); $out .= $q->div({-id => 'front_stats'}, - $q->div("<big>$new</big> report" . ($new!=1?'s':''), $new_text), - ($q->{site} ne 'emptyhomes' ? $q->div("<big>$fixed</big> fixed in past month") - : ''), # $q->div("<big>$fixed</big> back in use in past month")), - $q->div("<big>$updates</big> update" . ($updates ne '1'?'s':''), "on reports"), + $q->div($new_text), + ($q->{site} ne 'emptyhomes' ? $q->div(sprintf(mySociety::Locale::nget("<big>%s</big> fixed in past month", "<big>%s</big> fixed in past month", $fixed), $fixed)) + : ''), # $q->div(sprintf(_('<big>%s</big> back in use in past month'), $fixed)), + $q->div(sprintf(mySociety::Locale::nget("<big>%s</big> update on reports", + "<big>%s</big> updates on reports", $updates), $updates)) ); $out .= <<EOF; @@ -881,7 +885,7 @@ sub display_problem { $out .= Page::display_problem_text($q, $problem); $out .= $q->p({align=>'right'}, - $q->small($q->a({rel => 'nofollow', href => '/contact?id=' . $input{id}}, 'Offensive? Unsuitable? Tell us')) + $q->small($q->a({rel => 'nofollow', href => '/contact?id=' . $input{id}}, _('Offensive? Unsuitable? Tell us'))) ); my $back = NewURL($q, -url => '/', 'x' => $x_tile, 'y' => $y_tile ); |