summaryrefslogtreecommitdiff
path: root/lib/VNDB/Handler
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2016-01-17 10:13:54 +0100
committerYorhel <git@yorhel.nl>2016-01-17 10:59:43 +0100
commitb14f137dc5613472eb68ffea2bb76abc3f7172b6 (patch)
tree81c90b7bb167926bfaaa091751bea8ef7e55b4ba /lib/VNDB/Handler
parentd7dfc891b9156f3c85c859fa02b18401abef6919 (diff)
L10N: Intern tag_cats/voiced/animated/*_status
Diffstat (limited to 'lib/VNDB/Handler')
-rw-r--r--lib/VNDB/Handler/Releases.pm32
-rw-r--r--lib/VNDB/Handler/Tags.pm10
-rw-r--r--lib/VNDB/Handler/ULists.pm40
-rw-r--r--lib/VNDB/Handler/Users.pm3
-rw-r--r--lib/VNDB/Handler/VNPage.pm18
5 files changed, 52 insertions, 51 deletions
diff --git a/lib/VNDB/Handler/Releases.pm b/lib/VNDB/Handler/Releases.pm
index 98e95b10..ef639ca1 100644
--- a/lib/VNDB/Handler/Releases.pm
+++ b/lib/VNDB/Handler/Releases.pm
@@ -57,9 +57,9 @@ sub page {
[ platforms => join => ', ', split => sub { map $self->{platforms}{$_}, @{$_[0]} } ],
[ media => join => ', ', split => sub { map fmtmedia($_->{medium}, $_->{qty}), @{$_[0]} } ],
[ resolution => serialize => sub { $self->{resolutions}[$_[0]][0]; } ],
- [ voiced => serialize => \&mtvoiced ],
- [ ani_story => serialize => \&mtani ],
- [ ani_ero => serialize => \&mtani ],
+ [ voiced => serialize => sub { $self->{voiced}[$_[0]] } ],
+ [ ani_story => serialize => sub { $self->{animated}[$_[0]] } ],
+ [ ani_ero => serialize => sub { $self->{animated}[$_[0]] } ],
[ producers => join => '<br />', split => sub {
map sprintf('<a href="/p%d" title="%s">%s</a> (%s)', $_->{id}, $_->{original}||$_->{name}, shorten($_->{name}, 50),
join(', ', $_->{developer} ? mt '_reldiff_developer' :(), $_->{publisher} ? mt '_reldiff_publisher' :())
@@ -166,7 +166,7 @@ sub _infotable {
if($r->{voiced}) {
Tr;
td mt '_relinfo_voiced';
- td mtvoiced $r->{voiced};
+ td $self->{voiced}[$r->{voiced}];
end;
}
@@ -174,8 +174,8 @@ sub _infotable {
Tr;
td mt '_relinfo_ani';
td join ', ',
- $r->{ani_story} ? mt('_relinfo_ani_story', mtani $r->{ani_story}):(),
- $r->{ani_ero} ? mt('_relinfo_ani_ero', mtani $r->{ani_ero} ):();
+ $r->{ani_story} ? mt('_relinfo_ani_story', $self->{animated}[$r->{ani_story}]):(),
+ $r->{ani_ero} ? mt('_relinfo_ani_ero', $self->{animated}[$r->{ani_ero}] ):();
end;
}
@@ -238,10 +238,10 @@ sub _infotable {
td;
Select id => 'listsel', name => $self->authGetCode("/r$r->{id}/list");
option value => -2,
- mt !$rl ? '_relinfo_user_notlist' : ('_relinfo_user_inlist', mtrlstat $rl->{status});
+ mt !$rl ? '_relinfo_user_notlist' : ('_relinfo_user_inlist', $self->{rlist_status}[$rl->{status}]);
optgroup label => mt '_relinfo_user_setstatus';
- option value => $_, mtrlstat $_
- for (@{$self->{rlist_status}});
+ option value => $_, $self->{rlist_status}[$_]
+ for (0..$#{$self->{rlist_status}});
end;
option value => -1, mt '_relinfo_user_del' if $rl;
end;
@@ -310,9 +310,9 @@ sub edit {
{ post => 'platforms', required => 0, default => '', multi => 1, enum => [ keys %{$self->{platforms}} ] },
{ post => 'media', required => 0, default => '' },
{ post => 'resolution',required => 0, default => 0, enum => [ 0..$#{$self->{resolutions}} ] },
- { post => 'voiced', required => 0, default => 0, enum => $self->{voiced} },
- { post => 'ani_story', required => 0, default => 0, enum => $self->{animated} },
- { post => 'ani_ero', required => 0, default => 0, enum => $self->{animated} },
+ { post => 'voiced', required => 0, default => 0, enum => [ 0..$#{$self->{voiced}} ] },
+ { post => 'ani_story', required => 0, default => 0, enum => [ 0..$#{$self->{animated}} ] },
+ { post => 'ani_ero', required => 0, default => 0, enum => [ 0..$#{$self->{animated}} ] },
{ post => 'producers', required => 0, default => '' },
{ post => 'vn', maxlength => 50000 },
{ post => 'editsum', template => 'editsum' },
@@ -404,11 +404,11 @@ sub _form {
[ select => short => 'resolution', name => mt('_redit_form_resolution'), options => [
map [ $_, @{$self->{resolutions}[$_]} ], 0..$#{$self->{resolutions}} ] ],
[ select => short => 'voiced', name => mt('_redit_form_voiced'), options => [
- map [ $_, mtvoiced $_ ], @{$self->{voiced}} ] ],
+ map [ $_, $self->{voiced}[$_] ], 0..$#{$self->{voiced}} ] ],
[ select => short => 'ani_story', name => mt('_redit_form_ani_story'), options => [
- map [ $_, mtani $_ ], @{$self->{animated}} ] ],
+ map [ $_, $self->{animated}[$_] ], 0..$#{$self->{animated}} ] ],
[ select => short => 'ani_ero', name => mt('_redit_form_ani_ero'), options => [
- map [ $_, $_ ? mtani $_ : mt('_redit_form_ani_ero_none') ], @{$self->{animated}} ] ],
+ map [ $_, $_ ? $self->{animated}[$_] : mt('_redit_form_ani_ero_none') ], 0..$#{$self->{animated}} ] ],
[ static => content => mt('_redit_form_ani_ero_note') ],
[ hidden => short => 'media' ],
[ static => nolabel => 1, content => sub {
@@ -526,7 +526,7 @@ sub browse {
td class => 'tc3';
$_ ne 'oth' && cssicon $_, $self->{platforms}{$_} for (@{$l->{platforms}});
cssicon "lang $_", $self->{languages}{$_} for (@{$l->{languages}});
- cssicon "rt$l->{type}", mt $l->{type};
+ cssicon "rt$l->{type}", $l->{type};
end;
td class => 'tc4';
a href => "/r$l->{id}", title => $l->{original}||$l->{title}, shorten $l->{title}, 90;
diff --git a/lib/VNDB/Handler/Tags.pm b/lib/VNDB/Handler/Tags.pm
index f97fe238..62a72555 100644
--- a/lib/VNDB/Handler/Tags.pm
+++ b/lib/VNDB/Handler/Tags.pm
@@ -86,7 +86,7 @@ sub tagpage {
p class => 'center';
b mt('_tagp_cat');
br;
- txt mt("_tagcat_$t->{cat}");
+ txt $self->{tag_categories}{$t->{cat}};
end;
if(@{$t->{aliases}}) {
p class => 'center';
@@ -153,7 +153,7 @@ sub tagedit {
$frm = $self->formValidate(
{ post => 'name', required => 1, maxlength => 250, regex => [ qr/^[^,]+$/, 'A comma is not allowed in tag names' ] },
{ post => 'state', required => 0, default => 0, enum => [ 0..2 ] },
- { post => 'cat', required => 1, enum => $self->{tag_categories} },
+ { post => 'cat', required => 1, enum => [ keys %{$self->{tag_categories}} ] },
{ post => 'catrec', required => 0 },
{ post => 'meta', required => 0, default => 0 },
{ post => 'alias', required => 0, maxlength => 1024, default => '', regex => [ qr/^[^,]+$/s, 'No comma allowed in aliases' ] },
@@ -235,7 +235,7 @@ sub tagedit {
[ static => content => mt '_tagedit_frm_meta_warn' ] : (),
) : (),
[ select => short => 'cat', name => mt('_tagedit_frm_cat'), options => [
- map [$_, mt "_tagcat_$_"], @{$self->{tag_categories}} ] ],
+ map [$_, $self->{tag_categories}{$_}], sort keys %{$self->{tag_categories}} ] ],
$self->authCan('tagmod') && $tag ? (
[ checkbox => short => 'catrec', name => mt '_tagedit_frm_catrec' ],
[ static => content => mt '_tagedit_frm_catrec_warn' ],
@@ -582,11 +582,11 @@ sub _tagmod_list {
my %my = map +($_->{tag} => $_), @$my;
- for my $cat (@{$self->{tag_categories}}) {
+ for my $cat (sort keys %{$self->{tag_categories}}) {
my @tags = grep $_->{cat} eq $cat, @$tags;
next if !@tags;
Tr class => 'tagmod_cat';
- td colspan => 7, mt "_tagcat_$cat";
+ td colspan => 7, $self->{tag_categories}{$cat};
end;
for my $t (@tags) {
my $m = $my{$t->{id}};
diff --git a/lib/VNDB/Handler/ULists.pm b/lib/VNDB/Handler/ULists.pm
index 888e0b8b..9a54e852 100644
--- a/lib/VNDB/Handler/ULists.pm
+++ b/lib/VNDB/Handler/ULists.pm
@@ -47,7 +47,7 @@ sub vnwish {
return if !$self->authCheckCode;
my $f = $self->formValidate(
- { get => 's', enum => [ -1, @{$self->{wishlist_status}} ] },
+ { get => 's', enum => [ -1..$#{$self->{wishlist_status}} ] },
{ get => 'ref', required => 0, default => "/v$id" }
);
return $self->resNotFound if $f->{_err};
@@ -67,7 +67,7 @@ sub vnlist_e {
return if !$self->authCheckCode;
my $f = $self->formValidate(
- { get => 'e', enum => [ -1, @{$self->{vnlist_status}} ] },
+ { get => 'e', enum => [ -1..$#{$self->{vnlist_status}} ] },
{ get => 'ref', required => 0, default => "/v$id" }
);
return $self->resNotFound if $f->{_err};
@@ -94,7 +94,7 @@ sub rlist_e {
return if !$self->authCheckCode;
my $f = $self->formValidate(
- { get => 'e', required => 1, enum => [ -1, @{$self->{rlist_status}} ] },
+ { get => 'e', required => 1, enum => [ -1..$#{$self->{rlist_status}} ] },
{ get => 'ref', required => 0, default => "/r$rid" }
);
return $self->resNotFound if $f->{_err};
@@ -230,7 +230,7 @@ sub wishlist {
{ get => 'p', required => 0, default => 1, template => 'page' },
{ get => 'o', required => 0, default => 'd', enum => [ 'a', 'd' ] },
{ get => 's', required => 0, default => 'wstat', enum => [qw|title added wstat|] },
- { get => 'f', required => 0, default => -1, enum => [ -1, @{$self->{wishlist_status}} ] },
+ { get => 'f', required => 0, default => -1, enum => [ -1..$#{$self->{wishlist_status}} ] },
);
return $self->resNotFound if $f->{_err};
@@ -238,7 +238,7 @@ sub wishlist {
return if !$self->authCheckCode;
my $frm = $self->formValidate(
{ post => 'sel', required => 0, default => 0, multi => 1, template => 'id' },
- { post => 'batchedit', required => 1, enum => [ -1, @{$self->{wishlist_status}} ] },
+ { post => 'batchedit', required => 1, enum => [ -1..$#{$self->{wishlist_status}} ] },
);
$frm->{sel} = [ grep $_, @{$frm->{sel}} ]; # weed out "select all" checkbox
if(!$frm->{_err} && @{$frm->{sel}} && $frm->{sel}[0]) {
@@ -268,8 +268,8 @@ sub wishlist {
}
p class => 'browseopts';
a $f->{f} == $_ ? (class => 'optselected') : (), href => "/u$uid/wish?f=$_",
- $_ == -1 ? mt '_wishlist_prio_all' : mt "_wish_$_"
- for (-1, @{$self->{wishlist_status}});
+ $_ == -1 ? mt '_wishlist_prio_all' : $self->{wishlist_status}[$_]
+ for (-1..$#{$self->{wishlist_status}});
end;
end 'div';
@@ -298,7 +298,7 @@ sub wishlist {
if $own;
a href => "/v$i->{vid}", title => $i->{original}||$i->{title}, ' '.shorten $i->{title}, 70;
end;
- td class => 'tc2', mt "_wish_$i->{wstat}";
+ td class => 'tc2', $self->{wishlist_status}[$i->{wstat}];
td class => 'tc3', $self->{l10n}->date($i->{added}, 'compact');
end;
},
@@ -310,8 +310,8 @@ sub wishlist {
Select name => 'batchedit', id => 'batchedit';
option mt '_wishlist_select';
optgroup label => mt '_wishlist_changeprio';
- option value => $_, mt "_wish_$_"
- for (@{$self->{wishlist_status}});
+ option value => $_, $self->{wishlist_status}[$_]
+ for (0..$#{$self->{wishlist_status}});
end;
option value => -1, mt '_wishlist_remove';
end;
@@ -337,7 +337,7 @@ sub vnlist {
{ get => 's', required => 0, default => 'title', enum => [ 'title', 'vote' ] },
{ get => 'c', required => 0, default => 'all', enum => [ 'all', 'a'..'z', 0 ] },
{ get => 'v', required => 0, default => 0, enum => [ -1..1 ] },
- { get => 't', required => 0, default => -1, enum => [ -1, @{$self->{vnlist_status}} ] },
+ { get => 't', required => 0, default => -1, enum => [ -1..$#{$self->{vnlist_status}} ] },
);
return $self->resNotFound if $f->{_err};
@@ -347,8 +347,8 @@ sub vnlist {
{ post => 'vid', required => 0, default => 0, multi => 1, template => 'id' },
{ post => 'rid', required => 0, default => 0, multi => 1, template => 'id' },
{ post => 'not', required => 0, default => '', maxlength => 2000 },
- { post => 'vns', required => 1, enum => [ -2, -1, @{$self->{vnlist_status}}, 999 ] },
- { post => 'rel', required => 1, enum => [ -2, -1, @{$self->{rlist_status}} ] },
+ { post => 'vns', required => 1, enum => [ -2..$#{$self->{vnlist_status}}, 999 ] },
+ { post => 'rel', required => 1, enum => [ -2..$#{$self->{rlist_status}} ] },
);
my @vid = grep $_ > 0, @{$frm->{vid}};
my @rid = grep $_ > 0, @{$frm->{rid}};
@@ -406,7 +406,7 @@ sub vnlist {
end;
p class => 'browseopts';
a href => $url->(t => -1), -1 == $f->{t} ? (class => 'optselected') : (), mt '_rlist_all';
- a href => $url->(t => $_), $_ == $f->{t} ? (class => 'optselected') : (), mtvnlstat $_ for @{$self->{vnlist_status}};
+ a href => $url->(t => $_), $_ == $f->{t} ? (class => 'optselected') : (), $self->{vnlist_status}[$_] for 0..$#{$self->{vnlist_status}};
end;
end 'div';
@@ -452,7 +452,7 @@ sub _vnlist_browse {
a href => "/v$i->{vid}", title => $i->{original}||$i->{title}, shorten $i->{title}, 70;
b class => 'grayedout', $i->{notes} if $i->{notes};
end;
- td class => 'tc6', $i->{status} ? mtvnlstat $i->{status} : '';
+ td class => 'tc6', $i->{status} ? $self->{vnlist_status}[$i->{status}] : '';
td class => 'tc7';
my $obtained = grep $_->{status}==2, @{$i->{rels}};
my $total = scalar @{$i->{rels}};
@@ -480,7 +480,7 @@ sub _vnlist_browse {
td class => 'tc5';
a href => "/r$_->{rid}", title => $_->{original}||$_->{title}, shorten $_->{title}, 50;
end;
- td class => 'tc6', $_->{status} ? mtrlstat $_->{status} : '';
+ td class => 'tc6', $_->{status} ? $self->{rlist_status}[$_->{status}] : '';
td class => 'tc7_8', colspan => 2, '';
end 'tr';
}
@@ -494,8 +494,8 @@ sub _vnlist_browse {
Select id => 'vns', name => 'vns';
option value => -2, mt '_rlist_withvn';
optgroup label => mt '_rlist_changestat';
- option value => $_, mtvnlstat $_
- for (@{$self->{vnlist_status}});
+ option value => $_, $self->{vnlist_status}[$_]
+ for (0..$#{$self->{vnlist_status}});
end;
option value => 999, mt '_rlist_setnote';
option value => -1, mt '_rlist_del';
@@ -503,8 +503,8 @@ sub _vnlist_browse {
Select id => 'rel', name => 'rel';
option value => -2, mt '_rlist_withrel';
optgroup label => mt '_rlist_changestat';
- option value => $_, mtrlstat $_
- for (@{$self->{rlist_status}});
+ option value => $_, $self->{rlist_status}[$_]
+ for (0..$#{$self->{rlist_status}});
end;
option value => -1, mt '_rlist_del';
end;
diff --git a/lib/VNDB/Handler/Users.pm b/lib/VNDB/Handler/Users.pm
index 0228b003..d3e6b9b3 100644
--- a/lib/VNDB/Handler/Users.pm
+++ b/lib/VNDB/Handler/Users.pm
@@ -452,7 +452,8 @@ sub edit {
[ check => short => 'show_nsfw', name => mt '_usere_fnsfw' ],
[ check => short => 'traits_sexual', name => mt '_usere_fsextraits' ],
[ check => short => 'tags_all', name => mt '_usere_ftags' ],
- [ select => short => 'tags_cat', name => mt('_usere_tagcats'), multi => 1, size => 3, options => [ map [ $_, mt '_tagcat_'.$_ ], qw|cont ero tech| ] ],
+ [ select => short => 'tags_cat', name => mt('_usere_tagcats'), multi => 1, size => 3,
+ options => [ map [ $_, $self->{tag_categories}{$_} ], sort keys %{$self->{tag_categories}} ] ],
[ select => short => 'spoilers', name => mt('_usere_spoilers'), options => [ map [ $_, mt '_spoilset_'.$_ ], 0..2 ] ],
[ select => short => 'skin', name => mt('_usere_skin'), width => 300, options => [
map [ $_, $self->{skins}{$_}[0].($self->debug?" [$_]":'') ], sort { $self->{skins}{$a}[0] cmp $self->{skins}{$b}[0] } keys %{$self->{skins}} ] ],
diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm
index 1439a007..c5635f1d 100644
--- a/lib/VNDB/Handler/VNPage.pm
+++ b/lib/VNDB/Handler/VNPage.pm
@@ -141,7 +141,7 @@ my @rel_cols = (
default => 1,
what => 'extended',
has_data => sub { !!$_[0]{voiced} },
- draw => sub { txt mtvoiced $_[0]{voiced} },
+ draw => sub { txt $TUWF::OBJ->{voiced}[$_[0]{voiced}] },
}, { # Animation
id => 'ani',
sort_field => 'ani_ero',
@@ -153,8 +153,8 @@ my @rel_cols = (
has_data => sub { !!($_[0]{ani_story} || $_[0]{ani_ero}) },
draw => sub {
txt join ', ',
- $_[0]{ani_story} ? mt('_relinfo_ani_story', mtani $_[0]{ani_story}):(),
- $_[0]{ani_ero} ? mt('_relinfo_ani_ero', mtani $_[0]{ani_ero} ):();
+ $_[0]{ani_story} ? mt('_relinfo_ani_story', $TOWF::OBJ->{animated}[$_[0]{ani_story}]):(),
+ $_[0]{ani_ero} ? mt('_relinfo_ani_ero', $TOWF::OBJ->{animated}[$_[0]{ani_ero}] ):();
txt mt '_unknown' if !$_[0]{ani_story} && !$_[0]{ani_ero};
},
}, { # Released
@@ -444,7 +444,7 @@ sub page {
div id => 'tagops';
# NOTE: order of these links is hardcoded in JS
my $tags_cat = $self->authPref('tags_cat') || $self->{default_tags_cat};
- a href => "#$_", $tags_cat =~ /\Q$_/ ? (class => 'tsel') : (), lc mt "_tagcat_$_" for qw|cont ero tech|;
+ a href => "#$_", $tags_cat =~ /\Q$_/ ? (class => 'tsel') : (), lc $self->{tag_categories}{$_} for sort keys %{$self->{tag_categories}};
my $spoiler = $self->authPref('spoilers') || 0;
a href => '#', class => 'sec'.($spoiler == 0 ? ' tsel' : ''), lc mt '_spoilset_0';
a href => '#', $spoiler == 1 ? (class => 'tsel') : (), lc mt '_spoilset_1';
@@ -690,9 +690,9 @@ sub _useroptions {
}
Select id => 'listsel', name => $self->authGetCode("/v$v->{id}/list");
- option $list ? mt '_vnpage_uopt_vnlisted', mtvnlstat $list->{status} : mt '_vnpage_uopt_novn';
+ option $list ? mt '_vnpage_uopt_vnlisted', $self->{vnlist_status}[$list->{status}] : mt '_vnpage_uopt_novn';
optgroup label => $list ? mt '_vnpage_uopt_changevn' : mt '_vnpage_uopt_addvn';
- option value => $_, mtvnlstat $_ for (@{$self->{rlist_status}});
+ option value => $_, $self->{vnlist_status}[$_] for (0..$#{$self->{vnlist_status}});
end;
option value => -1, mt '_vnpage_uopt_delvn' if $list;
end;
@@ -700,9 +700,9 @@ sub _useroptions {
if(!$vote || $wish) {
Select id => 'wishsel', name => $self->authGetCode("/v$v->{id}/wish");
- option $wish ? mt '_vnpage_uopt_wishlisted', mt '_wish_'.$wish->{wstat} : mt '_vnpage_uopt_nowish';
+ option $wish ? mt '_vnpage_uopt_wishlisted', $self->{wishlist_status}[$wish->{wstat}] : mt '_vnpage_uopt_nowish';
optgroup label => $wish ? mt '_vnpage_uopt_changewish' : mt '_vnpage_uopt_addwish';
- option value => $_, mt "_wish_$_" for (@{$self->{wishlist_status}});
+ option value => $_, $self->{wishlist_status}[$_] for (0..$#{$self->{wishlist_status}});
end;
option value => -1, mt '_vnpage_uopt_delwish' if $wish;
end;
@@ -797,7 +797,7 @@ sub _releases {
td class => 'tc5';
if($self->authInfo->{id}) {
a href => "/r$rel->{id}", id => "rlsel_$rel->{id}", class => 'vnrlsel',
- $rel->{ulist} ? mtrlstat $rel->{ulist}{status} : '--';
+ $rel->{ulist} ? $self->{rlist_status}[ $rel->{ulist}{status} ] : '--';
} else {
txt ' ';
}