From b14f137dc5613472eb68ffea2bb76abc3f7172b6 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Sun, 17 Jan 2016 10:13:54 +0100 Subject: L10N: Intern tag_cats/voiced/animated/*_status --- data/global.pl | 17 +++++---- data/lang.txt | 84 -------------------------------------------- lib/VNDB/Func.pm | 6 +--- lib/VNDB/Handler/Releases.pm | 32 ++++++++--------- lib/VNDB/Handler/Tags.pm | 10 +++--- lib/VNDB/Handler/ULists.pm | 40 ++++++++++----------- lib/VNDB/Handler/Users.pm | 3 +- lib/VNDB/Handler/VNPage.pm | 18 +++++----- lib/VNDB/Util/BrowseHTML.pm | 2 +- util/jsgen.pl | 6 ++-- 10 files changed, 68 insertions(+), 150 deletions(-) diff --git a/data/global.pl b/data/global.pl index 67254c0b..fcb7ee03 100644 --- a/data/global.pl +++ b/data/global.pl @@ -186,12 +186,17 @@ our %S; [ '1280x800', 'widescreen' ], [ '1920x1080', 'widescreen' ], ], - tag_categories => [ qw|cont ero tech| ], - voiced => [ 0..4 ], - animated => [ 0..4 ], - wishlist_status => [ 0..3 ], - rlist_status => [ 0..4 ], # 0 = hardcoded "unknown", 2 = hardcoded 'OK'. List must not have gaps - vnlist_status => [ 0..4 ], + tag_categories => { + cont => 'Content', + ero => 'Sexual content', + tech => 'Technical', + }, + # The voiced, animated, and *_status fields are stored in the database by their (numeric) index. + voiced => [ 'Unknown', 'Not voiced', 'Only ero scenes voiced', 'Partially voiced', 'Fully voiced' ], + animated => [ 'Unknown', 'No animations', 'Simple animations', 'Some fully animated scenes', 'All scenes fully animated' ], + wishlist_status => [ 'high', 'medium', 'low', 'blacklist' ], + rlist_status => [ 'Unknown', 'Pending', 'Obtained', 'On loan', 'Deleted' ], # 0 = hardcoded "unknown", 2 = hardcoded 'OK' + vnlist_status => [ 'Unknown', 'Playing', 'Finished', 'Stalled', 'Dropped' ], blood_types => [qw| unknown o a b ab |], genders => [qw| unknown m f b |], char_roles => [qw| main primary side appears |], diff --git a/data/lang.txt b/data/lang.txt index bd056f7e..306dcb21 100644 --- a/data/lang.txt +++ b/data/lang.txt @@ -119,51 +119,6 @@ en : Producers en : Users -# Wishlist statuses - -:_wish_0 -en : high - -:_wish_1 -en : medium - -:_wish_2 -en : low - -:_wish_3 -en : blacklist - - -# 'Voiced' information for releases - -:_voiced_1 -en : Not voiced - -:_voiced_2 -en : Only ero scenes voiced - -:_voiced_3 -en : Partially voiced - -:_voiced_4 -en : Fully voiced - - -# 'Animated' information for releases - -:_animated_1 -en : No animations - -:_animated_2 -en : Simple animations - -:_animated_3 -en : Some fully animated scenes - -:_animated_4 -en : All scenes fully animated - - # Rating indications :_vote_1 @@ -197,45 +152,6 @@ en : excellent en : masterpiece -# VN list statuses - -:_rlist_status_1 -en : Pending - -:_rlist_status_2 -en : Obtained - -:_rlist_status_3 -en : On loan - -:_rlist_status_4 -en : Deleted - -:_vnlist_status_1 -en : Playing - -:_vnlist_status_2 -en : Finished - -:_vnlist_status_3 -en : Stalled - -:_vnlist_status_4 -en : Dropped - - -# Tag categories - -:_tagcat_cont -en : Content - -:_tagcat_ero -en : Sexual content - -:_tagcat_tech -en : Technical - - # Blood types :_bloodt_o diff --git a/lib/VNDB/Func.pm b/lib/VNDB/Func.pm index 693d378f..936a12a6 100644 --- a/lib/VNDB/Func.pm +++ b/lib/VNDB/Func.pm @@ -12,7 +12,7 @@ our @EXPORT = (@VNDBUtil::EXPORT, qw| clearfloat cssicon tagscore mt minage fil_parse fil_serialize parenttags childtags charspoil imgpath imgurl fmtvote fmtmedia fmtvnlen json_encode json_decode script_json - mtvoiced mtani mtrlstat mtvnlstat mtbloodt + mtbloodt form_compare |); @@ -249,10 +249,6 @@ sub script_json { # mt() wrappers for data-dependent translation strings that have a special # value for 'unknown'. -sub mtvoiced { !$_[0] ? mt '_unknown' : mt '_voiced_'.$_[0]; } -sub mtani { !$_[0] ? mt '_unknown' : mt '_animated_'.$_[0]; } -sub mtrlstat { !$_[0] ? mt '_unknown' : mt '_rlist_status_'.$_[0]; } -sub mtvnlstat{ !$_[0] ? mt '_unknown' : mt '_vnlist_status_'.$_[0]; } sub mtbloodt { $_[0] eq 'unknown' ? mt '_unknown' : mt '_bloodt_'.$_[0]; } 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 => '
', split => sub { map sprintf('%s (%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 ' '; } diff --git a/lib/VNDB/Util/BrowseHTML.pm b/lib/VNDB/Util/BrowseHTML.pm index 5c4ab938..240cf20b 100644 --- a/lib/VNDB/Util/BrowseHTML.pm +++ b/lib/VNDB/Util/BrowseHTML.pm @@ -196,7 +196,7 @@ sub htmlBrowseVN { lit sprintf '%d/%d', $l->{userlist_obtained} == $l->{userlist_all} ? 'done' : 'todo', $l->{userlist_obtained}, $l->{userlist_all} if $l->{userlist_all}; end 'td'; } - td class => 'tc8', defined($l->{wstat}) ? mt "_wish_$l->{wstat}" : '' if $f->{wish}; + td class => 'tc8', defined($l->{wstat}) ? $self->{wishlist_status}[$l->{wstat}] : '' if $f->{wish}; td class => 'tc2'; $_ ne 'oth' && cssicon $_, $self->{platforms}{$_} for (sort @{$l->{c_platforms}}); diff --git a/util/jsgen.pl b/util/jsgen.pl index ba18b983..2e3b5537 100755 --- a/util/jsgen.pl +++ b/util/jsgen.pl @@ -120,7 +120,7 @@ sub resolutions { sub vars { my($lang, $l10n) = @_; my %vars = ( - rlist_status => [ map l10nstr($lang, $_?"_rlist_status_$_":'_unknown'), @{$S{rlist_status}} ], + rlist_status => $S{rlist_status}, cookie_prefix => $O{cookie_prefix}, age_ratings => [ map [ $_, l10nstr($lang, $_ == -1 ? ('_unknown') : $_ == 0 ? ('_minage_all') : ('_minage_age', $_)) ], @{$S{age_ratings}} ], languages => [ map [ $_, $S{languages}{$_} ], sort keys %{$S{languages}} ], @@ -128,8 +128,8 @@ sub vars { char_roles => [ map [ $_, l10nstr($lang, "_charrole_$_") ], @{$S{char_roles}} ], media => [ map [ $_, $S{media}{$_}[1], $S{media}{$_}[0] ], sort keys %{$S{media}} ], release_types => [ map [ $_, ucfirst $_ ], @{$S{release_types}} ], - animated => [ map [ 1*$_, l10nstr($lang, $_?"_animated_$_":'_unknown' ) ], @{$S{animated}} ], - voiced => [ map [ 1*$_, l10nstr($lang, $_?"_voiced_$_":'_unknown' ) ], @{$S{voiced}} ], + animated => [ map [ $_, $S{animated}[$_] ], 0..$#{$S{animated}} ], + voiced => [ map [ $_, $S{voiced}[$_] ], 0..$#{$S{voiced}} ], vn_lengths => [ map [ $_, $S{vn_lengths}[$_][0] ], 0..$#{$S{vn_lengths}} ], blood_types => [ map [ $_, l10nstr($lang, $_ eq 'unknown' ? '_unknown' : "_bloodt_$_") ], @{$S{blood_types}} ], genders => [ map [ $_, l10nstr($lang, "_gender_$_") ], @{$S{genders}} ], -- cgit v1.2.3