summaryrefslogtreecommitdiff
path: root/util/jsgen.pl
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 /util/jsgen.pl
parent442779dcbba94090616c8291c307626a4bd56448 (diff)
L10N: Extracted screen resolution strings from the code
A somewhat ugly approach, but couldn't think of something better.
Diffstat (limited to 'util/jsgen.pl')
-rwxr-xr-xutil/jsgen.pl9
1 files changed, 6 insertions, 3 deletions
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 $!;