[NUUG fiksgatami] [patch] Polish translations and make more text translatable

Petter Reinholdtsen pere at hungry.com
Wed Feb 16 22:57:53 CET 2011


Here is an updated translation polishing some of the texts.

I also include untested code to make some missing texts translatable.
Please review and test before commiting if the changes are ok.  I just
pass it on to get feedback on the approach, as I lack the time right
now to test it.

The perllib/Page.pm change is representative for a problem I found
several places, where it is assumed that adding 's' at the end of a
work make it plural.  This is not the case for Norwegian.

Happy hacking,
-- 
Petter Reinholdtsen
-------------- next part --------------
diff --git a/bin/send-reports b/bin/send-reports
index 7f94546..5bd47a6 100755
--- a/bin/send-reports
+++ b/bin/send-reports
@@ -174,22 +174,22 @@ foreach my $row (@$unsent) {
         $template = File::Slurp::read_file("$FindBin::Bin/../templates/emails/$template");
 
         if ($h{category} eq 'Other') {
-            $h{category_footer} = 'this type of local problem';
+            $h{category_footer} = _('this type of local problem');
             $h{category_line} = '';
         } else {
             $h{category_footer} = "'" . $h{category} . "'";
-            $h{category_line} = "Category: $h{category}\n\n";
+            $h{category_line} = sprintf(_("Category: %s"), $h{category}) . "\n\n";
         }
 
-        $h{councils_name} = join(' and ', @dear);
-        $h{multiple} = @dear>1 ? "[ This email has been sent to both councils covering the location of the problem, as the user did not categorise it; please ignore it if you're not the correct council to deal with the issue, or let us know what category of problem this is so we can add it to our system. ]\n\n"
+        $h{councils_name} = join(_(' and '), @dear);
+        $h{multiple} = @dear>1 ? "[ " . _("This email has been sent to both councils covering the location of the problem, as the user did not categorise it; please ignore it if you're not the correct council to deal with the issue, or let us know what category of problem this is so we can add it to our system.") . " ]\n\n"
             : '';
         $h{missing} = ''; 
         if ($missing) {
             my $name = encode_utf8($areas_info->{$missing}->{name});
-            $h{missing} = '[ We realise this problem might be the responsibility of ' . $name
-                . "; however, we don't currently have any contact details for them.
-If you know of an appropriate contact address, please do get in touch. ]\n\n";
+            $h{missing} = '[ '
+              . sprintf(_('We realise this problem might be the responsibility of %s; however, we don't currently have any contact details for them. If you know of an appropriate contact address, please do get in touch.'), $name)
+              . ' ]\n\n";
         }
 
     }
diff --git a/locale/nb_NO.UTF-8/LC_MESSAGES/FixMyStreet.po b/locale/nb_NO.UTF-8/LC_MESSAGES/FixMyStreet.po
index 40d5ea8..3d63e18 100644
--- a/locale/nb_NO.UTF-8/LC_MESSAGES/FixMyStreet.po
+++ b/locale/nb_NO.UTF-8/LC_MESSAGES/FixMyStreet.po
@@ -10,7 +10,7 @@ msgstr ""
 "Project-Id-Version: FixMyStreet\n"
 "Report-Msgid-Bugs-To: matthew at mysociety.org\n"
 "POT-Creation-Date: 2011-02-14 13:35+0000\n"
-"PO-Revision-Date: 2011-02-15 14:46MET\n"
+"PO-Revision-Date: 2011-02-16 12:25MET\n"
 "Last-Translator: Petter Reinholdtsen <pere at hungry.com>\n"
 "Language-Team: Norwegian Bokm??l <i18n-nb at lister.ping.uio.no>\n"
 "MIME-Version: 1.0\n"
@@ -118,7 +118,7 @@ msgid ""
 "\"logoie\"></span></a>"
 msgstr ""
 "<div id=\"logo\" align=\"center\"><a href=\"http://www.nuug.no/\">NUUG</a> "
-"and<br><a href=\"http://www.mysociety.org/\"><img width=\"133\" "
+"and<br><a href=\"http://www.mysociety.org/\"><img  id=\"logo\" width=\"133\" "
 "height=\"26\" border=0 src=\"/i/mysociety-dark.png\" alt=\"mySociety\"><span "
 "id=\"logoie\"></span></a></div>"
 
@@ -200,52 +200,52 @@ msgstr "minutt"
 #: perllib/Page.pm:531
 #, perl-format
 msgid "%s, reported anonymously at %s"
-msgstr "%s, rapportert anonymt den %s"
+msgstr "%s, rapportert anonymt %s"
 
 #: perllib/Page.pm:533
 #, perl-format
 msgid "%s, reported by %s at %s"
-msgstr "%s, rapportert av %s den %s"
+msgstr "%s, rapportert av %s %s"
 
 #: perllib/Page.pm:537
 #, perl-format
 msgid "Reported by %s in the %s category anonymously at %s"
-msgstr "Rapportert av %s i kategorien %s anonnymt den %s"
+msgstr "Rapportert av %s i kategorien %s anonnymt %s"
 
 #: perllib/Page.pm:539
 #, perl-format
 msgid "Reported by %s in the %s category by %s at %s"
-msgstr "Rapportert av %s i kategorien %s av %s den %s"
+msgstr "Rapportert av %s i kategorien %s av %s %s"
 
 #: perllib/Page.pm:541
 #, perl-format
 msgid "Reported by %s anonymously at %s"
-msgstr "Publisert av %s anonymt den %s"
+msgstr "Publisert av %s anonymt %s"
 
 #: perllib/Page.pm:543
 #, perl-format
 msgid "Reported by %s by %s at %s"
-msgstr "Rapporter av %s av %s den %s"
+msgstr "Rapporter av %s av %s %s"
 
 #: perllib/Page.pm:545
 #, perl-format
 msgid "Reported in the %s category anonymously at %s"
-msgstr "Rapportert i kategorien %s anonymt den %s"
+msgstr "Rapportert i kategorien %s anonymt %s"
 
 #: perllib/Page.pm:547
 #, perl-format
 msgid "Reported in the %s category by %s at %s"
-msgstr "Rapportert i kategorien %s av %s den %s"
+msgstr "Rapportert i kategorien %s av %s %s"
 
 #: perllib/Page.pm:549
 #, perl-format
 msgid "Reported anonymously at %s"
-msgstr "Rapportert anonymt den %s"
+msgstr "Rapportert anonymt %s"
 
 #: perllib/Page.pm:551
 #, perl-format
 msgid "Reported by %s at %s"
-msgstr "Publisert av %s den %s"
+msgstr "Publisert av %s %s"
 
 #: perllib/Page.pm:556
 msgid "the map was not used so pin location may be inaccurate"
@@ -267,12 +267,12 @@ msgstr "Oppdateringer"
 #: perllib/Page.pm:623
 #, perl-format
 msgid "Posted by %s at %s"
-msgstr "Sendt inn av %s den %s"
+msgstr "Sendt inn av %s %s"
 
 #: perllib/Page.pm:625
 #, perl-format
 msgid "Posted anonymously at %s"
-msgstr "Publisert anonymt den %s"
+msgstr "Publisert anonymt %s"
 
 #: perllib/Page.pm:628
 msgid "marked as fixed"
@@ -1064,7 +1064,7 @@ msgstr "Du har ikke spesifisert koordinater, vennligst pr??v p?? nytt"
 
 #: web/index.cgi:389 web/index.cgi:550 web/index.cgi:557
 msgid "Other"
-msgstr "Andre"
+msgstr "Annet"
 
 #: web/index.cgi:406
 #, perl-format
@@ -1346,7 +1346,7 @@ msgstr "RSS-str??m med oppdateringer for dette problemet"
 
 #: web/index.cgi:1065
 msgid "Provide an update"
-msgstr "Send en oppdatering"
+msgstr "Bidra med oppdatering"
 
 #: web/index.cgi:1071
 msgid "Update:"
@@ -1362,9 +1362,10 @@ msgid ""
 "it will be public. Your information will only be used in accordance with our "
 "<a href=\"/faq#privacy\">privacy policy</a>"
 msgstr ""
-"Vennligst merk at oppdateringer er ikke sendt til kommunen.  Hvis du legger "
-"igjen ditt navn s?? vil det v??re offentlig. Din informasjon vil kun bli brukt "
-"i henhold til v??re <a href=\"/faq#privacy\">personvernpolicy</a>"
+"Vennligst merk at oppdateringer ikke blir sendt til kommunen.  Hvis du "
+"legger igjen navnet ditt s?? vil det v??re offentlig tilgjengelig. Din "
+"informasjon vil kun bli brukt i henhold til v??re <a href=\"/faq#privacy"
+"\">personvernpolicy</a>"
 
 #: web/index.cgi:1099
 msgid "Updates to this problem, FixMyStreet"
@@ -1451,7 +1452,7 @@ msgstr ""
 "forslag: hva med ?? fors??ke\n"
 "<a href=\"%s\">?? skrive direkte til din kommune</a>, eller hvis det er et "
 "problem som kan fikses\n"
-"av folk lokalt som jobber sammen, hva med ?? <a href=\"http://www.pledgebank."
+"av befolkningen som jobber sammen, hva med ?? <a href=\"http://www.pledgebank."
 "com/new\">lage\n"
 "en \"pledge\" og publiser den</a>?</p>\n"
 
@@ -2366,7 +2367,7 @@ msgstr ""
 "Hvis det er en mer passende epostadresse for meldinger om\n"
 "<?=$values['category_footer']?>, v??r s?? snill ?? gi oss beskjed ved ?? bes??ke\n"
 "<http://www.fiksgatami.no/contact>.\n"
-"Dette vil bidra til ?? forbedre tjenesten for de lokale folkene. Vi\n"
+"Dette vil bidra til ?? forbedre tjenesten for befolkningen. Vi\n"
 "tar ogs?? gjerne imot andre tilbakemeldinger som du har noen. ]\n"
 "\n"
 
@@ -2422,7 +2423,7 @@ msgstr ""
 "Kj??re <?=$values['councils_name']?>,\n"
 "\n"
 "<?=$values['missing']?><?=$values['multiple']?>En bruker av\n"
-"FiksGataMi har sendt inn f??lgende rapport om et localt\n"
+"FiksGataMi har sendt inn f??lgende rapport om et lokalt\n"
 "problem som vi tror trenger deres oppmerksomhet.\n"
 "\n"
 "<?=$values['fuzzy']?>, eller for ?? bidra med en oppdatering om problemet,\n"
diff --git a/perllib/FixMyStreet/Alert.pm b/perllib/FixMyStreet/Alert.pm
index cdc0702..4a6e635 100644
--- a/perllib/FixMyStreet/Alert.pm
+++ b/perllib/FixMyStreet/Alert.pm
@@ -306,7 +306,9 @@ sub generate_rss ($$$;$$$$) {
         if ($display_photos && $row->{photo}) {
             $item{description} .= ent("\n<br><img src=\"". Cobrand::url($cobrand, $url, $http_q) . "/photo?id=$row->{id}\">");
         }
-        $item{description} .= ent("\n<br><a href='$cobrand_url'>Report on FixMyStreet</a>");
+        my $recipient_name = Cobrand::contact_name($cobrand);
+        $item{description} .= ent("\n<br><a href='$cobrand_url'>" .
+            sprintf(_("Report on %s"), $recipient_name) . "</a>");
 
         if ($row->{latitude} || $row->{longitude}) {
             $item{georss} = { point => "$row->{latitude} $row->{longitude}" };
diff --git a/perllib/Page.pm b/perllib/Page.pm
index 308d2a5..f9d1a16 100644
--- a/perllib/Page.pm
+++ b/perllib/Page.pm
@@ -507,17 +507,17 @@ sub prettify_duration {
         return _('less than a minute') if $s == 0;
     }
     my @out = ();
-    _part(\$s, 60*60*24*7, _('week'), \@out);
-    _part(\$s, 60*60*24, _('day'), \@out);
-    _part(\$s, 60*60, _('hour'), \@out);
-    _part(\$s, 60, _('minute'), \@out);
+    _part(\$s, 60*60*24*7, _('week'), _('weeks'), \@out);
+    _part(\$s, 60*60*24, _('day'), _('days'), \@out);
+    _part(\$s, 60*60, _('hour'), _('hours'), \@out);
+    _part(\$s, 60, _('minute'), _('minutes'), \@out);
     return join(', ', @out);
 }
 sub _part {
-    my ($s, $m, $w, $o) = @_;
+    my ($s, $m, $w1, $w2, $o) = @_;
     if ($$s >= $m) {
         my $i = int($$s / $m);
-        push @$o, "$i $w" . ($i != 1 ? 's' : '');
+        push @$o, ($i != 1 ? "$i $w1" : "$i $w2");
         $$s -= $i * $m;
     }
 }
diff --git a/web-admin/index.cgi b/web-admin/index.cgi
index b2322cd..e4731c4 100755
--- a/web-admin/index.cgi
+++ b/web-admin/index.cgi
@@ -119,8 +119,8 @@ sub fetch_data {
 sub admin_summary ($) {
     my ($q) = @_;
     my $cobrand = Page::get_cobrand($q);
-    print html_head($q, "Summary");
-    print $q->h1("Summary");
+    print html_head($q, _("Summary"));
+    print $q->h1(_("Summary"));
 
     my $contacts = Problems::contact_counts($cobrand);
     my %contacts = @$contacts;
diff --git a/web/contact.cgi b/web/contact.cgi
index fd0043d..8c8c192 100755
--- a/web/contact.cgi
+++ b/web/contact.cgi
@@ -106,6 +106,8 @@ sub contact_details {
     my $out = '';
     my $sitename = _('FixMyStreet');
     my $contact_info = '';
+    if ( mySociety::Config::get('COUNTRY') eq 'GB' ) {
+        # XXX Rewrite to make brandable?
     $contact_info .= <<EOF;
 <div class="contact-details">
 <p>$sitename is a service provided by mySociety, which is the project of a 
@@ -120,6 +122,7 @@ UK</p>
 </div>
 EOF
     $out .= $contact_info unless $q->{site} eq 'emptyhomes'; 
+    }
     return $out;
 }
 
diff --git a/web/index.cgi b/web/index.cgi
index 7c8ecad..025d3f3 100755
--- a/web/index.cgi
+++ b/web/index.cgi
@@ -640,13 +640,9 @@ If this is not the correct location, simply click on the map again. '));
     if ($details eq 'all') {
         my $council_list = join('</strong> or <strong>', map { encode_utf8($_->{name}) } values %$all_councils);
         if ($q->{site} eq 'emptyhomes'){
-            $vars{text_help} = '<p>' . sprintf(_('All the information you provide here will be sent to <strong>%s</strong>.
-On the site, we will show the subject and details of the problem, plus your
-name if you give us permission.'), $council_list);
+            $vars{text_help} = '<p>' . sprintf(_('All the information you provide here will be sent to <strong>%s</strong>. On the site, we will show the subject and details of the problem, plus your name if you give us permission.'), $council_list);
         } else {
-            $vars{text_help} = '<p>' . sprintf(_('All the information you provide here will be sent to <strong>%s</strong>.
-The subject and details of the problem will be public, plus your
-name if you give us permission.'), $council_list);
+            $vars{text_help} = '<p>' . sprintf(_('All the information you provide here will be sent to <strong>%s</strong>. The subject and details of the problem will be public, plus your name if you give us permission.'), $council_list);
         }
         $vars{text_help} .= '<input type="hidden" name="council" value="' . join(',', keys %$all_councils) . '">';
     } elsif ($details eq 'some') {
@@ -657,15 +653,17 @@ name if you give us permission.'), $council_list);
             push @missing, $_ unless $councils{$_};
         }
         my $n = @missing;
-        my $list = join(' or ', map { encode_utf8($all_councils->{$_}->{name}) } @missing);
-        $vars{text_help} = '<p>All the information you provide here will be sent to <strong>'
-            . join('</strong> or <strong>', map { encode_utf8($all_councils->{$_}->{name}) } @councils)
-            . '</strong>. The subject and details of the problem will be public, plus your
-name if you give us permission.';
-        $vars{text_help} .= ' We do <strong>not</strong> yet have details for the other council';
-        $vars{text_help} .= ($n>1) ? 's that cover' : ' that covers';
-        $vars{text_help} .= " this location. You can help us by finding a contact email address for local
-problems for $list and emailing it to us at <a href='mailto:$e'>$e</a>.";
+        my $list = join(_(' or '), map { encode_utf8($all_councils->{$_}->{name}) } @missing);
+        $vars{text_help} = '<p>' . _('All the information you provide here will be sent to') . '<strong>'
+            . join('</strong>' . _(' or ') . '<strong>', map { encode_utf8($all_councils->{$_}->{name}) } @councils)
+            . '</strong>. ';
+        $vars{text_help} .= _('The subject and details of the problem will be public, plus your name if you give us permission.');
+        if ($n>1) {
+            $vars{text_help} .= _('We do <strong>not</strong> yet have details for the other councils that cover this location.');
+        } else {
+            $vars{text_help} .= _('We do <strong>not</strong> yet have details for the other council that covers this location.');
+        }
+        $vars{text_help} .=  ' ' . sprintf(_("You can help us by finding a contact email address for local problems for %s and emailing it to us at <a href='mailto:%s'>%s</a>."), $list, $e, $e);
         $vars{text_help} .= '<input type="hidden" name="council" value="' . join(',', @councils)
             . '|' . join(',', @missing) . '">';
     } else {
@@ -673,17 +671,18 @@ problems for $list and emailing it to us at <a href='mailto:$e'>$e</a>.";
         my $list = join(' or ', map { encode_utf8($_->{name}) } values %$all_councils);
         my $n = scalar keys %$all_councils;
         if ($q->{site} ne 'emptyhomes') {
-            $vars{text_help} = '<p>We do not yet have details for the council';
-            $vars{text_help} .= ($n>1) ? 's that cover' : ' that covers';
-            $vars{text_help} .= " this location. If you submit a problem here the subject and details 
-of the problem will be public, but the problem will <strong>not</strong> be reported to the council.
-You can help us by finding a contact email address for local
-problems for $list and emailing it to us at <a href='mailto:$e'>$e</a>.";
+            $vars{text_help} = '<p>';
+            if ($n>1) {
+                $vars{text_help} .=
+                    _('We do not yet have details for the councils that cover this location.');
         } else {
-            $vars{text_help} = _("<p>We do not yet have details for the council that covers
-this location. If you submit a report here it will be left on the site, but
-not reported to the council &ndash; please still leave your report, so that
-we can show to the council the activity in their area.");
+                $vars{text_help} .=
+                    _('We do not yet have details for the council that covers this location.');
+            }
+            $vars{text_help} .= _("If you submit a problem here the subject and details of the problem will be public, but the problem will <strong>not</strong> be reported to the council.");
+            $vars{text_help} .= sprintf(_("You can help us by finding a contact email address for local problems for %s and emailing it to us at <a href='mailto:%se'>%s</a>."), $list, $e, $e;
+        } else {
+            $vars{text_help} = _("<p>We do not yet have details for the council that covers this location. If you submit a report here it will be left on the site, but not reported to the council &ndash; please still leave your report, so that we can show to the council the activity in their area.");
         }
         $vars{text_help} .= '<input type="hidden" name="council" value="-1">';
     }
@@ -763,27 +762,18 @@ EOF
     }
 
     if ($q->{site} ne 'emptyhomes') {
-        $vars{text_notes} = <<EOF;
-<p>Please note:</p>
-<ul>
-<li>We will only use your personal
-information in accordance with our <a href="/faq#privacy">privacy policy.</a></li>
-<li>Please be polite, concise and to the point.</li>
-<li>Please do not be abusive &mdash; abusing your council devalues the service for all users.</li>
-<li>Writing your message entirely in block capitals makes it hard to read,
-as does a lack of punctuation.</li>
-<li>Remember that FixMyStreet is primarily for reporting physical
-problems that can be fixed. If your problem is not appropriate for
-submission via this site remember that you can contact your council
-directly using their own website.</li>
-<li>
-FixMyStreet and the Guardian are providing this service in
-partnership in <a href="/faq#privacy">certain cities</a>. In those cities, both have access to
-any information submitted, including names and email addresses, and will use it only to ensure the
-smooth running of the service, in accordance with their privacy policies.
-</li>
-</ul>
-EOF
+        $vars{text_notes} =
+            p(_("Please note:")) .
+            "<ul>" .
+            li(_("We will only use your personal information in accordance with our <a href=\"/faq#privacy\">privacy policy.</a>")) .
+            li(_("Please be polite, concise and to the point.")) .
+            li(_("Please do not be abusive &mdash; abusing your council devalues the service for all users.")) .
+            li(_("Writing your message entirely in block capitals makes it hard to read, as does a lack of punctuation.")) .
+            li(_("Remember that FixMyStreet is primarily for reporting physical problems that can be fixed. If your problem is not appropriate for submission via this site remember that you can contact your council directly using their own website."));
+        $vars{text_notes} .=
+            li(_("FixMyStreet and the Guardian are providing this service in partnership in <a href=\"/faq#privacy\">certain cities</a>. In those cities, both have access to any information submitted, including names and email addresses, and will use it only to ensure the smooth running of the service, in accordance with their privacy policies."))
+            if mySociety::Config::get('COUNTRY') eq 'GB';
+        $vars{text_notes} .= "</ul>\n";
     }
 
     %vars = (%vars, 
@@ -795,6 +785,16 @@ EOF
     return (Page::template_include('report-form', $q, Page::template_root($q), %vars), robots => 'noindex,nofollow');
 }
 
+sub li {
+    my $s = shift;
+    return "<li>$s</li>\n";
+}
+
+sub p {
+    my $s = shift;
+    return "<p>$s</p>\n";
+}
+
 # redirect from osgb
 sub redirect_from_osgb_to_wgs84 {
     my ($q) = @_;


More information about the fiksgatami mailing list