Thomas Wood [Tue, 29 Sep 2009 03:58:33 +0000 (03:58 +0000)]
Tests for [17838]
Why is our testing fixtures such a mess? It took me half an hour to find a useable node. And I'm still not sure if it's ok, since I want to get to bed. kthxbye
Commiting 26 new language translations (although some are really
small) from Translatewiki. This more than doubles the translations we
have as we had 25 before.
* Add more keys from the optional list that we don't want to ignor
* Don't delete a singular form if the plural form exists in the source language (en)
* Don't nuke site.key.table.entry singularls when the source language (en) has an array
Matt Amos [Mon, 28 Sep 2009 16:01:00 +0000 (16:01 +0000)]
First version of blocking feature. Allows both time-based (for map protection) and notice-based (for education) blocks on users. Also introduces user roles and a simple UI for displaying and administering these.
Deal with values which are arrays, before and after:
avar@aoeu:~/src/osm/sites/rails_port/config/locales$ perl ../../script/locale/diff --dump-flat de.yml|egrep "Nähe|Uni"
message.inbox.people_mapping_nearby: Mappern in deiner Nähe
message.outbox.people_mapping_nearby: Mappern in deiner Nähe
- "Universit\xC3\xA4t"
user.friend_map.nearby mapper: "Mapper in der Nähe: [[nearby_user]]"
user.view.nearby users: "Benutzer in der Nähe:"
user.view.no nearby users: Es gibt bisher keine Benutzer, die einen Standort in deiner Nähe angegeben haben.
avar@aoeu:~/src/osm/sites/rails_port/config/locales$ perl ../../script/locale/diff --dump-flat de.yml|egrep "Nähe|Uni"
message.inbox.people_mapping_nearby: Mappern in deiner Nähe
message.outbox.people_mapping_nearby: Mappern in deiner Nähe
- Universität
user.friend_map.nearby mapper: "Mapper in der Nähe: [[nearby_user]]"
user.view.nearby users: "Benutzer in der Nähe:"
user.view.no nearby users: Es gibt bisher keine Benutzer, die einen Standort in deiner Nähe angegeben haben.
Some of these files were in ISO-8859-1, no idea how that happened.
Fixed with:
{{{
for i in $(file *|grep ISO|awk '{print $1}'|sed s/://); do cat $i | iconv -f iso-8859-1 -t utf-8 > $i.utf8;done
for i in *yml; do mv $i.utf8 $i; done
}}}
Delete redundant translations from localised files.
I used this script:
{{{
#!/usr/bin/env perl
use feature ':5.10';
use strict;
use warnings;
use YAML::Syck qw(Load LoadFile Dump DumpFile);
use File::Slurp qw(slurp);
use Data::Dump 'dump';
use Encode qw(decode);
use autodie;
my %lang;
chdir 'locales';
my @yml = glob "*.yml";
my @lang = map { s/\.yml//; $_ } @yml;
for my $lang (@lang) {
say "Loading $lang";
$lang{$lang} = LoadFile("$lang.yml")->{$lang};
}
for my $lang (grep { $_ ne 'en' } @lang) {
while (my ($k, $v) = each %{ $lang{ $lang } }) {
if ($lang{ $lang }->{$k} eq $lang{ en }->{$k}
or (exists $lang{ $lang }->{$k} and not exists $lang{ en }->{$k})) {
delete $lang{ $lang }->{$k};
}
}
}
for my $lang (@lang) {
DumpFile("$lang.yml", { $lang => $lang{$lang} }) or die "arghl";
}
}}}
Convert all the Potlatch locale files to a rails-like format (to make
it easier for Translatewiki).
Here's the program I used to convert it:
{{{
#!/usr/bin/env perl
use feature ':5.10';
use strict;
use warnings;
use YAML::Syck qw(Load LoadFile Dump DumpFile);
use File::Slurp qw(slurp);
use Data::Dump 'dump';
use Encode qw(decode);
use autodie;
The 'user.view.mapper since' message is broken. It should be done with
translation parameters. But messages can't include HTML like <b> and I
don't want to experiment with making that work or changing this into a
HTML table that doesn't look crappy.
Translatewiki doesn't support trailing whitespace in messages. So if
we want to move to it (without hacking it) we're going to have to
eliminate those.
I compiled a list of them and I'm removing trailing whitespace from
those messages where the whitespace was a no-op. Mostly cases like
"<td>foo </td><td>bar</td>" or "<p>foo \n</p>"
When displaying objects in /browse/* and in the JavaScript "Data"
feature use the name key corresponding to the user's
locale. E.g. "name:is" for Icelandic.
This will fall back on "name". The interface will be equivalent unless
the user has selected another language than English in the preferences
and objects with localized name:* tags corresponding to the user's
language are being displayed.
While we don't have the sanitizing backend to safely solve ticket
#2264 I'm going to remove the auto_link feature of changeset tags. The
links are broken in all conforming Atom readers at the moment.
There was no "Sorry not found" message for changesets so
/browse/changeset/123456789 would return the message "Sorry, the with
the id 123456789, could not be found.". It now says "Sorry, the
changeset with the id 123456789, could not be found."
Matt Amos [Tue, 25 Aug 2009 15:00:32 +0000 (15:00 +0000)]
Added referer URL in user_token so that redirections (e.g: from oauth token requests) are followed after the user has confirmed the sign-up. Added test for the same.