summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2016-01-19 20:29:40 +0100
committerYorhel <git@yorhel.nl>2016-01-20 21:16:55 +0100
commita6836df277867d73a71c55797984c947449772cc (patch)
treec72a326dd844c3c23a932dc76dc159200c1dfcdb /lib
parent0caed2e7674e8ee7419365e76f86d06c33b8c8aa (diff)
L10N: Intern all VNDB::Util::* stuff
With some related edits in other parts of the code, mostly due to interface changes to htmlRevision() and htmlFormError(). Trivial replacements were automated by a super awesome script.
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/Func.pm16
-rw-r--r--lib/VNDB/Handler/Chars.pm50
-rw-r--r--lib/VNDB/Handler/Discussions.pm6
-rw-r--r--lib/VNDB/Handler/Producers.pm18
-rw-r--r--lib/VNDB/Handler/Releases.pm44
-rw-r--r--lib/VNDB/Handler/Staff.pm23
-rw-r--r--lib/VNDB/Handler/Tags.pm9
-rw-r--r--lib/VNDB/Handler/Traits.pm11
-rw-r--r--lib/VNDB/Handler/Users.pm22
-rw-r--r--lib/VNDB/Handler/VNEdit.pm8
-rw-r--r--lib/VNDB/Handler/VNPage.pm30
-rw-r--r--lib/VNDB/Util/Auth.pm10
-rw-r--r--lib/VNDB/Util/BrowseHTML.pm26
-rw-r--r--lib/VNDB/Util/CommonHTML.pm157
-rw-r--r--lib/VNDB/Util/FormHTML.pm64
-rw-r--r--lib/VNDB/Util/LayoutHTML.pm84
16 files changed, 309 insertions, 269 deletions
diff --git a/lib/VNDB/Func.pm b/lib/VNDB/Func.pm
index 42d1b7f2..7549207f 100644
--- a/lib/VNDB/Func.pm
+++ b/lib/VNDB/Func.pm
@@ -11,7 +11,7 @@ use VNDBUtil;
our @EXPORT = (@VNDBUtil::EXPORT, qw|
clearfloat cssicon tagscore mt minage fil_parse fil_serialize parenttags
childtags charspoil imgpath imgurl
- fmtvote fmtmedia fmtvnlen fmtage fmtdatestr fmtdate fmtuser
+ fmtvote fmtmedia fmtvnlen fmtage fmtdatestr fmtdate fmtuser fmtrating
json_encode json_decode script_json
form_compare
|);
@@ -273,6 +273,20 @@ sub fmtuser {
return !$id ? '[deleted]' : sprintf '<a href="/u%d">%s</a>', $id, xml_escape $n;
}
+# Turn a (natural number) vote into a rating indication
+sub fmtrating {
+ ['worst ever',
+ 'awful',
+ 'bad',
+ 'weak',
+ 'so-so',
+ 'decent',
+ 'good',
+ 'very good',
+ 'excellent',
+ 'masterpiece']->[shift()-1];
+}
+
# JSON::XS::encode_json converts input to utf8, whereas the below functions
diff --git a/lib/VNDB/Handler/Chars.pm b/lib/VNDB/Handler/Chars.pm
index 087e44cf..e11588b4 100644
--- a/lib/VNDB/Handler/Chars.pm
+++ b/lib/VNDB/Handler/Chars.pm
@@ -35,29 +35,29 @@ sub page {
if($rev) {
my $prev = $rev && $rev > 1 && $self->dbCharGetRev(id => $id, rev => $rev-1, what => 'extended traits vns')->[0];
$self->htmlRevision('c', $prev, $r,
- [ name => diff => 1 ],
- [ original => diff => 1 ],
- [ alias => diff => qr/[ ,\n\.]/ ],
- [ desc => diff => qr/[ ,\n\.]/ ],
- [ 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' } ],
- [ s_waist => serialize => sub { $_[0]||mt '_revision_empty' } ],
- [ s_hip => serialize => sub { $_[0]||mt '_revision_empty' } ],
- [ height => serialize => sub { $_[0]||mt '_revision_empty' } ],
- [ weight => serialize => sub { $_[0]||mt '_revision_empty' } ],
- [ 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 {
+ [ name => 'Name', diff => 1 ],
+ [ original => 'Original name', diff => 1 ],
+ [ alias => 'Aliases', diff => qr/[ ,\n\.]/ ],
+ [ desc => 'Description', diff => qr/[ ,\n\.]/ ],
+ [ gender => 'Gender', serialize => sub { $self->{genders}{$_[0]} } ],
+ [ b_month => 'Birthday/month',serialize => sub { $_[0]||mt '_revision_empty' } ],
+ [ b_day => 'Birthday/day', serialize => sub { $_[0]||mt '_revision_empty' } ],
+ [ s_bust => 'Bust', serialize => sub { $_[0]||mt '_revision_empty' } ],
+ [ s_waist => 'Waist', serialize => sub { $_[0]||mt '_revision_empty' } ],
+ [ s_hip => 'Hip', serialize => sub { $_[0]||mt '_revision_empty' } ],
+ [ height => 'Height', serialize => sub { $_[0]||mt '_revision_empty' } ],
+ [ weight => 'Weight', serialize => sub { $_[0]||mt '_revision_empty' } ],
+ [ bloodt => 'Blood type', serialize => sub { $self->{blood_types}{$_[0]} } ],
+ [ main => 'Main character',htmlize => sub { $_[0] ? sprintf '<a href="/c%d">c%d</a>', $_[0], $_[0] : mt '_revision_empty' } ],
+ [ main_spoil=> 'Spoiler', serialize => sub { mt "_spoil_$_[0]" } ],
+ [ image => 'Image', htmlize => sub {
return $_[0] ? sprintf '<img src="%s" />', imgurl(ch => $_[0]) : mt '_chdiff_image_none';
}],
- [ traits => join => '<br />', split => sub {
+ [ traits => 'Traits', join => '<br />', split => sub {
map sprintf('%s<a href="/i%d">%s</a> (%s)', $_->{group}?qq|<b class="grayedout">$_->{groupname} / </b> |:'',
$_->{tid}, $_->{name}, mt("_spoil_$_->{spoil}")), @{$_[0]}
}],
- [ vns => join => '<br />', split => sub {
+ [ vns => 'Visual novels', 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}):'',
$self->{char_roles}{$_->{role}}, mt("_spoil_$_->{spoil}")), @{$_[0]};
@@ -314,8 +314,10 @@ sub edit {
# validate main character
if(!$frm->{_err} && $frm->{main}) {
my $m = $self->dbCharGet(id => $frm->{main}, what => 'extended')->[0];
- push @{$frm->{_err}}, 'mainchar' if !$m || $m->{main} || $r && !$copy &&
- ($m->{id} == $r->{id} || $self->dbCharGet(instance => $r->{id})->[0]);
+ push @{$frm->{_err}}, 'Invalid main character. Make sure the ID is correct,'
+ .' that the main character itself is not an instance of an other character,'
+ .' and that this entry is not used as a main character elsewhere.'
+ if !$m || $m->{main} || $r && !$copy && ($m->{id} == $r->{id} || $self->dbCharGet(instance => $r->{id})->[0]);
}
my(@traits, @vns);
@@ -333,7 +335,7 @@ sub edit {
# check for changes
my $same = $id && !grep $frm->{$_} ne $b4{$_}, keys %b4;
return $self->resRedirect("/c$id", 'post') if !$copy && $same;
- $frm->{_err} = ['nochanges'] if $copy && $same;
+ $frm->{_err} = ["No changes, please don't create an entry that is fully identical to another"] if $copy && $same;
}
if(!$frm->{_err}) {
@@ -441,14 +443,14 @@ sub _uploadimage {
if($frm->{_err} || !$self->reqPost('img')) {
return 0 if !$frm->{image};
- push @{$frm->{_err}}, 'invalidimgid' if !-s imgpath(ch => $frm->{image});
+ push @{$frm->{_err}}, 'No image with that ID' if !-s imgpath(ch => $frm->{image});
return $frm->{image};
}
# perform some elementary checks
my $imgdata = $self->reqUploadRaw('img');
- $frm->{_err} = [ 'noimage' ] if $imgdata !~ /^(\xff\xd8|\x89\x50)/; # JPG or PNG headers
- $frm->{_err} = [ 'toolarge' ] if length($imgdata) > 1024*1024;
+ $frm->{_err} = [ 'Image must be in JPEG or PNG format' ] if $imgdata !~ /^(\xff\xd8|\x89\x50)/; # JPG or PNG headers
+ $frm->{_err} = [ 'Image is too large, only 1MB allowed' ] if length($imgdata) > 1024*1024;
return undef if $frm->{_err};
# resize/compress
diff --git a/lib/VNDB/Handler/Discussions.pm b/lib/VNDB/Handler/Discussions.pm
index c2dea192..fe96374a 100644
--- a/lib/VNDB/Handler/Discussions.pm
+++ b/lib/VNDB/Handler/Discussions.pm
@@ -193,11 +193,11 @@ sub edit {
$frm->{_err} = 1 if $frm->{fullreply};
# check for double-posting
- push @{$frm->{_err}}, 'doublepost' if !$num && !$frm->{_err} && $self->dbPostGet(
+ push @{$frm->{_err}}, 'Please wait 30 seconds before making another post' if !$num && !$frm->{_err} && $self->dbPostGet(
uid => $self->authInfo->{id}, tid => $tid, mindate => time - 30, results => 1, $tid ? () : (num => 1))->[0]{num};
# Don't allow regular users to create more than 10 threads a day
- push @{$frm->{_err}}, 'threadthrottle' if
+ push @{$frm->{_err}}, 'You can only create 5 threads every 24 hours' if
!$tid && !$self->authCan('boardmod') &&
@{$self->dbPostGet(uid => $self->authInfo->{id}, mindate => time - 24*3600, num => 1)} >= 5;
@@ -207,7 +207,7 @@ sub edit {
for (split /[ ,]/, $frm->{boards}) {
my($ty, $id) = ($1, $2) if /^([a-z]{1,2})([0-9]*)$/;
push @boards, [ $ty, $id ];
- push @{$frm->{_err}}, [ 'boards', 'wrongboard', $_ ] if
+ push @{$frm->{_err}}, "Wrong board: $_" if
!$ty || !$self->{discussion_boards}{$ty}
|| $ty eq 'an' && ($id || !$self->authCan('boardmod'))
|| $ty eq 'db' && $id
diff --git a/lib/VNDB/Handler/Producers.pm b/lib/VNDB/Handler/Producers.pm
index a8bf371f..4d8c985d 100644
--- a/lib/VNDB/Handler/Producers.pm
+++ b/lib/VNDB/Handler/Producers.pm
@@ -56,17 +56,17 @@ sub page {
if($rev) {
my $prev = $rev && $rev > 1 && $self->dbProducerGetRev(id => $pid, rev => $rev-1, what => 'extended relations')->[0];
$self->htmlRevision('p', $prev, $p,
- [ type => serialize => sub { $self->{producer_types}{$_[0]} } ],
- [ name => diff => 1 ],
- [ original => diff => 1 ],
- [ alias => diff => qr/[ ,\n\.]/ ],
- [ lang => serialize => sub { "$_[0] ($self->{languages}{$_[0]})" } ],
- [ website => diff => 1 ],
- [ l_wp => htmlize => sub {
+ [ type => 'Type', serialize => sub { $self->{producer_types}{$_[0]} } ],
+ [ name => 'Name (romaji)', diff => 1 ],
+ [ original => 'Original name', diff => 1 ],
+ [ alias => 'Aliases', diff => qr/[ ,\n\.]/ ],
+ [ lang => 'Language', serialize => sub { "$_[0] ($self->{languages}{$_[0]})" } ],
+ [ website => 'Website', diff => 1 ],
+ [ l_wp => 'Wikipedia link',htmlize => sub {
$_[0] ? sprintf '<a href="http://en.wikipedia.org/wiki/%s">%1$s</a>', xml_escape $_[0] : mt '_revision_nolink'
}],
- [ desc => diff => qr/[ ,\n\.]/ ],
- [ relations => join => '<br />', split => sub {
+ [ desc => 'Description', diff => qr/[ ,\n\.]/ ],
+ [ relations => 'Relations', join => '<br />', split => sub {
my @r = map sprintf('%s: <a href="/p%d" title="%s">%s</a>',
$self->{prod_relations}{$_->{relation}}[1], $_->{id}, xml_escape($_->{original}||$_->{name}), xml_escape shorten $_->{name}, 40
), sort { $a->{id} <=> $b->{id} } @{$_[0]};
diff --git a/lib/VNDB/Handler/Releases.pm b/lib/VNDB/Handler/Releases.pm
index 531c878e..436ace91 100644
--- a/lib/VNDB/Handler/Releases.pm
+++ b/lib/VNDB/Handler/Releases.pm
@@ -38,29 +38,29 @@ sub page {
what => 'vn extended producers platforms media changes'
)->[0];
$self->htmlRevision('r', $prev, $r,
- [ vn => join => '<br />', split => sub {
+ [ vn => 'Relations', join => '<br />', split => sub {
map sprintf('<a href="/v%d" title="%s">%s</a>', $_->{vid}, $_->{original}||$_->{title}, shorten $_->{title}, 50), @{$_[0]};
} ],
- [ 'type' ],
- [ patch => serialize => sub { mt $_[0] ? '_revision_yes' : '_revision_no' } ],
- [ freeware => serialize => sub { mt $_[0] ? '_revision_yes' : '_revision_no' } ],
- [ doujin => serialize => sub { mt $_[0] ? '_revision_yes' : '_revision_no' } ],
- [ title => diff => 1 ],
- [ original => diff => 1 ],
- [ gtin => serialize => sub { $_[0]||mt '_revision_empty' } ],
- [ catalog => serialize => sub { $_[0]||mt '_revision_empty' } ],
- [ languages => join => ', ', split => sub { map $self->{languages}{$_}, @{$_[0]} } ],
- [ 'website' ],
- [ released => htmlize => \&fmtdatestr ],
- [ minage => serialize => \&minage ],
- [ notes => diff => qr/[ ,\n\.]/ ],
- [ 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 => sub { $self->{voiced}[$_[0]] } ],
- [ ani_story => serialize => sub { $self->{animated}[$_[0]] } ],
- [ ani_ero => serialize => sub { $self->{animated}[$_[0]] } ],
- [ producers => join => '<br />', split => sub {
+ [ type => 'Type' ],
+ [ patch => 'Patch', serialize => sub { mt $_[0] ? '_revision_yes' : '_revision_no' } ],
+ [ freeware => 'Freeware', serialize => sub { mt $_[0] ? '_revision_yes' : '_revision_no' } ],
+ [ doujin => 'Doujin', serialize => sub { mt $_[0] ? '_revision_yes' : '_revision_no' } ],
+ [ title => 'Title (romaji)', diff => 1 ],
+ [ original => 'Original title', diff => 1 ],
+ [ gtin => 'JAN/UPC/EAN', serialize => sub { $_[0]||mt '_revision_empty' } ],
+ [ catalog => 'Catalog number', serialize => sub { $_[0]||mt '_revision_empty' } ],
+ [ languages => 'Language', join => ', ', split => sub { map $self->{languages}{$_}, @{$_[0]} } ],
+ [ website => 'Website' ],
+ [ released => 'Release date', htmlize => \&fmtdatestr ],
+ [ minage => 'Age rating', serialize => \&minage ],
+ [ notes => 'Notes', diff => qr/[ ,\n\.]/ ],
+ [ platforms => 'Platforms', join => ', ', split => sub { map $self->{platforms}{$_}, @{$_[0]} } ],
+ [ media => 'Media', join => ', ', split => sub { map fmtmedia($_->{medium}, $_->{qty}), @{$_[0]} } ],
+ [ resolution => 'Resolution', serialize => sub { $self->{resolutions}[$_[0]][0]; } ],
+ [ voiced => 'Voiced', serialize => sub { $self->{voiced}[$_[0]] } ],
+ [ ani_story => 'Story animation', serialize => sub { $self->{animated}[$_[0]] } ],
+ [ ani_ero => 'Ero animation', serialize => sub { $self->{animated}[$_[0]] } ],
+ [ producers => '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' :())
), @{$_[0]};
@@ -341,7 +341,7 @@ sub edit {
(join(',', sort @{$b4{languages}}) eq join(',', sort @{$frm->{languages}})) &&
!grep !/^(platforms|producers|vn|languages)$/ && $frm->{$_} ne $b4{$_}, keys %b4;
return $self->resRedirect("/r$rid", 'post') if !$copy && $same;
- $frm->{_err} = [ 'nochanges' ] if $copy && $same;
+ $frm->{_err} = [ "No changes, please don't create an entry that is fully identical to another" ] if $copy && $same;
}
if(!$frm->{_err}) {
diff --git a/lib/VNDB/Handler/Staff.pm b/lib/VNDB/Handler/Staff.pm
index d4de2bf9..baaa059e 100644
--- a/lib/VNDB/Handler/Staff.pm
+++ b/lib/VNDB/Handler/Staff.pm
@@ -34,18 +34,18 @@ sub page {
if($rev) {
my $prev = $rev && $rev > 1 && $self->dbStaffGetRev(id => $id, rev => $rev-1, what => 'extended aliases')->[0];
$self->htmlRevision('s', $prev, $s,
- [ name => diff => 1 ],
- [ original => diff => 1 ],
- [ gender => serialize => sub { $self->{genders}{$_[0]} } ],
- [ lang => serialize => sub { "$_[0] ($self->{languages}{$_[0]})" } ],
- [ l_site => diff => 1 ],
- [ l_wp => htmlize => sub {
+ [ name => 'Name (romaji)', diff => 1 ],
+ [ original => 'Original name', diff => 1 ],
+ [ gender => 'Gender', serialize => sub { $self->{genders}{$_[0]} } ],
+ [ lang => 'Language', serialize => sub { "$_[0] ($self->{languages}{$_[0]})" } ],
+ [ l_site => 'Official page', diff => 1 ],
+ [ l_wp => 'Wikipedia link', htmlize => sub {
$_[0] ? sprintf '<a href="http://en.wikipedia.org/wiki/%s">%1$s</a>', xml_escape $_[0] : mt '_revision_nolink'
}],
- [ l_twitter => diff => 1 ],
- [ l_anidb => serialize => sub { $_[0] // '' } ],
- [ desc => diff => qr/[ ,\n\.]/ ],
- [ aliases => join => '<br />', split => sub {
+ [ l_twitter => 'Twitter account', diff => 1 ],
+ [ l_anidb => 'AniDB creator ID', serialize => sub { $_[0] // '' } ],
+ [ desc => 'Description', diff => qr/[ ,\n\.]/ ],
+ [ aliases => 'Aliases', join => '<br />', split => sub {
map xml_escape(sprintf('%s%s', $_->{name}, $_->{original} ? ' ('.$_->{original}.')' : '')), @{$_[0]};
}],
);
@@ -229,7 +229,8 @@ sub edit {
# Make sure no aliases that have been linked to a VN are removed.
my %new_aliases = map +($_, 1), grep $_, $frm->{primary}, map $_->{aid}, @{$frm->{aliases}};
- $frm->{_err} = [ 'usedalias' ] if grep !$new_aliases{$_->{aid}}, @{$s->{roles}}, @{$self->{cast}};
+ $frm->{_err} = [ "Can't remove an alias that is still linked to a VN." ]
+ if grep !$new_aliases{$_->{aid}}, @{$s->{roles}}, @{$self->{cast}};
}
if(!$frm->{_err}) {
diff --git a/lib/VNDB/Handler/Tags.pm b/lib/VNDB/Handler/Tags.pm
index bb6dd2d4..64c69caa 100644
--- a/lib/VNDB/Handler/Tags.pm
+++ b/lib/VNDB/Handler/Tags.pm
@@ -165,12 +165,9 @@ sub tagedit {
my @parents = split /[\t\s]*,[\t\s]*/, $frm->{parents};
my @merge = split /[\t\s]*,[\t\s]*/, $frm->{merge};
if(!$frm->{_err}) {
- my $c = $self->dbTagGet(name => $frm->{name}, noid => $tag);
- push @{$frm->{_err}}, [ 'name', 'tagexists', $c->[0] ] if @$c;
- for (@aliases) {
- $c = $self->dbTagGet(name => $_, noid => $tag);
- push @{$frm->{_err}}, [ 'alias', 'tagexists', $c->[0] ] if @$c;
- }
+ my @dups = @{$self->dbTagGet(name => $frm->{name}, noid => $tag)};
+ push @dups, @{$self->dbTagGet(name => $_, noid => $tag)} for @aliases;
+ push @{$frm->{_err}}, \sprintf 'Tag <a href="/g%d">%s</a> already exists!', $_->{id}, xml_escape $_->{name} for @dups;
for(@parents, @merge) {
my $c = $self->dbTagGet(name => $_, noid => $tag);
push @{$frm->{_err}}, [ 'parents', 'func', [ 0, mt '_tagedit_err_notfound', $_ ]] if !@$c;
diff --git a/lib/VNDB/Handler/Traits.pm b/lib/VNDB/Handler/Traits.pm
index 4b106fa2..979ea0d6 100644
--- a/lib/VNDB/Handler/Traits.pm
+++ b/lib/VNDB/Handler/Traits.pm
@@ -3,7 +3,7 @@ package VNDB::Handler::Traits;
use strict;
use warnings;
-use TUWF ':html', ':xml', 'html_escape';
+use TUWF ':html', ':xml', 'html_escape', 'xml_escape';
use VNDB::Func;
@@ -158,12 +158,9 @@ sub traitedit {
}
}
if(!$frm->{_err}) {
- my $c = $self->dbTraitGet(name => $frm->{name}, noid => $trait, group => $group);
- push @{$frm->{_err}}, [ 'name', 'traitexists', $c->[0] ] if @$c;
- for (split /[\t\s]*\n[\t\s]*/, $frm->{alias}) {
- $c = $self->dbTraitGet(name => $_, noid => $trait, group => $group);
- push @{$frm->{_err}}, [ 'alias', 'traitexists', $c->[0] ] if @$c;
- }
+ my @dups = @{$self->dbTraitGet(name => $frm->{name}, noid => $trait, group => $group)};
+ push @dups, @{$self->dbTraitGet(name => $_, noid => $trait, group => $group)} for split /[\t\s]*\n[\t\s]*/, $frm->{alias};
+ push @{$frm->{_err}}, \sprintf 'Trait <a href="/c%d">%s</a> already exists within the same group.', $_->{id}, xml_escape $_->{name} for @dups;
}
if(!$frm->{_err}) {
diff --git a/lib/VNDB/Handler/Users.pm b/lib/VNDB/Handler/Users.pm
index 8c72ba82..989b5286 100644
--- a/lib/VNDB/Handler/Users.pm
+++ b/lib/VNDB/Handler/Users.pm
@@ -168,7 +168,7 @@ sub login {
if(!$frm->{_err}) {
$frm->{usrname} = lc $frm->{usrname};
return if $self->authLogin($frm->{usrname}, $frm->{usrpass}, $ref);
- $frm->{_err} = [ 'login_failed' ];
+ $frm->{_err} = [ 'Invalid username or password' ];
$self->dbThrottleSet(norm_ip($self->reqIP), $tm+$self->{login_throttle}[0]);
}
}
@@ -204,7 +204,7 @@ sub newpass {
$frm = $self->formValidate({ post => 'mail', template => 'email' });
if(!$frm->{_err}) {
$u = $self->dbUserGet(mail => $frm->{mail})->[0];
- $frm->{_err} = [ 'nomail' ] if !$u || !$u->{id};
+ $frm->{_err} = [ 'No user found with that email address' ] if !$u || !$u->{id};
}
if(!$frm->{_err}) {
my %o;
@@ -264,7 +264,7 @@ sub setpass {
{ post => 'usrpass', minlength => 4, maxlength => 64, template => 'ascii' },
{ post => 'usrpass2', minlength => 4, maxlength => 64, template => 'ascii' },
);
- push @{$frm->{_err}}, 'passmatch' if $frm->{usrpass} ne $frm->{usrpass2};
+ push @{$frm->{_err}}, 'Passwords do not match' if $frm->{usrpass} ne $frm->{usrpass2};
if(!$frm->{_err}) {
my %o = (email_confirmed => 1);
@@ -298,14 +298,18 @@ sub register {
{ post => 'answer', template => 'uint' },
);
my $num = $self->{stats}{[qw|vn releases producers|]->[ $frm->{type} - 1 ]};
- push @{$frm->{_err}}, 'notanswer' if !$frm->{_err} && ($frm->{answer} > $num || $frm->{answer} < $num*0.995);
- push @{$frm->{_err}}, 'usrexists' if $frm->{usrname} eq 'anonymous' || !$frm->{_err} && $self->dbUserGet(username => $frm->{usrname})->[0]{id};
- push @{$frm->{_err}}, 'mailexists' if !$frm->{_err} && $self->dbUserGet(mail => $frm->{mail})->[0]{id};
+ push @{$frm->{_err}}, 'Question was not correctly answered. Are you sure you are a human?'
+ if !$frm->{_err} && ($frm->{answer} > $num || $frm->{answer} < $num*0.995);
+ push @{$frm->{_err}}, 'Someone already has this username, please choose another name'
+ if $frm->{usrname} eq 'anonymous' || !$frm->{_err} && $self->dbUserGet(username => $frm->{usrname})->[0]{id};
+ push @{$frm->{_err}}, 'Someone already registered with that email address'
+ if !$frm->{_err} && $self->dbUserGet(mail => $frm->{mail})->[0]{id};
# Use /32 match for IPv4 and /48 for IPv6. The /48 is fairly broad, so some
# users may have to wait a bit before they can register...
my $ip = $self->reqIP;
- push @{$frm->{_err}}, 'oneaday' if !$frm->{_err} && $self->dbUserGet(ip => $ip =~ /:/ ? "$ip/48" : $ip, registered => time-24*3600)->[0]{id};
+ push @{$frm->{_err}}, 'You can only register one account from the same IP within 24 hours'
+ if !$frm->{_err} && $self->dbUserGet(ip => $ip =~ /:/ ? "$ip/48" : $ip, registered => time-24*3600)->[0]{id};
if(!$frm->{_err}) {
my($token, $pass) = $self->authPrepareReset();
@@ -382,9 +386,9 @@ sub edit {
{ post => 'skin', required => 0, default => $self->{skin_default}, enum => [ keys %{$self->{skins}} ] },
{ post => 'customcss', required => 0, maxlength => 2000, default => '' },
);
- push @{$frm->{_err}}, 'passmatch'
+ push @{$frm->{_err}}, 'Passwords do not match'
if ($frm->{usrpass} || $frm->{usrpass2}) && (!$frm->{usrpass} || !$frm->{usrpass2} || $frm->{usrpass} ne $frm->{usrpass2});
- push @{$frm->{_err}}, 'invalidpass'
+ push @{$frm->{_err}}, 'Invalid password'
if !($self->authInfo->{id} != $u->{id} && $self->authCan('usermod'))
&& ($frm->{usrpass} || $frm->{usrpass2}) && !$self->authCheck($u->{username}, $frm->{curpass});
diff --git a/lib/VNDB/Handler/VNEdit.pm b/lib/VNDB/Handler/VNEdit.pm
index 870f9fb8..1319cd43 100644
--- a/lib/VNDB/Handler/VNEdit.pm
+++ b/lib/VNDB/Handler/VNEdit.pm
@@ -148,7 +148,7 @@ sub edit {
$frm->{alias} = join "\n", map { s/^ +//g; s/ +$//g; $_?($_):() } split /\n/, $frm->{alias};
# throw error on duplicate/existing aliases
my %alias = map +(lc($_),1), $frm->{title}, $frm->{original}, map +($_->{title}, $_->{original}), @$r;
- my @e = map $alias{ lc($_) }++ ? [ 'alias', 'existingalias', $_ ] : (), split /\n/, $frm->{alias};
+ my @e = map $alias{ lc($_) }++ ? "Duplicate alias '$_', or the alias is already used as a release title" : (), split /\n/, $frm->{alias};
$frm->{_err} = \@e if @e;
}
if(!$nosubmit && !$frm->{_err}) {
@@ -210,14 +210,14 @@ sub _uploadimage {
if($frm->{_err} || !$self->reqPost('img')) {
return 0 if !$frm->{image};
- push @{$frm->{_err}}, 'invalidimgid' if !-s imgpath(cv => $frm->{image});
+ push @{$frm->{_err}}, 'No image with that ID' if !-s imgpath(cv => $frm->{image});
return $frm->{image};
}
# perform some elementary checks
my $imgdata = $self->reqUploadRaw('img');
- $frm->{_err} = [ 'noimage' ] if $imgdata !~ /^(\xff\xd8|\x89\x50)/; # JPG or PNG headers
- $frm->{_err} = [ 'toolarge' ] if length($imgdata) > 5*1024*1024;
+ $frm->{_err} = [ 'Image must be in JPEG or PNG format' ] if $imgdata !~ /^(\xff\xd8|\x89\x50)/; # JPG or PNG headers
+ $frm->{_err} = [ 'Image is too large, only 5MB allowed' ] if length($imgdata) > 5*1024*1024;
return undef if $frm->{_err};
# resize/compress
diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm
index 89cd9940..70ba3402 100644
--- a/lib/VNDB/Handler/VNPage.pm
+++ b/lib/VNDB/Handler/VNPage.pm
@@ -500,28 +500,28 @@ sub _revision {
)->[0];
$self->htmlRevision('v', $prev, $v,
- [ title => diff => 1 ],
- [ original => diff => 1 ],
- [ alias => diff => qr/[ ,\n\.]/ ],
- [ desc => diff => qr/[ ,\n\.]/ ],
- [ length => serialize => sub { fmtvnlen $_[0] } ],
- [ l_wp => htmlize => sub {
+ [ title => 'Title (romaji)', diff => 1 ],
+ [ original => 'Original title', diff => 1 ],
+ [ alias => 'Alias', diff => qr/[ ,\n\.]/ ],
+ [ desc => 'Description', diff => qr/[ ,\n\.]/ ],
+ [ length => 'Length', serialize => sub { fmtvnlen $_[0] } ],
+ [ l_wp => 'Wikipedia link', htmlize => sub {
$_[0] ? sprintf '<a href="http://en.wikipedia.org/wiki/%s">%1$s</a>', xml_escape $_[0] : mt '_revision_nolink'
}],
- [ l_encubed => htmlize => sub {
+ [ l_encubed => 'Encubed tag', htmlize => sub {
$_[0] ? sprintf '<a href="http://novelnews.net/tag/%s/">%1$s</a>', xml_escape $_[0] : mt '_revision_nolink'
}],
- [ l_renai => htmlize => sub {
+ [ l_renai => 'Renai.us link', htmlize => sub {
$_[0] ? sprintf '<a href="http://renai.us/game/%s.shtml">%1$s</a>', xml_escape $_[0] : mt '_revision_nolink'
}],
- [ credits => join => '<br />', split => sub {
+ [ credits => '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}), 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');
}],
- [ seiyuu => join => '<br />', split => sub {
+ [ seiyuu => 'Seiyuu', 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('_staff_as', xml_escape($_->{cname})),
@@ -529,18 +529,18 @@ sub _revision {
sort { $a->{id} <=> $b->{id} || $a->{cid} <=> $b->{cid} || $a->{note} cmp $b->{note} } @{$_[0]};
return @r ? @r : (mt '_revision_empty');
}],
- [ relations => join => '<br />', split => sub {
+ [ relations => 'Relations', join => '<br />', split => sub {
my @r = map sprintf('[%s] %s: <a href="/v%d" title="%s">%s</a>',
mt($_->{official} ? '_vndiff_rel_official' : '_vndiff_rel_unofficial'),
$self->{vn_relations}{$_->{relation}}[1], $_->{id}, xml_escape($_->{original}||$_->{title}), xml_escape shorten $_->{title}, 40
), sort { $a->{id} <=> $b->{id} } @{$_[0]};
return @r ? @r : (mt '_revision_empty');
}],
- [ anime => join => ', ', split => sub {
+ [ anime => 'Anime', join => ', ', split => sub {
my @r = map sprintf('<a href="http://anidb.net/a%d">a%1$d</a>', $_->{id}), sort { $a->{id} <=> $b->{id} } @{$_[0]};
return @r ? @r : (mt '_revision_empty');
}],
- [ screenshots => join => '<br />', split => sub {
+ [ screenshots => 'Screenshots', join => '<br />', split => sub {
my @r = map sprintf('[%s] <a href="%s" data-iv="%dx%d">%d</a> (%s)',
$_->{rid} ? qq|<a href="/r$_->{rid}">r$_->{rid}</a>| : 'no release',
imgurl(sf => $_->{id}), $_->{width}, $_->{height}, $_->{id},
@@ -548,7 +548,7 @@ sub _revision {
), @{$_[0]};
return @r ? @r : (mt '_revision_empty');
}],
- [ image => htmlize => sub {
+ [ image => 'Image', htmlize => sub {
my $url = imgurl(cv => $_[0]);
if($_[0]) {
return $_[1]->{img_nsfw} && !$self->authPref('show_nsfw') ? "<a href=\"$url\">".mt('_vndiff_image_nsfw').'</a>' : "<img src=\"$url\" />";
@@ -556,7 +556,7 @@ sub _revision {
return mt '_vndiff_image_none';
}
}],
- [ img_nsfw => serialize => sub { mt $_[0] ? '_vndiff_nsfw_notsafe' : '_vndiff_nsfw_safe' } ],
+ [ img_nsfw => 'Image NSFW', serialize => sub { mt $_[0] ? '_vndiff_nsfw_notsafe' : '_vndiff_nsfw_safe' } ],
);
}
diff --git a/lib/VNDB/Util/Auth.pm b/lib/VNDB/Util/Auth.pm
index 9c742dc7..6e1dfa5d 100644
--- a/lib/VNDB/Util/Auth.pm
+++ b/lib/VNDB/Util/Auth.pm
@@ -87,10 +87,6 @@ sub authLogout {
$self->resRedirect('/', 'temp');
$self->resCookie(auth => undef);
-
- # set l10n cookie if the user has a preferred language set
- my $l10n = $self->authPref('l10n');
- $self->resCookie(l10n => $l10n, expires => time()+31536000) if $l10n; # keep 1 year
}
@@ -204,12 +200,12 @@ sub authCheckCode {
sub _incorrectcode {
my $self = shift;
$self->resInit;
- $self->htmlHeader(title => mt '_formcode_title', noindex => 1);
+ $self->htmlHeader(title => 'Validation code expired', noindex => 1);
div class => 'mainbox';
- h1 mt '_formcode_title';
+ h1 'Validation code expired';
div class => 'warning';
- p mt '_formcode_msg';
+ p 'Please hit the back-button of your browser, refresh the page and try again.';
end;
end;
diff --git a/lib/VNDB/Util/BrowseHTML.pm b/lib/VNDB/Util/BrowseHTML.pm
index faa9ea3c..c3115017 100644
--- a/lib/VNDB/Util/BrowseHTML.pm
+++ b/lib/VNDB/Util/BrowseHTML.pm
@@ -107,16 +107,16 @@ sub htmlBrowseNavigate {
my $nc = 5; # max. number of buttons on each side
ul class => 'maintabs browsetabs ' . ($al eq 't' ? 'notfirst' : 'bottom');
- $p > 2 and ref $np and $tab->(1, 1, '&laquo; '.mt '_browse_first');
+ $p > 2 and ref $np and $tab->(1, 1, '&laquo; first');
$p > $nc+1 and ref $np and $ell->(1);
$p > $_ and ref $np and $tab->(1, $p-$_, $p-$_) for (reverse 2..($nc>$p-2?$p-2:$nc-1));
- $p > 1 and $tab->(1, $p-1, '&lsaquo; '.mt '_browse_previous');
+ $p > 1 and $tab->(1, $p-1, '&lsaquo; previous');
my $l = ceil($cnt/$pp)-$p+1;
- $l > 2 and $tab->(0, $l+$p-1, mt('_browse_last').' &raquo;');
+ $l > 2 and $tab->(0, $l+$p-1, 'last &raquo;');
$l > $nc+1 and $ell->(0);
$l > $_ and $tab->(0, $p+$_, $p+$_) for (reverse 2..($nc>$l-2?$l-2:$nc-1));
- $l > 1 and $tab->(0, $p+1, mt('_browse_next').' &rsaquo;');
+ $l > 1 and $tab->(0, $p+1, 'next &rsaquo;');
end 'ul';
}
@@ -130,10 +130,10 @@ sub htmlBrowseHist {
pageurl => $url,
class => 'history',
header => [
- sub { td class => 'tc1_1', mt '_hist_col_rev'; td class => 'tc1_2', ''; },
- [ mt '_hist_col_date' ],
- [ mt '_hist_col_user' ],
- [ mt '_hist_col_page' ],
+ sub { td class => 'tc1_1', 'Rev.'; td class => 'tc1_2', ''; },
+ [ 'Date' ],
+ [ 'User' ],
+ [ 'Page' ],
],
row => sub {
my($s, $n, $i) = @_;
@@ -170,15 +170,15 @@ sub htmlBrowseVN {
pageurl => "$url;o=$f->{o};s=$f->{s}",
sorturl => $url,
header => [
- $tagscore ? [ mt('_vnbrowse_col_score'), 'tagscore', undef, 'tc_s' ] : (),
- [ mt('_vnbrowse_col_title'), 'title', undef, $tagscore ? 'tc_t' : 'tc1' ],
+ $tagscore ? [ 'Score', 'tagscore', undef, 'tc_s' ] : (),
+ [ 'Title', 'title', undef, $tagscore ? 'tc_t' : 'tc1' ],
$f->{vnlist} ? [ '', 0, undef, 'tc7' ] : (),
$f->{wish} ? [ '', 0, undef, 'tc8' ] : (),
[ '', 0, undef, 'tc2' ],
[ '', 0, undef, 'tc3' ],
- [ mt('_vnbrowse_col_released'), 'rel', undef, 'tc4' ],
- [ mt('_vnbrowse_col_popularity'), 'pop', undef, 'tc5' ],
- [ mt('_vnbrowse_col_rating'), 'rating', undef, 'tc6' ],
+ [ 'Released', 'rel', undef, 'tc4' ],
+ [ 'Popularity', 'pop', undef, 'tc5' ],
+ [ 'Rating', 'rating', undef, 'tc6' ],
],
row => sub {
my($s, $n, $l) = @_;
diff --git a/lib/VNDB/Util/CommonHTML.pm b/lib/VNDB/Util/CommonHTML.pm
index cacbae93..e8561e3c 100644
--- a/lib/VNDB/Util/CommonHTML.pm
+++ b/lib/VNDB/Util/CommonHTML.pm
@@ -29,46 +29,46 @@ sub htmlMainTabs {
ul class => 'maintabs';
if($type =~ /[uvrpcs]/) {
li $sel eq 'hist' ? (class => 'tabselected') : ();
- a href => "/$id/hist", mt '_mtabs_hist';
+ a href => "/$id/hist", 'history';
end;
}
if($type =~ /[uvp]/) {
my $cnt = $self->dbThreadCount($type, $obj->{id});
li $sel eq 'disc' ? (class => 'tabselected') : ();
- a href => "/t/$id", mt '_mtabs_discuss', $cnt;
+ a href => "/t/$id", "discussions ($cnt)";
end;
}
if($type eq 'u') {
li $sel eq 'posts' ? (class => 'tabselected') : ();
- a href => "/$id/posts", mt '_mtabs_posts';
+ a href => "/$id/posts", 'posts';
end;
}
if($type eq 'u' && (!($obj->{hide_list} || $obj->{prefs}{hide_list}) || ($self->authInfo->{id} && $self->authInfo->{id} == $obj->{id}) || $self->authCan('usermod'))) {
li $sel eq 'wish' ? (class => 'tabselected') : ();
- a href => "/$id/wish", mt '_mtabs_wishlist';
+ a href => "/$id/wish", 'wishlist';
end;
li $sel eq 'votes' ? (class => 'tabselected') : ();
- a href => "/$id/votes", mt '_mtabs_votes';
+ a href => "/$id/votes", 'votes';
end;
li $sel eq 'list' ? (class => 'tabselected') : ();
- a href => "/$id/list", mt '_mtabs_list';
+ a href => "/$id/list", 'list';
end;
}
if($type eq 'v' && $self->authCan('tag') && !$obj->{hidden}) {
li $sel eq 'tagmod' ? (class => 'tabselected') : ();
- a href => "/$id/tagmod", mt '_mtabs_tagmod';
+ a href => "/$id/tagmod", 'modify tags';
end;
}
if(($type =~ /[rc]/ && $self->authCan('edit')) && $self->authInfo->{c_changes} > 0) {
li $sel eq 'copy' ? (class => 'tabselected') : ();
- a href => "/$id/copy", mt '_mtabs_copy';
+ a href => "/$id/copy", 'copy';
end;
}
@@ -77,25 +77,25 @@ sub htmlMainTabs {
|| $type =~ /[gi]/ && $self->authCan('tagmod')
) {
li $sel eq 'edit' ? (class => 'tabselected') : ();
- a href => "/$id/edit", mt '_mtabs_edit';
+ a href => "/$id/edit", 'edit';
end;
}
if($type eq 'u' && $self->authCan('usermod')) {
li $sel eq 'del' ? (class => 'tabselected') : ();
- a href => "/$id/del", mt '_js_remove';
+ a href => "/$id/del", 'remove';
end;
}
if($type eq 'v') {
li $sel eq 'releases' ? (class => 'tabselected') : ();
- a href => "/$id/releases", mt '_mtabs_releases';
+ a href => "/$id/releases", 'releases';
end;
}
if($type =~ /[vp]/ && $obj->{rgraph}) {
li $sel eq 'rg' ? (class => 'tabselected') : ();
- a href => "/$id/rg", mt '_mtabs_relations';
+ a href => "/$id/rg", 'relations';
end;
}
@@ -109,16 +109,16 @@ sub htmlMainTabs {
# generates a full error page, including header and footer
sub htmlDenied {
my $self = shift;
- $self->htmlHeader(title => mt '_denied_title');
+ $self->htmlHeader(title => 'Access Denied');
div class => 'mainbox';
- h1 mt '_denied_title';
+ h1 'Access Denied';
div class => 'warning';
if(!$self->authInfo->{id}) {
- h2 mt '_denied_needlogin_title';
- p; lit mt '_denied_needlogin_msg'; end;
+ h2 'You need to be logged in to perform this action.';
+ p; lit 'Please <a href="/u/login">login</a>, or <a href="/u/register">create an account</a> if you don\'t have one yet.'; end;
} else {
- h2 mt '_denied_noaccess_title';
- p mt '_denied_noaccess_msg';
+ h2 'You are not allowed to perform this action.';
+ p 'It seems you don\'t have the proper rights to perform the action you wanted to perform...';
}
end;
end 'div';
@@ -142,9 +142,9 @@ sub htmlHiddenMessage {
div class => 'mainbox';
h1 $obj->{title}||$obj->{name};
div class => 'warning';
- h2 mt '_hiddenmsg_title';
+ h2 'Item deleted';
p;
- lit mt '_hiddenmsg_msg', "/t/$board";
+ lit 'This item has been deleted from the database. File a request on the <a href="/t/'.$board.'">discussion board</a> to undelete this page.';
br; br;
lit bb2html $editsum;
end;
@@ -168,22 +168,20 @@ sub htmlHiddenMessage {
sub htmlRevision {
my($self, $type, $old, $new, @fields) = @_;
div class => 'mainbox revision';
- h1 mt '_revision_title', $new->{rev};
+ h1 "Revision $new->{rev}";
# character information may be rather spoilerous
if($type eq 'c') {
div class => 'warning';
- h2 mt '_revision_spoil_title';
- lit mt '_revision_spoil_msg', "/c$new->{id}";
+ h2 'SPOILER WARNING!';
+ lit 'This revision page may contain major spoilers. You may want to view the <a href="/c'.$new->{id}.'">final page</a> instead.';
end;
br;br;
}
# previous/next revision links
- a class => 'prev', href => sprintf('/%s%d.%d', $type, $new->{id}, $new->{rev}-1), '<- '.mt '_revision_previous'
- if $new->{rev} > 1;
- a class => 'next', href => sprintf('/%s%d.%d', $type, $new->{id}, $new->{rev}+1), mt('_revision_next').' ->'
- if !$new->{lastrev};
+ a class => 'prev', href => sprintf('/%s%d.%d', $type, $new->{id}, $new->{rev}-1), '<- earlier revision' if $new->{rev} > 1;
+ a class => 'next', href => sprintf('/%s%d.%d', $type, $new->{id}, $new->{rev}+1), 'later revision ->' if !$new->{lastrev};
p class => 'center';
a href => "/$type$new->{id}", "$type$new->{id}";
end;
@@ -193,7 +191,7 @@ sub htmlRevision {
div class => 'rev';
revheader($self, $type, $new);
br;
- b mt '_revision_new_summary';
+ b 'Edit summary';
br; br;
lit bb2html($new->{comments})||'-';
end;
@@ -211,15 +209,15 @@ sub htmlRevision {
Tr;
td; lit '&#xa0;'; end;
td colspan => 2;
- b mt '_revision_edit_summary', $new->{rev};
+ b "Edit summary of revision $new->{rev}:";
br; br;
lit bb2html($new->{comments})||'-';
end;
end;
end;
revdiff($type, $old, $new, @$_) for (
- [ ihid => serialize => sub { mt $_[0] ? '_revision_yes' : '_revision_no' } ],
- [ ilock => serialize => sub { mt $_[0] ? '_revision_yes' : '_revision_no' } ],
+ [ ihid => 'Deleted', serialize => sub { $_[0] ? 'Yes' : 'No' } ],
+ [ ilock => 'Locked', serialize => sub { $_[0] ? 'Yes' : 'No' } ],
@fields
);
end 'table';
@@ -229,16 +227,19 @@ sub htmlRevision {
sub revheader { # type, obj
my($self, $type, $obj) = @_;
- b mt '_revision_title', $obj->{rev};
+ b "Revision $obj->{rev}";
txt ' (';
- a href => "/$type$obj->{id}.$obj->{rev}/edit", mt '_mtabs_edit';
+ a href => "/$type$obj->{id}.$obj->{rev}/edit", 'edit';
txt ')';
br;
- lit mt '_revision_user_date', $obj, $obj->{added};
+ txt 'By ';
+ lit fmtuser $obj;
+ txt ' on ';
+ txt fmtdate $obj->{added}, 'full';
}
sub revdiff {
- my($type, $old, $new, $short, %o) = @_;
+ my($type, $old, $new, $short, $display, %o) = @_;
$o{serialize} ||= $o{htmlize};
$o{diff} = 1 if $o{split};
@@ -270,11 +271,11 @@ sub revdiff {
$ser2 = html_escape $ser2;
}
- $ser1 = mt '_revision_empty' if !$ser1 && $ser1 ne '0';
- $ser2 = mt '_revision_empty' if !$ser2 && $ser2 ne '0';
+ $ser1 = '[empty]' if !$ser1 && $ser1 ne '0';
+ $ser2 = '[empty]' if !$ser2 && $ser2 ne '0';
Tr;
- td mt $short eq 'ihid' || $short eq 'ilock' ? "_revfield_$short" : "_revfield_${type}_$short";
+ td $display;
td class => 'tcval'; lit $ser1; end;
td class => 'tcval'; lit $ser2; end;
end;
@@ -285,35 +286,53 @@ sub revdiff {
# Arguments: v/r/p, obj
sub htmlEditMessage {
my($self, $type, $obj, $title, $copy) = @_;
- my $num = {v => 0, r => 1, p => 2, c => 3, 's' => 4}->{$type};
+ my $typename = {v => 'visual novel', r => 'release', p => 'producer', c => 'character', s => 'person'}->{$type};
my $guidelines = {v => 2, r => 3, p => 4, c => 12, 's' => 16}->{$type};
div class => 'mainbox';
h1 $title;
if($copy) {
div class => 'warning';
- h2 mt '_editmsg_copy_title';
+ h2 'You\'re not editing an entry!';
p;
- lit mt '_editmsg_copy_msg', sprintf '<a href="/%s%d">%s</a>', $type, $obj->{id}, xml_escape $obj->{title}||$obj->{name};
+ txt 'You\'re about to insert a new entry into the database with information based on ';
+ a href => "/$type$obj->{id}", $obj->{title}||$obj->{name};
+ txt '.';
+ br;
+ txt 'Hit the \'edit\' tab on the right-top if you intended to edit the entry instead of creating a new one.';
end;
end;
}
div class => 'notice';
- h2 mt '_editmsg_msg_title';
+ h2 'Before editing:';
ul;
- li; lit mt '_editmsg_msg_guidelines', "/d$guidelines"; end;
+ li;
+ txt "Read the ";
+ a href=> "/d$guidelines", 'guidelines';
+ txt '!';
+ end;
if($obj) {
- li; lit mt '_editmsg_msg_discuss', $type =~ /[cs]/ ? '/t/db' : $type eq 'r' ? "/t/v$obj->{vn}[0]{vid}" : "/t/$type$obj->{id}"; end;
- li; lit mt '_editmsg_msg_history', "/$type$obj->{id}/hist"; end;
+ li;
+ txt 'Check for any existing discussions on the ';
+ a href => $type =~ /[cs]/ ? '/t/db' : $type eq 'r' ? "/t/v$obj->{vn}[0]{vid}" : "/t/$type$obj->{id}", 'discussion board';
+ end;
+ li;
+ txt 'Browse the ';
+ a href => "/$type$obj->{id}/hist", 'edit history';
+ txt ' for any recent changes related to what you want to change.';
+ end;
} elsif($type ne 'r') {
- li; lit mt '_editmsg_msg_search', "/$type/all", $num; end;
+ li;
+ a href => "/$type/all", 'Search the database';
+ txt " to see if we already have information about this $typename.";
+ end;
}
end;
end;
if($obj && !$obj->{lastrev}) {
div class => 'warning';
- h2 mt '_editmsg_revert_title';
- p mt '_editmsg_revert_msg', $num;
+ h2 'Reverting';
+ p "You are editing an old revision of this $typename. If you save it, all changes made after this revision will be reverted!";
end;
}
end 'div';
@@ -328,9 +347,9 @@ sub htmlItemMessage {
# $type isn't being used at all... oh well.
if($obj->{locked}) {
- p class => 'locked', mt '_itemmsg_locked';
+ p class => 'locked', 'Locked for editing';
} elsif($self->authInfo->{id} && !$self->authCan('edit')) {
- p class => 'locked', mt '_itemmsg_denied';
+ p class => 'locked', 'You are not allowed to edit this page';
}
}
@@ -348,11 +367,11 @@ sub htmlVoteStats {
div class => 'votestats';
table class => 'votegraph';
thead; Tr;
- td colspan => 2, mt '_votestats_title';
+ td colspan => 2, 'Vote stats';
end; end;
tfoot; Tr;
- td colspan => 2, mt('_votestats_sum', $count, sprintf('%.2f', $total/$count/10))
- .($type eq 'v' ? ' ('.mt('_vote_'.(ceil($total/$count/10-1)||1)).')' : '');
+ td colspan => 2, sprintf '%d vote%s total, average %.2f%s', $count, $count == 1 ? '' : 's', $total/$count/10,
+ $type eq 'v' ? ' ('.fmtrating(ceil($total/$count/10-1)||1).')' : '';
end; end;
for (reverse 0..$#$stats) {
Tr;
@@ -376,10 +395,10 @@ sub htmlVoteStats {
table class => 'recentvotes stripe';
thead; Tr;
td colspan => 3;
- txt mt '_votestats_recent';
+ txt 'Recent votes';
b;
txt '(';
- a href => "/$type$obj->{id}/votes", mt '_votestats_allvotes';
+ a href => "/$type$obj->{id}/votes", 'show all';
txt ')';
end;
end;
@@ -403,9 +422,9 @@ sub htmlVoteStats {
clearfloat;
if($type eq 'v' && $obj->{c_votecount}) {
div;
- h3 mt '_votestats_rank_title';
- p mt '_votestats_rank_pop', $obj->{p_ranking}, sprintf '%.2f', ($obj->{c_popularity}||0)*100;
- p mt '_votestats_rank_rat', $obj->{r_ranking}, sprintf '%.2f', $obj->{c_rating}/10;
+ h3 'Ranking';
+ p sprintf 'Popularity: ranked #%d with a score of %.2f', $obj->{p_ranking}, ($obj->{c_popularity}||0)*100;
+ p sprintf 'Bayesian rating: ranked #%d with a rating of %.2f', $obj->{r_ranking}, $obj->{c_rating}/10;
end;
}
end 'div';
@@ -417,17 +436,17 @@ sub htmlSearchBox {
fieldset class => 'search';
p id => 'searchtabs';
- a href => '/v/all', $sel eq 'v' ? (class => 'sel') : (), mt '_searchbox_vn';
- a href => '/r', $sel eq 'r' ? (class => 'sel') : (), mt '_searchbox_releases';
- a href => '/p/all', $sel eq 'p' ? (class => 'sel') : (), mt '_searchbox_producers';
- a href => '/s/all', $sel eq 's' ? (class => 'sel') : (), mt '_searchbox_staff';
- a href => '/c/all', $sel eq 'c' ? (class => 'sel') : (), mt '_searchbox_chars';
- a href => '/g', $sel eq 'g' ? (class => 'sel') : (), mt '_searchbox_tags';
- a href => '/i', $sel eq 'i' ? (class => 'sel') : (), mt '_searchbox_traits';
- a href => '/u/all', $sel eq 'u' ? (class => 'sel') : (), mt '_searchbox_users';
+ a href => '/v/all', $sel eq 'v' ? (class => 'sel') : (), 'Visual novels';
+ a href => '/r', $sel eq 'r' ? (class => 'sel') : (), 'Releases';
+ a href => '/p/all', $sel eq 'p' ? (class => 'sel') : (), 'Producers';
+ a href => '/s/all', $sel eq 's' ? (class => 'sel') : (), 'Staff';
+ a href => '/c/all', $sel eq 'c' ? (class => 'sel') : (), 'Characters';
+ a href => '/g', $sel eq 'g' ? (class => 'sel') : (), 'Tags';
+ a href => '/i', $sel eq 'i' ? (class => 'sel') : (), 'Traits';
+ a href => '/u/all', $sel eq 'u' ? (class => 'sel') : (), 'Users';
end;
input type => 'text', name => 'q', id => 'q', class => 'text', value => $v;
- input type => 'submit', class => 'submit', value => mt '_searchbox_submit';
+ input type => 'submit', class => 'submit', value => 'Search!';
end 'fieldset';
}
@@ -442,8 +461,8 @@ sub htmlRGHeader {
div class => 'mainbox';
h1 $title;
div class => 'warning';
- h2 mt '_rg_notsupp';
- p mt '_rg_notsupp_msg';
+ h2 'Not supported';
+ p 'Your browser sucks, it doesn\'t have the functionality to render our nice relation graphs.';
end;
end;
$self->htmlFooter;
diff --git a/lib/VNDB/Util/FormHTML.pm b/lib/VNDB/Util/FormHTML.pm
index cca2b150..51d5a4f6 100644
--- a/lib/VNDB/Util/FormHTML.pm
+++ b/lib/VNDB/Util/FormHTML.pm
@@ -20,37 +20,41 @@ sub htmlFormError {
return if !$frm->{_err};
if($mainbox) {
div class => 'mainbox';
- h1 mt '_formerr_title';
+ h1 'Error';
}
div class => 'warning';
- h2 mt '_formerr_subtitle';
+ h2 'Form could not be sent:';
ul;
for my $e (@{$frm->{_err}}) {
if(!ref $e) {
- li; lit mt '_formerr_e_'.$e; end;
+ li $e;
next;
}
- my($field, $type, $rule) = @$e;
- if($type eq 'required') {
- li; lit mt $field eq 'editsum' ?'_formerr_tpl_editsum' : '_formerr_required', $field; end;
+ if(ref $e eq 'SCALAR') {
+ li; lit $$e; end;
+ next;
}
- li mt '_formerr_mincount', $field, $rule if $type eq 'mincount';
- li mt '_formerr_maxcount', $field, $rule if $type eq 'maxcount';
- li mt '_formerr_minlength', $field, $rule if $type eq 'minlength';
- li mt '_formerr_maxlength', $field, $rule if $type eq 'maxlength';
- li mt '_formerr_enum', $field, join ', ', @$rule if $type eq 'enum';
- li mt '_formerr_wrongboard', $rule if $type eq 'wrongboard';
- li mt '_formerr_existingalias', $rule if $type eq 'existingalias';
+ my($field, $type, $rule) = @$e;
+ ($type, $rule) = ('template', 'editsum') if $type eq 'required' && $field eq 'editsum';
+
+ li "$field is a required field" if $type eq 'required';;
+ li "$field: minimum number of values is $rule" if $type eq 'mincount';
+ li "$field: maximum number of values is $rule" if $type eq 'maxcount';
+ li "$field: should have at least $rule characters" if $type eq 'minlength';
+ li "$field: only $rule characters allowed" if $type eq 'maxlength';
+ li "$field must be one of the following: ".join(', ', @$rule) if $type eq 'enum';
li $rule->[1] if $type eq 'func' || $type eq 'regex';
if($type eq 'template') {
- $rule = 'int' if $rule eq 'num' || $rule eq 'uint' || $rule eq 'page' || $rule eq 'id';
- li; lit mt "_formerr_tpl_$rule", $field; end;
- }
- if($type eq 'tagexists') {
- li; lit mt '_formerr_tagexists', "/g$rule->{id}", $rule->{name}; end;
- }
- if($type eq 'traitexists') {
- li; lit mt '_formerr_traitexists', "/i$rule->{id}", $rule->{name}; end;
+ li "$field: Invalid number" if $rule eq 'int' || $rule eq 'num' || $rule eq 'uint' || $rule eq 'page' || $rule eq 'id';
+ li "$field: Invalid URL" if $rule eq 'weburl';
+ li "$field: only ASCII characters allowed" if $rule eq 'ascii';
+ li "Invalid email address" if $rule eq 'email';
+ li "$field may only contain lowercase alphanumeric characters and a hyphen" if $rule eq 'uname';
+ li 'Invalid JAN/UPC/EAN' if $rule eq 'gtin';
+ li "$field: Malformed data or invalid input" if $rule eq 'json';
+ if($rule eq 'editsum') {
+ li; lit 'Please read <a href="/d5.4">the guidelines</a> on how to use the edit summary.'; end;
+ }
}
}
end;
@@ -209,7 +213,7 @@ sub htmlForm {
end;
}
li class => 'left';
- a href => '#all', id => 'jt_sel_all', mt '_form_tab_all';
+ a href => '#all', id => 'jt_sel_all', 'All items';
end;
end 'ul';
}
@@ -238,26 +242,26 @@ sub htmlForm {
if($self->authCan('dbmod')) {
input type => 'checkbox', name => 'ihid', id => 'ihid', value => 1,
tabindex => 10, $options->{frm}{ihid} ? (checked => 'checked') : ();
- label for => 'ihid', mt '_form_ihid';
+ label for => 'ihid', 'Deleted';
input type => 'checkbox', name => 'ilock', id => 'ilock', value => 1,
tabindex => 10, $options->{frm}{ilock} ? (checked => 'checked') : ();
- label for => 'ilock', mt '_form_ilock';
- br; txt mt('_form_hidlock_note'); br;
+ label for => 'ilock', 'Locked';
+ br; txt 'Note: edit summary of the last edit should indicate the reason for the deletion.'; br;
}
# edit summary
h2;
- txt mt '_form_editsum';
- b class => 'standout', ' ('.mt('_inenglish').')';
+ txt 'Edit summary';
+ b class => 'standout', ' (English please!)';
end;
textarea name => 'editsum', id => 'editsum', rows => 4, cols => 50, tabindex => 10, $options->{frm}{editsum}||'';
br;
}
if(!$options->{continue}) {
- input type => 'submit', value => mt('_form_submit'), class => 'submit', tabindex => 10;
+ input type => 'submit', value => 'Submit', class => 'submit', tabindex => 10;
} else {
- input type => 'submit', value => mt('_form_continue'), class => 'submit', tabindex => 10;
- input type => 'submit', name => 'continue_ign', value => mt('_form_continue_ign'),
+ input type => 'submit', value => 'Continue', class => 'submit', tabindex => 10;
+ input type => 'submit', name => 'continue_ign', value => 'Continue and ignore duplicates',
class => 'submit', style => 'width: auto', tabindex => 10 if $options->{continue} == 2;
}
end;
diff --git a/lib/VNDB/Util/LayoutHTML.pm b/lib/VNDB/Util/LayoutHTML.pm
index 36fa9937..c06e0204 100644
--- a/lib/VNDB/Util/LayoutHTML.pm
+++ b/lib/VNDB/Util/LayoutHTML.pm
@@ -36,7 +36,7 @@ sub htmlHeader { # %options->{ title, noindex, search, feeds, svg }
div id => 'bgright', ' ';
div id => 'header';
h1;
- a href => '/', lc mt '_site_title';
+ a href => '/', 'the visual novel database';
end;
end;
@@ -53,27 +53,27 @@ sub _menu {
div class => 'menubox';
h2;
- txt mt '_menu';
+ txt 'Menu';
end;
div;
- a href => '/', mt '_menu_home'; br;
- a href => '/v/all', mt '_menu_vn'; br;
- b class => 'grayedout', '> '; a href => '/g', mt '_menu_tags'; br;
- a href => '/r', mt '_menu_releases'; br;
- a href => '/p/all', mt '_menu_producers'; br;
- a href => '/s/all', mt '_menu_staff'; br;
- a href => '/c/all', mt '_menu_characters'; br;
- b class => 'grayedout', '> '; a href => '/i', mt '_menu_traits'; br;
- a href => '/u/all', mt '_menu_users'; br;
- a href => '/hist', mt '_menu_recent_changes'; br;
- a href => '/t', mt '_menu_discussion_board'; br;
- a href => '/d6', mt '_menu_faq'; br;
- a href => '/v/rand', mt '_menu_randvn';
+ a href => '/', 'Home'; br;
+ a href => '/v/all', 'Visual novels'; br;
+ b class => 'grayedout', '> '; a href => '/g', 'Tags'; br;
+ a href => '/r', 'Releases'; br;
+ a href => '/p/all', 'Producers'; br;
+ a href => '/s/all', 'Staff'; br;
+ a href => '/c/all', 'Characters'; br;
+ b class => 'grayedout', '> '; a href => '/i', 'Traits'; br;
+ a href => '/u/all', 'Users'; br;
+ a href => '/hist', 'Recent changes'; br;
+ a href => '/t', 'Discussion board'; br;
+ a href => '/d6', 'FAQ'; br;
+ a href => '/v/rand','Random visual novel';
end;
form action => '/v/all', method => 'get', id => 'search';
fieldset;
legend 'Search';
- input type => 'text', class => 'text', id => 'sq', name => 'sq', value => $o{search}||'', placeholder => mt('_menu_emptysearch');
+ input type => 'text', class => 'text', id => 'sq', name => 'sq', value => $o{search}||'', placeholder => 'search';
input type => 'submit', class => 'submit', value => 'Search';
end;
end;
@@ -87,42 +87,48 @@ sub _menu {
a href => $uid, ucfirst $self->authInfo->{username};
end;
div;
- a href => "$uid/edit", mt '_menu_myprofile'; br;
- a href => "$uid/list", mt '_menu_myvnlist'; br;
- a href => "$uid/votes",mt '_menu_myvotes'; br;
- a href => "$uid/wish", mt '_menu_mywishlist'; br;
- a href => "$uid/notifies", $nc ? (class => 'notifyget') : (), mt('_menu_mynotifications').($nc?" ($nc)":''); br;
- a href => "$uid/hist", mt '_menu_mychanges'; br;
- a href => '/g/links?u='.$self->authInfo->{id}, mt '_menu_mytags'; br;
+ a href => "$uid/edit", 'My Profile'; br;
+ a href => "$uid/list", 'My Visual Novel List'; br;
+ a href => "$uid/votes",'My Votes'; br;
+ a href => "$uid/wish", 'My Wishlist'; br;
+ a href => "$uid/notifies", $nc ? (class => 'notifyget') : (), 'My Notifications'.($nc?" ($nc)":''); br;
+ a href => "$uid/hist", 'My Recent Changes'; br;
+ a href => '/g/links?u='.$self->authInfo->{id}, 'My Tags'; br;
br;
if($self->authCan('edit')) {
- a href => '/v/add', mt '_menu_addvn'; br;
- a href => '/p/new', mt '_menu_addproducer'; br;
- a href => '/s/new', mt '_menu_addstaff'; br;
- a href => '/c/new', mt '_menu_addcharacter'; br;
+ a href => '/v/add', 'Add Visual Novel'; br;
+ a href => '/p/new', 'Add Producer'; br;
+ a href => '/s/new', 'Add Staff'; br;
+ a href => '/c/new', 'Add Character'; br;
}
br;
- a href => "$uid/logout", mt '_menu_logout';
+ a href => "$uid/logout", 'Logout';
end;
} else {
- h2 mt '_menu_user';
+ h2 'User menu';
div;
my $ref = uri_escape $self->reqPath().$self->reqQuery();
- a href => "/u/login?ref=$ref", mt '_menu_login'; br;
- a href => '/u/newpass', mt '_menu_newpass'; br;
- a href => '/u/register', mt '_menu_register'; br;
+ a href => "/u/login?ref=$ref", 'Login'; br;
+ a href => '/u/newpass', 'Password reset'; br;
+ a href => '/u/register', 'Register'; br;
end;
}
end 'div'; # /menubox
div class => 'menubox';
- h2 mt '_menu_dbstats';
+ h2 'Database Statistics';
div;
dl;
- for (qw|vn releases producers chars staff tags traits users threads posts|) {
- dt mt "_menu_stat_$_";
- dd $self->{stats}{$_};
- }
+ dt 'Visual Novels'; dd $self->{stats}{vn};
+ dt 'Releases'; dd $self->{stats}{releases};
+ dt 'Producers'; dd $self->{stats}{producers};
+ dt 'Characters'; dd $self->{stats}{chars};
+ dt 'Staff'; dd $self->{stats}{staff};
+ dt 'VN Tags'; dd $self->{stats}{tags};
+ dt 'Character Traits';dd $self->{stats}{traits};
+ dt 'Users'; dd $self->{stats}{users};
+ dt 'Threads'; dd $self->{stats}{threads};
+ dt 'Posts'; dd $self->{stats}{posts};
end;
clearfloat;
end;
@@ -144,13 +150,13 @@ sub htmlFooter { # %options => { pref_code => 1 }
}
txt "vndb $self->{version} | ";
- a href => '/d7', mt '_footer_aboutus';
+ a href => '/d7', 'about us';
txt ' | ';
a href => 'irc://irc.synirc.net/vndb', '#vndb';
txt ' | ';
a href => "mailto:$self->{admin_email}", $self->{admin_email};
txt ' | ';
- a href => $self->{source_url}, mt '_footer_source';
+ a href => $self->{source_url}, 'source';
end;
end 'div'; # /maincontent