diff options
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/Page.pm | 53 | ||||
-rw-r--r-- | perllib/PoChange.pm | 37 |
2 files changed, 69 insertions, 21 deletions
diff --git a/perllib/Page.pm b/perllib/Page.pm index 843edcb64..32a7a5973 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.144 2009-05-27 13:53:52 matthew Exp $ +# $Id: Page.pm,v 1.145 2009-07-07 11:49:06 matthew Exp $ # package Page; @@ -103,7 +103,9 @@ sub microsite { $q->{site} = 'guardian' if $host =~ /guardian/; if ($q->{site} eq 'emptyhomes') { - mySociety::Locale::negotiate_language('en-gb,English,en_GB|cy,Cymraeg,cy_GB'); + my $lang; + $lang = 'cy' if $host =~ /cy/; + mySociety::Locale::negotiate_language('en-gb,English,en_GB|cy,Cymraeg,cy_GB', $lang); mySociety::Locale::gettext_domain('FixMyStreet-EmptyHomes'); mySociety::Locale::change(); } else { @@ -150,10 +152,19 @@ sub header ($%) { open FP, $file . '/../templates/website/' . $q->{site} . '-header'; $html = join('', <FP>); close FP; - $html =~ s#<!-- TITLE -->#$title#; + my %vars = ( + 'report' => _('Report a problem'), + 'reports' => _('All reports'), + 'alert' => _('Local alerts'), + 'faq' => _('Help'), + 'about' => _('About us'), + 'title' => $title, + 'site_title' => _('Report Empty Homes'), + ); + $html =~ s#{{ ([a-z_]+) }}#$vars{$1}#g; } else { my $fixmystreet = _('FixMyStreet'); - my $lang = $mySociety::Locale::lang; + my $lang = $mySociety::Locale::lang; $html = <<EOF; <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="$lang"> @@ -595,27 +606,27 @@ sub display_problem_text { if ($q->{site} eq 'emptyhomes') { if ($problem->{anonymous}) { $out .= sprintf(_('%s, reported anonymously at %s'), ent($problem->{category}), prettify_epoch($problem->{time})); - } else { + } else { $out .= sprintf(_('%s, reported by %s at %s'), ent($problem->{category}), ent($problem->{name}), prettify_epoch($problem->{time})); - } + } } else { if ($problem->{service} && $problem->{category} && $problem->{category} ne 'Other' && $problem->{anonymous}) { - $out .= sprintf(_('Reported by %s in the %s category anonymously at %s'), ent($problem->{service}), ent($problem->{category}), prettify_epoch($problem->{time})); + $out .= sprintf(_('Reported by %s in the %s category anonymously at %s'), ent($problem->{service}), ent($problem->{category}), prettify_epoch($problem->{time})); } elsif ($problem->{service} && $problem->{category} && $problem->{category} ne 'Other') { - $out .= sprintf(_('Reported by %s in the %s category by %s at %s'), ent($problem->{service}), ent($problem->{category}), ent($problem->{name}), prettify_epoch($problem->{time})); - } elsif ($problem->{service} && $problem->{anonymous}) { - $out .= sprintf(_('Reported by %s anonymously at %s'), ent($problem->{service}), prettify_epoch($problem->{time})); - } elsif ($problem->{service}) { - $out .= sprintf(_('Reported by %s by %s at %s'), ent($problem->{service}), ent($problem->{name}), prettify_epoch($problem->{time})); - } elsif ($problem->{category} && $problem->{category} ne 'Other' && $problem->{anonymous}) { - $out .= sprintf(_('Reported in the %s category anonymously at %s'), ent($problem->{category}), prettify_epoch($problem->{time})); - } elsif ($problem->{category} && $problem->{category} ne 'Other') { - $out .= sprintf(_('Reported in the %s category by %s at %s'), ent($problem->{category}), ent($problem->{name}), prettify_epoch($problem->{time})); - } elsif ($problem->{anonymous}) { - $out .= sprintf(_('Reported anonymously at %s'), prettify_epoch($problem->{time})); - } else { - $out .= sprintf(_('Reported by %s at %s'), ent($problem->{name}), prettify_epoch($problem->{time})); - } + $out .= sprintf(_('Reported by %s in the %s category by %s at %s'), ent($problem->{service}), ent($problem->{category}), ent($problem->{name}), prettify_epoch($problem->{time})); + } elsif ($problem->{service} && $problem->{anonymous}) { + $out .= sprintf(_('Reported by %s anonymously at %s'), ent($problem->{service}), prettify_epoch($problem->{time})); + } elsif ($problem->{service}) { + $out .= sprintf(_('Reported by %s by %s at %s'), ent($problem->{service}), ent($problem->{name}), prettify_epoch($problem->{time})); + } elsif ($problem->{category} && $problem->{category} ne 'Other' && $problem->{anonymous}) { + $out .= sprintf(_('Reported in the %s category anonymously at %s'), ent($problem->{category}), prettify_epoch($problem->{time})); + } elsif ($problem->{category} && $problem->{category} ne 'Other') { + $out .= sprintf(_('Reported in the %s category by %s at %s'), ent($problem->{category}), ent($problem->{name}), prettify_epoch($problem->{time})); + } elsif ($problem->{anonymous}) { + $out .= sprintf(_('Reported anonymously at %s'), prettify_epoch($problem->{time})); + } else { + $out .= sprintf(_('Reported by %s at %s'), ent($problem->{name}), prettify_epoch($problem->{time})); + } } $out .= '; ' . _('the map was not used so pin location may be inaccurate') unless ($problem->{used_map}); if ($problem->{council}) { diff --git a/perllib/PoChange.pm b/perllib/PoChange.pm new file mode 100644 index 000000000..8142b3caa --- /dev/null +++ b/perllib/PoChange.pm @@ -0,0 +1,37 @@ +#!/usr/bin/perl -w +use strict; + +package PoChange; + +# Takes a msgid from the main FixMyStreet .po file and +# converts it to a msgid for the ReportEmptyHomes .po file +sub fixmystreet_to_reportemptyhomes($) { + my $s = shift; + + $s =~ s/FixMyStreet/reportemptyhomes.com/g; + $s =~ s/\bproblem\b/empty property/g; + $s =~ s/\bProblem\b/Empty property/g; + $s =~ s/\bproblems\b/empty properties/g; + $s =~ s/\bProblems\b/Empty properties/g; + $s =~ s/a empty/an empty/g; + $s =~ s/fixed/returned to use/g; + + $s =~ s/Recently put back into use empty properties/Recent empty properties put back into use/; + $s =~ s/New empty properties/New empty property reports/; + $s =~ s/Older empty properties/Older empty property reports/; + $s =~ s/Report, view, or discuss local empty properties/Report and view empty properties/; + + $s =~ s/\(like graffiti.*\)/ /; + $s =~ s/(Please enter your full name).*? -/$1 -/; + + $s =~ s/We send it to the council on your behalf/The details will be sent directly to the right person in the local council for them to take action/; + $s =~ s/To find out what local alerts we have for you/To find out what local alerts we have in your area, council or ward/; + $s =~ s/Local alerts/Get local reports/; + $s =~ s/All reports/Reports/; + $s =~ s/Report an empty property/Report a property/; + $s =~ s/Help/FAQs/; + + return $s; +} + +1; |