Tom Hughes [Fri, 2 Oct 2009 23:41:19 +0000 (23:41 +0000)]
Modify the existing i18n() javascript function to lookup strings in
the javascript i18n array as well as expanding arguments, and make all
lookups go through it.
Tom Hughes [Fri, 2 Oct 2009 23:33:17 +0000 (23:33 +0000)]
Move javascript translations to a separate key based on the path to
the javascript file that uses them and amend the layout to automatically
find and output all javascript strings.
Some of our JavaScript files have UI messages but we don't want to
make them dynamic.
So I'm creating a globally scoped JavaScript array called rails_i18n
which holds some of these messages. It's loaded in <head> before any
of the JavaScript files so it should always be available.
* Center-align donation text
* Add title="" to the donate link
* Use an official cc_button.png from http://1.1.1.1/bmi/i.creativecommons.org/l/by-sa/2.0/88x31.png that doesn't include English text
* Add rel=license to license link as suggested by CC
* Add width/height to CC button
Tom Hughes [Wed, 30 Sep 2009 23:47:26 +0000 (23:47 +0000)]
Open up crossdomain policy to allow all headers from everywhere as I can't
find any information anywhere that gives me any idea why we would want to
restrict what headers can be sent.
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
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.