diff options
-rw-r--r-- | data/global.pl | 35 | ||||
-rw-r--r-- | data/js/filter.js | 12 | ||||
-rw-r--r-- | data/lang.txt | 94 | ||||
-rw-r--r-- | lib/VNDB/Func.pm | 5 | ||||
-rw-r--r-- | lib/VNDB/Handler/Chars.pm | 24 | ||||
-rw-r--r-- | lib/VNDB/Handler/Discussions.pm | 30 | ||||
-rw-r--r-- | lib/VNDB/Handler/Misc.pm | 2 | ||||
-rw-r--r-- | lib/VNDB/Handler/Staff.pm | 8 | ||||
-rw-r--r-- | lib/VNDB/Handler/VNEdit.pm | 2 | ||||
-rw-r--r-- | lib/VNDB/Handler/VNPage.pm | 16 | ||||
-rwxr-xr-x | util/jsgen.pl | 8 |
11 files changed, 76 insertions, 160 deletions
diff --git a/data/global.pl b/data/global.pl index b03d0dfb..7362ddea 100644 --- a/data/global.pl +++ b/data/global.pl @@ -81,7 +81,18 @@ our %S; in => 'Individual', ng => 'Amateur group', ), - discussion_boards => [qw|an db ge v p u|], # <- note that some properties of these boards are hard-coded + # Some discussion board properties are hardcoded, e.g.: + # - number of rows to show on /t + # - whether it needs mod access + # - whether it needs to be linked to a DB item. + discussion_boards => ordhash( + an => 'Announcements', + db => 'VNDB discussions', + ge => 'General discussions', + v => 'Visual novels', + p => 'Producers', + u => 'Users', + ), vn_lengths => [ # name time examples [ 'Unknown', '', '' ], @@ -200,21 +211,33 @@ our %S; 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 |], + blood_types => ordhash(qw{unknown Unknown o O a A b B ab AB}), + genders => ordhash(unknown => 'Unknown or N/A', qw{m Male f Female b Both}), + char_roles => ordhash( + main => 'Protagonist', + primary => 'Main character', + side => 'Side character', + appears => 'Makes an appearance' + ), atom_feeds => { # num_entries, title, id announcements => [ 10, 'VNDB Site Announcements', '/t/an' ], changes => [ 25, 'VNDB Recent Changes', '/hist' ], posts => [ 25, 'VNDB Recent Posts', '/t' ], }, - staff_roles => [qw|scenario chardesign art music songs director staff|], + staff_roles => ordhash( + scenario => 'Scenario', + chardesign => 'Character design', + art => 'Artist', + music => 'Composer', + songs => 'Vocals', + director => 'Director', + staff => 'Staff', + ), poll_options => 20, # max number of options in discussion board polls ); diff --git a/data/js/filter.js b/data/js/filter.js index 5a66f1fa..c77820ab 100644 --- a/data/js/filter.js +++ b/data/js/filter.js @@ -597,19 +597,11 @@ function filVN() { } function filStaff() { - var gend = [ - ['unknown', mt('_gender_unknown')], - ['m', mt('_gender_m')], - ['f', mt('_gender_f')], - ]; + var gend = VARS.genders.slice(0, 3); // Insert seiyuu into the list of roles, before the "staff" role. var roles = VARS.staff_roles; - for(var i=0; i<roles.length; i++) - if(roles[i][0] == 'staff') { - roles.splice(i, 0, ['seiyuu', mt('_credit_seiyuu')]); - break; - } + roles.splice(-1, 0, ['seiyuu', 'Voice actor']); return [ mt('_sbrowse_fil_title'), diff --git a/data/lang.txt b/data/lang.txt index 19f4a177..fcbee0e7 100644 --- a/data/lang.txt +++ b/data/lang.txt @@ -38,27 +38,6 @@ information. en : Unknown -# Discussion board types - -:_dboard_an -en : Announcements - -:_dboard_db -en : VNDB Discussions - -:_dboard_ge -en : General discussions - -:_dboard_v -en : Visual novels - -:_dboard_p -en : Producers - -:_dboard_u -en : Users - - # Rating indications :_vote_1 @@ -92,51 +71,6 @@ en : excellent en : masterpiece -# Blood types - -:_bloodt_o -en : O - -:_bloodt_a -en : A - -:_bloodt_b -en : B - -:_bloodt_ab -en : AB - - -# Genders - -:_gender_unknown -en : Unknown or N/A - -:_gender_m -en : Male - -:_gender_f -en : Female - -:_gender_b -en : Both - - -# Character roles - -:_charrole_main -en : [quant,_1,Protagonist,Protagonists] - -:_charrole_primary -en : Main [quant,_1,character,characters] - -:_charrole_side -en : Side [quant,_1,character,characters] - -:_charrole_appears -en : Makes an appearance - - ############################################################################# @@ -1171,34 +1105,6 @@ en : No results found ############################################################################# # Handler::Staff -# Built-in credits - -:_credit_scenario -en : Scenario - -:_credit_chardesign -en : Character design - -:_credit_music -en : Composer - -:_credit_director -en : Director - -:_credit_art -en : Artist - -:_credit_songs -en : Vocals - -:_credit_staff -en : Staff - -:_credit_seiyuu -en : Voice actor - -:_credit_other -en : Other # Staff diff fields (/s+.+) diff --git a/lib/VNDB/Func.pm b/lib/VNDB/Func.pm index 936a12a6..64f087ae 100644 --- a/lib/VNDB/Func.pm +++ b/lib/VNDB/Func.pm @@ -12,7 +12,6 @@ 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 - mtbloodt form_compare |); @@ -247,10 +246,6 @@ sub script_json { } -# mt() wrappers for data-dependent translation strings that have a special -# value for 'unknown'. -sub mtbloodt { $_[0] eq 'unknown' ? mt '_unknown' : mt '_bloodt_'.$_[0]; } - # Compare the keys in %$old with the keys in %$new. Returns 1 if a difference was found, 0 otherwise. sub form_compare { diff --git a/lib/VNDB/Handler/Chars.pm b/lib/VNDB/Handler/Chars.pm index 74029e5c..086bb9c8 100644 --- a/lib/VNDB/Handler/Chars.pm +++ b/lib/VNDB/Handler/Chars.pm @@ -39,7 +39,7 @@ sub page { [ original => diff => 1 ], [ alias => diff => qr/[ ,\n\.]/ ], [ desc => diff => qr/[ ,\n\.]/ ], - [ gender => serialize => sub { mt "_gender_$_[0]" } ], + [ gender => serialize => sub { $self->{genders}{$_[0]} } ], [ b_month => serialize => sub { $_[0]||mt '_revision_empty' } ], [ b_day => serialize => sub { $_[0]||mt '_revision_empty' } ], [ s_bust => serialize => sub { $_[0]||mt '_revision_empty' } ], @@ -47,7 +47,7 @@ sub page { [ s_hip => serialize => sub { $_[0]||mt '_revision_empty' } ], [ height => serialize => sub { $_[0]||mt '_revision_empty' } ], [ weight => serialize => sub { $_[0]||mt '_revision_empty' } ], - [ bloodt => serialize => \&mtbloodt ], + [ bloodt => serialize => sub { $self->{blood_types}{$_[0]} } ], [ main => htmlize => sub { $_[0] ? sprintf '<a href="/c%d">c%d</a>', $_[0], $_[0] : mt '_revision_empty' } ], [ main_spoil=> serialize => sub { mt "_spoil_$_[0]" } ], [ image => htmlize => sub { @@ -60,7 +60,7 @@ sub page { [ vns => join => '<br />', split => sub { map sprintf('<a href="/v%d">v%d</a> %s %s (%s)', $_->{vid}, $_->{vid}, $_->{rid}?sprintf('[<a href="/r%d">r%d</a>]', $_->{rid}, $_->{rid}):'', - mt("_charrole_$_->{role}", 1), mt("_spoil_$_->{spoil}")), @{$_[0]}; + $self->{char_roles}{$_->{role}}, mt("_spoil_$_->{spoil}")), @{$_[0]}; }], ); } @@ -130,8 +130,8 @@ sub charTable { b style => 'margin-right: 10px', $r->{name}; } b class => 'grayedout', style => 'margin-right: 10px', $r->{original} if $r->{original}; - cssicon "gen $r->{gender}", mt "_gender_$r->{gender}" if $r->{gender} ne 'unknown'; - span mtbloodt $r->{bloodt} if $r->{bloodt} ne 'unknown'; + cssicon "gen $r->{gender}", $self->{genders}{$r->{gender}} if $r->{gender} ne 'unknown'; + span $self->{blood_types}{$r->{bloodt}} if $r->{bloodt} ne 'unknown'; end; end; end; @@ -196,7 +196,7 @@ sub charTable { # special case: all releases, no exceptions if(!$vn && @r == 1 && !$r[0]{rid}) { span class => charspoil $r[0]{spoil}; - txt mt("_charrole_$r[0]{role}", 1).' - '; + txt $self->{char_roles}{$r[0]{role}}.' - '; a href => "/v$r[0]{vid}/chars", $r[0]{vntitle}; end; next; @@ -210,7 +210,7 @@ sub charTable { span class => charspoil $_->{spoil}; br if !$vn || $_ != $r[0]; b class => 'grayedout', '> '; - txt mt("_charrole_$_->{role}", 1).' - '; + txt $self->{char_roles}{$_->{role}}.' - '; if($_->{rid}) { b class => 'grayedout', "r$_->{rid}:"; a href => "/r$_->{rid}", $_->{rtitle}; @@ -290,7 +290,7 @@ sub edit { { post => 'original', required => 0, maxlength => 200, default => '' }, { post => 'alias', required => 0, maxlength => 500, default => '' }, { post => 'desc', required => 0, maxlength => 5000, default => '' }, - { post => 'gender', required => 0, default => 'unknown', enum => $self->{genders} }, + { post => 'gender', required => 0, default => 'unknown', enum => [ keys %{$self->{genders}} ] }, { post => 'image', required => 0, default => 0, template => 'id' }, { post => 'bday', required => 0, default => '', regex => [ qr/^\d{2}-\d{2}$/, mt('_chare_form_bday_err') ] }, { post => 's_bust', required => 0, default => 0, template => 'uint', max => 32767 }, @@ -298,7 +298,7 @@ sub edit { { post => 's_hip', required => 0, default => 0, template => 'uint', max => 32767 }, { post => 'height', required => 0, default => 0, template => 'uint', max => 32767 }, { post => 'weight', required => 0, default => 0, template => 'uint', max => 32767 }, - { post => 'bloodt', required => 0, default => 'unknown', enum => $self->{blood_types} }, + { post => 'bloodt', required => 0, default => 'unknown', enum => [ keys %{$self->{blood_types}} ] }, { post => 'main', required => 0, default => 0, template => 'id' }, { post => 'main_spoil', required => 0, default => 0, enum => [ 0..2 ] }, { post => 'traits', required => 0, default => '', regex => [ qr/^(?:[1-9]\d*-[0-2])(?: +[1-9]\d*-[0-2])*$/, 'Incorrect trait format.' ] }, @@ -370,7 +370,7 @@ sub edit { [ static => content => mt('_chare_form_alias_note') ], [ text => name => mt('_chare_form_desc').'<br /><b class="standout">'.mt('_inenglish').'</b>', short => 'desc', rows => 6 ], [ select => name => mt('_chare_form_gender'),short => 'gender', options => [ - map [ $_, mt("_gender_$_") ], @{$self->{genders}} ] ], + map [ $_, $self->{genders}{$_} ], keys %{$self->{genders}} ] ], [ input => name => mt('_chare_form_bday'), short => 'bday', width => 100, post => ' '.mt('_chare_form_bday_fmt') ], [ input => name => mt('_chare_form_bust'), short => 's_bust', width => 50, post => ' cm' ], [ input => name => mt('_chare_form_waist'), short => 's_waist',width => 50, post => ' cm' ], @@ -378,7 +378,7 @@ sub edit { [ input => name => mt('_chare_form_height'),short => 'height', width => 50, post => ' cm' ], [ input => name => mt('_chare_form_weight'),short => 'weight', width => 50, post => ' kg' ], [ select => name => mt('_chare_form_bloodt'),short => 'bloodt', options => [ - map [ $_, mtbloodt $_ ], @{$self->{blood_types}} ] ], + map [ $_, $self->{blood_types}{$_} ], keys %{$self->{blood_types}} ] ], [ static => content => '<br />' ], [ input => name => mt('_chare_form_main'), short => 'main', width => 50, post => ' '.mt('_chare_form_main_note') ], [ select => name => mt('_chare_form_main_spoil'), short => 'main_spoil', options => [ @@ -546,7 +546,7 @@ sub charBrowseTable { my($s, $n, $l) = @_; Tr; td class => 'tc1'; - cssicon "gen $l->{gender}", mt "_gender_$l->{gender}" if $l->{gender} ne 'unknown'; + cssicon "gen $l->{gender}", mt $self->{genders}{$l->{gender}} if $l->{gender} ne 'unknown'; end; td class => 'tc2'; a href => "/c$l->{id}", title => $l->{original}||$l->{name}, shorten $l->{name}, 50; diff --git a/lib/VNDB/Handler/Discussions.pm b/lib/VNDB/Handler/Discussions.pm index 8c18a92c..b95bab92 100644 --- a/lib/VNDB/Handler/Discussions.pm +++ b/lib/VNDB/Handler/Discussions.pm @@ -46,7 +46,7 @@ sub thread { ul; for (sort { $a->{type}.$a->{iid} cmp $b->{type}.$b->{iid} } @{$t->{boards}}) { li; - a href => "/t/$_->{type}", mt "_dboard_$_->{type}"; + a href => "/t/$_->{type}", $self->{discussion_boards}{$_->{type}}; if($_->{iid}) { txt ' > '; a style => 'font-weight: bold', href => "/t/$_->{type}$_->{iid}", "$_->{type}$_->{iid}"; @@ -208,7 +208,7 @@ sub edit { my($ty, $id) = ($1, $2) if /^([a-z]{1,2})([0-9]*)$/; push @boards, [ $ty, $id ]; push @{$frm->{_err}}, [ 'boards', 'wrongboard', $_ ] if - !$ty || !grep($_ eq $ty, @{$self->{discussion_boards}}) + !$ty || !$self->{discussion_boards}{$ty} || $ty eq 'an' && ($id || !$self->authCan('boardmod')) || $ty eq 'db' && $id || $ty eq 'ge' && $id @@ -380,7 +380,7 @@ sub board { $self->dbVNGet(id => $iid)->[0]; return $self->resNotFound if $iid && !$obj; my $ititle = $obj && ($obj->{title}||$obj->{name}||$obj->{username}); - my $title = !$obj ? mt($type eq 'all' ? '_disboard_item_all' : "_dboard_$type") : mt '_disboard_item_title', $ititle; + my $title = !$obj ? $self->{discussion_boards}{$type} || 'All boards' : mt '_disboard_item_title', $ititle; my($list, $np) = $self->dbThreadGet( $type ne 'all' ? (type => $type) : (), @@ -400,7 +400,7 @@ sub board { p; a href => '/t', mt '_disboard_rootlink'; txt ' > '; - a href => "/t/$type", mt $type eq 'all' ? '_disboard_item_all' : "_dboard_$type"; + a href => "/t/$type", $self->{discussion_boards}{$type}||'All boards'; if($iid) { txt ' > '; a style => 'font-weight: bold', href => "/t/$type$iid", "$type$iid"; @@ -445,14 +445,14 @@ sub index { input type => 'submit', class => 'submit', value => mt '_searchbox_submit'; end 'fieldset'; p class => 'browseopts'; - a href => '/t/all', mt '_disboard_item_all'; - a href => '/t/'.$_, mt "_dboard_$_" - for (@{$self->{discussion_boards}}); + a href => '/t/all', 'All boards'; + a href => '/t/'.$_, $self->{discussion_boards}{$_} + for (keys %{$self->{discussion_boards}}); end; end; end; - for (@{$self->{discussion_boards}}) { + for (keys %{$self->{discussion_boards}}) { my $list = $self->dbThreadGet( type => $_, results => /^(db|v|ge)$/ ? 10 : 5, @@ -461,7 +461,7 @@ sub index { sort => 'lastpost', reverse => 1, ); h1 class => 'boxtitle'; - a href => "/t/$_", mt "_dboard_$_"; + a href => "/t/$_", $self->{discussion_boards}{$_}; end; _threadlist($self, $list, {p=>1}, 0, "/t", $_); } @@ -475,7 +475,7 @@ sub search { my $frm = $self->formValidate( { get => 'bq', required => 0, maxlength => 100 }, - { get => 'b', required => 0, multi => 1, enum => $self->{discussion_boards} }, + { get => 'b', required => 0, multi => 1, enum => [ keys %{$self->{discussion_boards}} ] }, { get => 't', required => 0 }, { get => 'p', required => 0, default => 1, template => 'page' }, ); @@ -485,8 +485,8 @@ sub search { $self->htmlForm({ frm => $frm, action => '/t/search', method => 'get', nosubmit => 1, noformcode => 1 }, 'boardsearch' => [mt('_dissearch_title'), [ input => short => 'bq', name => mt('_dissearch_query') ], [ check => short => 't', name => mt('_dissearch_titleonly') ], - [ select => short => 'b', name => mt('_dissearch_boards'), multi => 1, size => scalar @{$self->{discussion_boards}}, - options => [ map [$_,mt("_dboard_$_")], @{$self->{discussion_boards}} ] ], + [ select => short => 'b', name => mt('_dissearch_boards'), multi => 1, size => scalar keys %{$self->{discussion_boards}}, + options => [ map [$_,$self->{discussion_boards}{$_}], keys %{$self->{discussion_boards}} ] ], [ static => content => sub { input type => 'submit', class => 'submit', tabindex => 10, value => mt '_searchbox_submit'; } ], @@ -494,7 +494,7 @@ sub search { return $self->htmlFooter if !$frm->{bq}; my %boards = map +($_,1), @{$frm->{b}}; - %boards = () if keys %boards == @{$self->{discussion_boards}}; + %boards = () if keys %boards == keys %{$self->{discussion_boards}}; my($l, $np); if($frm->{t}) { @@ -610,8 +610,8 @@ sub _threadlist { last if $i++ > 4; txt ', ' if $i > 2; a href => "/t/$_->{type}".($_->{iid}||''), - title => $_->{original}||mt("_dboard_$_->{type}"), - shorten $_->{title}||mt("_dboard_$_->{type}"), 30; + title => $_->{original}||$self->{discussion_boards}{$_->{type}}, + shorten $_->{title}||$self->{discussion_boards}{$_->{type}}, 30; } txt ', ...' if @boards > 4; end; diff --git a/lib/VNDB/Handler/Misc.pm b/lib/VNDB/Handler/Misc.pm index e36c0254..95bfe155 100644 --- a/lib/VNDB/Handler/Misc.pm +++ b/lib/VNDB/Handler/Misc.pm @@ -109,7 +109,7 @@ sub homepage { my $posts = $self->dbThreadGet(what => 'lastpost boardtitles', results => 10, sort => 'lastpost', reverse => 1, notusers => 1); ul; for (@$posts) { - my $boards = join ', ', map mt("_dboard_$_->{type}").($_->{iid}?' > '.$_->{title}:''), @{$_->{boards}}; + my $boards = join ', ', map $self->{discussion_boards}{$_->{type}}.($_->{iid}?' > '.$_->{title}:''), @{$_->{boards}}; li; lit mt '_home_recentposts_item', $_->{ldate}, sprintf('<a href="%s" title="%s">%s</a>', "/t$_->{id}.$_->{count}", diff --git a/lib/VNDB/Handler/Staff.pm b/lib/VNDB/Handler/Staff.pm index 178d80cb..a6d59cbf 100644 --- a/lib/VNDB/Handler/Staff.pm +++ b/lib/VNDB/Handler/Staff.pm @@ -36,7 +36,7 @@ sub page { $self->htmlRevision('s', $prev, $s, [ name => diff => 1 ], [ original => diff => 1 ], - [ gender => serialize => sub { mt "_gender_$_[0]" } ], + [ gender => serialize => sub { $self->{genders}{$_[0]} } ], [ lang => serialize => sub { "$_[0] ($self->{languages}{$_[0]})" } ], [ l_site => diff => 1 ], [ l_wp => htmlize => sub { @@ -63,7 +63,7 @@ sub page { td colspan => 2; b style => 'margin-right: 10px', $s->{name}; b class => 'grayedout', style => 'margin-right: 10px', $s->{original} if $s->{original}; - cssicon "gen $s->{gender}", mt "_gender_$s->{gender}" if $s->{gender} ne 'unknown'; + cssicon "gen $s->{gender}", $self->{genders}{$s->{gender}} if $s->{gender} ne 'unknown'; end; end; end; @@ -139,7 +139,7 @@ sub _roles { Tr; td class => 'tc1'; a href => "/v$l->{vid}", title => $l->{t_original}||$l->{title}, shorten $l->{title}, 60; end; td class => 'tc2'; lit $self->{l10n}->datestr($l->{c_released}); end; - td class => 'tc3', mt '_credit_'.$l->{role}; + td class => 'tc3', $self->{staff_roles}{$l->{role}}; td class => 'tc4', title => $l->{original}||$l->{name}, $l->{name}; td class => 'tc5', $l->{note}; end; @@ -275,7 +275,7 @@ sub edit { [ static => content => '<br />' ], [ text => name => mt('_staffe_form_note').'<br /><b class="standout">'.mt('_inenglish').'</b>', short => 'desc', rows => 4 ], [ select => name => mt('_staffe_form_gender'),short => 'gender', options => [ - map [ $_, mt("_gender_$_") ], qw(unknown m f) ] ], + map [ $_, $self->{genders}{$_} ], qw(unknown m f) ] ], [ select => name => mt('_staffe_form_lang'), short => 'lang', options => [ map [ $_, "$_ ($self->{languages}{$_})" ], keys %{$self->{languages}} ] ], [ input => name => mt('_staffe_form_site'), short => 'l_site' ], diff --git a/lib/VNDB/Handler/VNEdit.pm b/lib/VNDB/Handler/VNEdit.pm index b906eafa..870f9fb8 100644 --- a/lib/VNDB/Handler/VNEdit.pm +++ b/lib/VNDB/Handler/VNEdit.pm @@ -122,7 +122,7 @@ sub edit { { post => 'img_nsfw', required => 0, default => 0 }, { post => 'credits', required => 0, template => 'json', json_unique => ['aid','role'], json_sort => ['aid','role'], json_fields => [ { field => 'aid', required => 1, template => 'id' }, - { field => 'role', required => 1, enum => $self->{staff_roles} }, + { field => 'role', required => 1, enum => [ keys %{$self->{staff_roles}} ] }, { field => 'note', required => 0, maxlength => 250, default => '' }, ]}, { post => 'seiyuu', required => 0, template => 'json', json_unique => ['aid','cid'], json_sort => ['aid','cid'], json_fields => [ diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm index 82a0599e..055e2831 100644 --- a/lib/VNDB/Handler/VNPage.pm +++ b/lib/VNDB/Handler/VNPage.pm @@ -516,7 +516,7 @@ sub _revision { }], [ credits => join => '<br />', split => sub { my @r = map sprintf('<a href="/s%d" title="%s">%s</a> [%s]%s', $_->{id}, - xml_escape($_->{original}||$_->{name}), xml_escape($_->{name}), mt("_credit_$_->{role}"), + xml_escape($_->{original}||$_->{name}), xml_escape($_->{name}), xml_escape($self->{staff_roles}{$_->{role}}), $_->{note} ? ' ['.xml_escape($_->{note}).']' : ''), sort { $a->{id} <=> $b->{id} || $a->{role} cmp $b->{role} } @{$_[0]}; return @r ? @r : (mt '_revision_empty'); @@ -886,15 +886,15 @@ sub _chars { return if !@$l; my %done; my %rol; - for my $r (@{$self->{char_roles}}) { + for my $r (keys %{$self->{char_roles}}) { $rol{$r} = [ grep grep($_->{role} eq $r, @{$_->{vns}}) && !$done{$_->{id}}++, @$l ]; } my $first = 0; - for my $r (@{$self->{char_roles}}) { + for my $r (keys %{$self->{char_roles}}) { next if !@{$rol{$r}}; div class => 'mainbox'; $self->charOps(1) if !$first++; - h1 mt "_charrole_$r", scalar @{$rol{$r}}; + h1 $self->{char_roles}{$r}; $self->charTable($_, 1, $_ != $rol{$r}[0], 1, _charspoillvl $v->{id}, $_) for (@{$rol{$r}}); end; } @@ -906,7 +906,7 @@ sub _charsum { return if !@$l; my(@l, %done, $has_spoilers); - for my $r (@{$self->{char_roles}}) { + for my $r (keys %{$self->{char_roles}}) { last if $r eq 'appears'; for (grep grep($_->{role} eq $r, @{$_->{vns}}) && !$done{$_->{id}}++, @$l) { $_->{role} = $r; @@ -922,7 +922,7 @@ sub _charsum { for my $c (@l) { div class => 'charsum_bubble'.($has_spoilers ? ' '.charspoil(_charspoillvl $v->{id}, $c) : ''); div class => 'name'; - i mt '_charrole_'.$c->{role}, 1; + i $self->{char_roles}{$c->{role}}; a href => "/c$c->{id}", title => $c->{original}||$c->{name}, $c->{name}; end; if(@{$c->{seiyuu}}) { @@ -949,11 +949,11 @@ sub _staff { div class => 'mainbox staff summarize', 'data-summarize-height' => 100, id => 'staff'; h1 mt '_vnpage_staff'; - for my $r (@{$self->{staff_roles}}) { + for my $r (keys %{$self->{staff_roles}}) { my @s = grep $_->{role} eq $r, @{$v->{credits}}; next if !@s; ul; - li; b mt '_credit_'.$r; end; + li; b $self->{staff_roles}{$r}; end; for(@s) { li; a href => "/s$_->{id}", title => $_->{original}||$_->{name}, $_->{name}; diff --git a/util/jsgen.pl b/util/jsgen.pl index 412cec0e..aad133a1 100755 --- a/util/jsgen.pl +++ b/util/jsgen.pl @@ -125,15 +125,15 @@ sub vars { age_ratings => [ map [ $_, l10nstr($lang, $_ == -1 ? ('_unknown') : $_ == 0 ? ('_minage_all') : ('_minage_age', $_)) ], @{$S{age_ratings}} ], languages => [ map [ $_, $S{languages}{$_} ], keys %{$S{languages}} ], platforms => [ map [ $_, $S{platforms}{$_} ], keys %{$S{platforms}} ], - char_roles => [ map [ $_, l10nstr($lang, "_charrole_$_") ], @{$S{char_roles}} ], + char_roles => [ map [ $_, $S{char_roles}{$_} ], keys %{$S{char_roles}} ], media => [ map [ $_, $S{media}{$_}[1], $S{media}{$_}[0] ], keys %{$S{media}} ], release_types => [ map [ $_, ucfirst $_ ], @{$S{release_types}} ], 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}} ], - staff_roles => [ map [ $_, l10nstr($lang, "_credit_$_") ], @{$S{staff_roles}} ], + blood_types => [ map [ $_, $S{blood_types}{$_} ], keys %{$S{blood_types}} ], + genders => [ map [ $_, $S{genders}{$_} ], keys %{$S{genders}} ], + staff_roles => [ map [ $_, $S{staff_roles}{$_} ], keys %{$S{staff_roles}} ], resolutions => scalar resolutions(), l10n_str => $l10n, ); |