summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2010-12-14 12:45:23 +0100
committerYorhel <git@yorhel.nl>2010-12-14 12:45:23 +0100
commit51b956d259eb228e4a1b8eed2bff334840dc3101 (patch)
treedb7672db83122b3a0adcf7aa3b234d29e4fb4230
parent442779dcbba94090616c8291c307626a4bd56448 (diff)
L10N: Extracted screen resolution strings from the code
A somewhat ugly approach, but couldn't think of something better.
-rw-r--r--ChangeLog1
-rw-r--r--data/global.pl19
-rw-r--r--data/lang.txt24
-rw-r--r--lib/VNDB/Handler/Releases.pm5
-rwxr-xr-xutil/jsgen.pl9
5 files changed, 43 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index ff1ff8cb..9cd59b5b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,7 @@
- Disable "Don't update last modified field" by default for mods
- Make Multi not report posts
- Consider "senpai" and "sempai" the same in the VN search
+ - Extracted screen resolution strings from the code
- API: Allow extra whitespace after "get .." command
- API: Allow non-numbers as "clientver" for the login command
- API: Added "image_nsfw" member to "get vn"
diff --git a/data/global.pl b/data/global.pl
index 4a431bf8..95d966b5 100644
--- a/data/global.pl
+++ b/data/global.pl
@@ -82,20 +82,19 @@ our %S = (%S,
otc => 0
},
resolutions => [
- # TODO: Make translatable!
- [ 'Unknown / console / handheld', '' ],
- [ 'Non-standard', '' ],
+ [ '_scrres_unknown', '' ],
+ [ '_scrres_nonstandard', '' ],
[ '640x480', '4:3' ],
[ '800x600', '4:3' ],
[ '1024x768', '4:3' ],
[ '1600x1200', '4:3' ],
- [ '640x400', 'widescreen' ],
- [ '1024x576', 'widescreen' ],
- [ '1024x600', 'widescreen' ],
- [ '1024x640', 'widescreen' ],
- [ '1280x720', 'widescreen' ],
- [ '1280x800', 'widescreen' ],
- [ '1920x1080', 'widescreen' ],
+ [ '640x400', '_scrres_ws' ],
+ [ '1024x576', '_scrres_ws' ],
+ [ '1024x600', '_scrres_ws' ],
+ [ '1024x640', '_scrres_ws' ],
+ [ '1280x720', '_scrres_ws' ],
+ [ '1280x800', '_scrres_ws' ],
+ [ '1920x1080', '_scrres_ws' ],
],
voiced => [ 0..4 ],
animated => [ 0..4 ],
diff --git a/data/lang.txt b/data/lang.txt
index d8b7de98..4907e921 100644
--- a/data/lang.txt
+++ b/data/lang.txt
@@ -917,6 +917,30 @@ hu : fekete lista
nl :
+# screen resolutions
+
+:_scrres_unknown
+en : Unknown / console / handheld
+ru*:
+cs*:
+hu*:
+nl : Onbekend / console / handheld
+
+:_scrres_nonstandard
+en : Non-standard
+ru*:
+cs*:
+hu*:
+nl : Non-standaard
+
+:_scrres_ws
+en : widescreen
+ru*:
+cs*:
+hu*:
+nl :
+
+
# 'Voiced' information for releases
:_voiced_0
diff --git a/lib/VNDB/Handler/Releases.pm b/lib/VNDB/Handler/Releases.pm
index bf4d5133..ce5c62c2 100644
--- a/lib/VNDB/Handler/Releases.pm
+++ b/lib/VNDB/Handler/Releases.pm
@@ -160,9 +160,10 @@ sub _infotable {
}
if($r->{resolution}) {
+ my $res = $self->{resolutions}[$r->{resolution}][0];
Tr ++$i % 2 ? (class => 'odd') : ();
td mt '_relinfo_resolution';
- td $self->{resolutions}[$r->{resolution}][0];
+ td $res =~ /^_/ ? mt $res : $res;
end;
}
@@ -412,7 +413,7 @@ sub _form {
rel_format => [ mt('_redit_form_format'),
[ select => short => 'resolution', name => mt('_redit_form_resolution'), options => [
- map [ $_, @{$self->{resolutions}[$_]} ], 0..$#{$self->{resolutions}} ] ],
+ map [ $_, map /^_/?mt($_):$_, @{$self->{resolutions}[$_]} ], 0..$#{$self->{resolutions}} ] ],
[ select => short => 'voiced', name => mt('_redit_form_voiced'), options => [
map [ $_, mt '_voiced_'.$_ ], @{$self->{voiced}} ] ],
[ select => short => 'ani_story', name => mt('_redit_form_ani_story'), options => [
diff --git a/util/jsgen.pl b/util/jsgen.pl
index 5bd15c8f..4af20b27 100755
--- a/util/jsgen.pl
+++ b/util/jsgen.pl
@@ -76,18 +76,21 @@ sub l10n {
# screen resolution information, suitable for usage in filFSelect()
sub resolutions {
+ my $ln = shift;
my $res_cat = '';
my $resolutions = '';
my $comma = 0;
for my $i (0..$#{$S{resolutions}}) {
my $r = $S{resolutions}[$i];
if($res_cat ne $r->[1]) {
+ my $cat = $r->[1] =~ /^_/ ? $lang{$ln}{$r->[1]}||$lang{'en'}{$r->[1]} : $r->[1];
$resolutions .= ']' if $res_cat;
- $resolutions .= ",['$r->[1]',";
+ $resolutions .= ",['$cat',";
$res_cat = $r->[1];
$comma = 0;
}
- $resolutions .= ($comma ? ',' : '')."[$i,'$r->[0]']";
+ my $n = $r->[0] =~ /^_/ ? $lang{$ln}{$r->[0]}||$lang{'en'}{$r->[0]} : $r->[0];
+ $resolutions .= ($comma ? ',' : '')."[$i,'$n']";
$comma = 1;
}
$resolutions .= ']' if $res_cat;
@@ -98,7 +101,6 @@ sub resolutions {
sub jsgen {
l10n_load();
my $common = '';
- $common .= resolutions();
$common .= sprintf "rlst_rstat = [ %s ];\n", join ', ', map qq{"$_"}, @{$S{rlst_rstat}};
$common .= sprintf "rlst_vstat = [ %s ];\n", join ', ', map qq{"$_"}, @{$S{rlst_vstat}};
$common .= sprintf "cookie_prefix = '%s';\n", $S{cookie_prefix};
@@ -120,6 +122,7 @@ sub jsgen {
for my $l (VNDB::L10N::languages()) {
my($head, $body) = l10n($l, $js);
+ $head .= resolutions($l);
# JavaScript::Minifier::XS doesn't correctly handle perl's unicode, so manually encode
my $content = encode_utf8($head . $common . $body);
open my $NEWJS, '>', "$ROOT/static/f/js/$l.js" or die $!;