summaryrefslogtreecommitdiff
path: root/lib/VNDB/Util
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VNDB/Util')
-rw-r--r--lib/VNDB/Util/Auth.pm2
-rw-r--r--lib/VNDB/Util/CommonHTML.pm164
-rw-r--r--lib/VNDB/Util/FormHTML.pm132
-rw-r--r--lib/VNDB/Util/LayoutHTML.pm84
4 files changed, 158 insertions, 224 deletions
diff --git a/lib/VNDB/Util/Auth.pm b/lib/VNDB/Util/Auth.pm
index ad225d92..c4daffd9 100644
--- a/lib/VNDB/Util/Auth.pm
+++ b/lib/VNDB/Util/Auth.pm
@@ -83,7 +83,7 @@ sub authInfo {
sub authCan {
my($self, $act) = @_;
my $r = $self->{_auth}{rank}||0;
- return scalar grep $_ eq $act, @{$self->{user_ranks}[$r]}[1..$#{$self->{user_ranks}[$r]}];
+ return scalar grep $_ eq $act, @{$self->{user_ranks}[$r]}[0..$#{$self->{user_ranks}[$r]}];
}
diff --git a/lib/VNDB/Util/CommonHTML.pm b/lib/VNDB/Util/CommonHTML.pm
index 981edfe8..176f2960 100644
--- a/lib/VNDB/Util/CommonHTML.pm
+++ b/lib/VNDB/Util/CommonHTML.pm
@@ -29,48 +29,48 @@ sub htmlMainTabs {
ul class => 'maintabs';
if($type =~ /[uvrp]/) {
li $sel eq 'hist' ? (class => 'tabselected') : ();
- a href => "/$id/hist", 'history';
+ a href => "/$id/hist", mt '_mtabs_hist';
end;
}
if($type =~ /[uvp]/) {
my $cnt = $self->dbThreadCount($type, $obj->{id});
li $sel eq 'disc' ? (class => 'tabselected') : ();
- a href => "/t/$id", "discussions ($cnt)";
+ a href => "/t/$id", mt '_mtabs_discuss', $cnt;
end;
}
if($type eq 'u') {
li $sel eq 'posts' ? (class => 'tabselected') : ();
- a href => "/$id/posts", 'posts';
+ a href => "/$id/posts", mt '_mtabs_posts';
end;
}
- if($type eq 'u' && $obj->{show_list}) {
+ if($type eq 'u' && ($obj->{show_list} || $self->authCan('usermod'))) {
li $sel eq 'wish' ? (class => 'tabselected') : ();
- a href => "/$id/wish", 'wishlist';
+ a href => "/$id/wish", mt '_mtabs_wishlist';
end;
li $sel eq 'list' ? (class => 'tabselected') : ();
- a href => "/$id/list", 'list';
+ a href => "/$id/list", mt '_mtabs_list';
end;
}
if($type eq 'u') {
li $sel eq 'tags' ? (class => 'tabselected') : ();
- a href => "/$id/tags", 'tags';
+ a href => "/$id/tags", mt '_mtabs_tags';
end;
}
if($type eq 'v' && $self->authCan('tag') && !$obj->{hidden}) {
li $sel eq 'tagmod' ? (class => 'tabselected') : ();
- a href => "/$id/tagmod", 'modify tags';
+ a href => "/$id/tagmod", mt '_mtabs_tagmod';
end;
}
if($type eq 'r' && $self->authCan('edit')) {
li $sel eq 'copy' ? (class => 'tabselected') : ();
- a href => "/$id/copy", 'copy';
+ a href => "/$id/copy", mt '_mtabs_copy';
end;
}
@@ -79,31 +79,31 @@ sub htmlMainTabs {
|| $type eq 'g' && $self->authCan('tagmod')
) {
li $sel eq 'edit' ? (class => 'tabselected') : ();
- a href => "/$id/edit", 'edit';
+ a href => "/$id/edit", mt '_mtabs_edit';
end;
}
if($type =~ /[vrp]/ && $self->authCan('del')) {
li;
- a href => "/$id/hide", $obj->{hidden} ? 'unhide' : 'hide';
+ a href => "/$id/hide", mt $obj->{hidden} ? '_mtabs_unhide' : '_mtabs_hide';
end;
}
if($type =~ /[vrp]/ && $self->authCan('lock')) {
li;
- a href => "/$id/lock", $obj->{locked} ? 'unlock' : 'lock';
+ a href => "/$id/lock", mt $obj->{locked} ? '_mtabs_unlock' : '_mtabs_lock';
end;
}
if($type eq 'u' && $self->authCan('usermod')) {
li $sel eq 'del' ? (class => 'tabselected') : ();
- a href => "/$id/del", 'del';
+ a href => "/$id/del", mt '_mtabs_del';
end;
}
if($type eq 'v' && $obj->{rgraph}) {
li $sel eq 'rg' ? (class => 'tabselected') : ();
- a href => "/$id/rg", 'relations';
+ a href => "/$id/rg", mt '_mtabs_relations';
end;
}
@@ -117,19 +117,16 @@ sub htmlMainTabs {
# generates a full error page, including header and footer
sub htmlDenied {
my $self = shift;
- $self->htmlHeader(title => 'Access Denied');
+ $self->htmlHeader(title => mt '_denied_title');
div class => 'mainbox';
- h1 'Access Denied';
+ h1 mt '_denied_title';
div class => 'warning';
if(!$self->authInfo->{id}) {
- 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;
+ h2 mt '_denied_needlogin_title';
+ p; lit mt '_denied_needlogin_msg'; end;
} else {
- 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...';
+ h2 mt '_denied_noaccess_title';
+ p mt '_denied_noaccess_msg';
}
end;
end;
@@ -147,10 +144,9 @@ sub htmlHiddenMessage {
div class => 'mainbox';
h1 $obj->{title}||$obj->{name};
div class => 'warning';
- h2 'Item deleted';
+ h2 mt '_hiddenmsg_title';
p;
- lit qq|This item has been deleted from the database, File a request on the|
- .qq| <a href="/t/$board">discussion board</a> to undelete this page.|;
+ lit mt '_hiddenmsg_msg', "/t/$board";
end;
end;
end;
@@ -240,12 +236,12 @@ sub htmlBrowseNavigate {
ul class => 'maintabs ' . ($al eq 't' ? 'notfirst' : 'bottom');
if($p > 1) {
li class => 'left';
- a href => $url.($p-1), '<- previous';
+ a href => $url.($p-1), '<- '.mt '_browse_previous';
end;
}
if($np) {
li;
- a href => $url.($p+1), 'next ->';
+ a href => $url.($p+1), mt('_browse_next').' ->';
end;
}
end;
@@ -265,12 +261,12 @@ sub htmlBrowseNavigate {
sub htmlRevision {
my($self, $type, $old, $new, @fields) = @_;
div class => 'mainbox revision';
- h1 'Revision '.$new->{rev};
+ h1 mt '_revision_title', $new->{rev};
# previous/next revision links
- a class => 'prev', href => sprintf('/%s%d.%d', $type, $new->{id}, $new->{rev}-1), '<- earlier revision'
+ 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), 'later revision ->'
+ a class => 'next', href => sprintf('/%s%d.%d', $type, $new->{id}, $new->{rev}+1), mt('_revision_next').' ->'
if $new->{cid} != $new->{latest};
p class => 'center';
a href => "/$type$new->{id}", "$type$new->{id}";
@@ -279,11 +275,11 @@ sub htmlRevision {
# no previous revision, just show info about the revision itself
if(!$old) {
div;
- revheader($type, $new);
+ revheader($self, $type, $new);
br;
- b 'Edit summary:';
+ b mt '_revision_new_summary';
br; br;
- lit bb2html($new->{comments})||'[no summary]';
+ lit bb2html($new->{comments})||'-';
end;
}
@@ -293,40 +289,37 @@ sub htmlRevision {
thead;
Tr;
td; lit '&nbsp;'; end;
- td; revheader($type, $old); end;
- td; revheader($type, $new); end;
+ td; revheader($self, $type, $old); end;
+ td; revheader($self, $type, $new); end;
end;
Tr;
td; lit '&nbsp;'; end;
td colspan => 2;
- b 'Edit summary of revision '.$new->{rev}.':';
+ b mt '_revision_edit_summary', $new->{rev};
br; br;
- lit bb2html($new->{comments})||'[no summary]';
+ lit bb2html($new->{comments})||'-';
end;
end;
end;
my $i = 1;
- revdiff(\$i, $old, $new, @$_) for (@fields);
+ revdiff(\$i, $type, $old, $new, @$_) for (@fields);
end;
}
end;
}
sub revheader { # type, obj
- my($type, $obj) = @_;
- b 'Revision '.$obj->{rev};
+ my($self, $type, $obj) = @_;
+ b mt '_revision_title', $obj->{rev};
txt ' (';
- a href => "/$type$obj->{id}.$obj->{rev}/edit", 'edit';
+ a href => "/$type$obj->{id}.$obj->{rev}/edit", mt '_mtabs_edit';
txt ')';
br;
- txt 'By ';
- lit userstr($obj);
- txt ' on ';
- lit date $obj->{added}, 'full';
+ lit mt '_revision_user_date', $obj, $obj->{added};
}
sub revdiff {
- my($i, $old, $new, $short, $name, %o) = @_;
+ my($i, $type, $old, $new, $short, %o) = @_;
$o{serialize} ||= $o{htmlize};
$o{diff}++ if $o{split};
@@ -358,11 +351,11 @@ sub revdiff {
$ser2 = xml_escape $ser2;
}
- $ser1 = '[empty]' if !$ser1 && $ser1 ne '0';
- $ser2 = '[empty]' if !$ser2 && $ser2 ne '0';
+ $ser1 = mt '_revision_emptyfield' if !$ser1 && $ser1 ne '0';
+ $ser2 = mt '_revision_emptyfield' if !$ser2 && $ser2 ne '0';
Tr $$i++ % 2 ? (class => 'odd') : ();
- td $name;
+ td mt "_revfield_${type}_$short";
td class => 'tcval'; lit $ser1; end;
td class => 'tcval'; lit $ser2; end;
end;
@@ -372,38 +365,36 @@ sub revdiff {
# Generates a generic message to show as the header of the edit forms
# Arguments: v/r/p, obj
sub htmlEditMessage {
- my($self, $type, $obj, $copy) = @_;
- my $full = {v => 'visual novel', r => 'release', p => 'producer'}->{$type};
+ my($self, $type, $obj, $title, $copy) = @_;
+ my $num = {v => 0, r => 1, p => 2}->{$type};
my $guidelines = {v => 2, r => 3, p => 4}->{$type};
div class => 'mainbox';
- h1 $obj ? ''.($copy ? 'Copy ':'Edit ').($obj->{name}||$obj->{title}) : "Add new $full";
+ h1 $title;
if($copy) {
div class => 'warning';
- h2 "You're not editing a release!";
+ h2 mt '_editmsg_copy_title';
p;
- txt "You're about to insert a new release into the database with information based on ";
- a href => "/$type$obj->{id}", $obj->{title};
- txt ". Hit the 'edit' tab on the right-top if you intended to edit the release instead of creating a new one.";
+ lit mt '_editmsg_copy_msg', sprintf '<a href="/%s%d">%s</a>', $type, $obj->{id}, xml_escape $obj->{title},
end;
end;
}
div class => 'notice';
- h2 'Before editing:';
+ h2 mt '_editmsg_msg_title';
ul;
- li; lit qq|Read the <a href="/d$guidelines">guidelines</a>!|; end;
+ li; lit mt '_editmsg_msg_guidelines', "/d$guidelines"; end;
if($obj) {
- li; lit qq|Check for any existing discussions on the <a href="/t/$type$obj->{id}">discussion board</a>|; end;
- li; lit qq|Browse the <a href="/$type$obj->{id}/hist">edit history</a> for any recent changes related to what you want to change.|; end;
+ li; lit mt '_editmsg_msg_discuss', $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;
} elsif($type ne 'r') {
- li; lit qq|<a href="/$type/all">Search the database</a> to see if we already have information about this $full|; end;
+ li; lit mt '_editmsg_msg_search', "/$type/all", $num; end;
}
end;
end;
if($obj && $obj->{latest} != $obj->{cid}) {
div class => 'warning';
- h2 'Reverting';
- p qq|You are editing an old revision of this $full. If you save it, all changes made after this revision will be reverted!|;
+ h2 mt '_editmsg_revert_title';
+ p mt '_editmsg_revert_msg', $num;
end;
}
end;
@@ -417,13 +408,13 @@ sub htmlItemMessage {
my($self, $type, $obj) = @_;
if($obj->{locked}) {
- p class => 'locked', 'Locked for editing'
+ p class => 'locked', mt '_itemmsg_locked';
} elsif(!$self->authInfo->{id}) {
p class => 'locked';
- lit 'You need to be <a href="/u/login">logged in</a> to edit this page';
+ lit mt '_itemmsg_login', '/u/login';
end;
} elsif(!$self->authCan('edit')) {
- p class => 'locked', "You're not allowed to edit this page";
+ p class => 'locked', mt '_itemmsg_denied';
}
}
@@ -441,11 +432,11 @@ sub htmlVoteStats {
div class => 'votestats';
table class => 'votegraph';
thead; Tr;
- td colspan => 2, 'Vote graph';
+ td colspan => 2, mt '_votestats_title';
end; end;
tfoot; Tr;
- td colspan => 2, sprintf '%d vote%s total, average %.2f%s', $count, $count != 1 ? 's' : '', $total/$count,
- $type eq 'v' ? ' ('.$self->{votes}[ceil($total/$count-1)].')' : '';
+ td colspan => 2, mt('_votestats_sum', $count, sprintf('%.2f', $total/$count))
+ .($type eq 'v' ? ' ('.mt('_vote_'.ceil($total/$count-1)).')' : '');
end; end;
for (reverse 0..$#$stats) {
Tr;
@@ -464,11 +455,12 @@ sub htmlVoteStats {
order => 'date DESC',
what => $type eq 'v' ? 'user' : 'vn',
hide => $type eq 'v',
+ hide_ign => $type eq 'v',
);
if(@$recent) {
table class => 'recentvotes';
thead; Tr;
- td colspan => 3, 'Recent votes';
+ td colspan => 3, mt '_votestats_recent';
end; end;
for (0..$#$recent) {
Tr $_ % 2 == 0 ? (class => 'odd') : ();
@@ -480,7 +472,7 @@ sub htmlVoteStats {
}
end;
td $recent->[$_]{vote};
- td date $recent->[$_]{date};
+ td $self->{l10n}->date($recent->[$_]{date});
end;
}
end;
@@ -489,8 +481,8 @@ sub htmlVoteStats {
clearfloat;
if($type eq 'v') {
div;
- h3 'Popularity';
- p sprintf 'Ranked #%d out of %d with a score of %.2f.', $obj->{ranking}, $self->{stats}{vn}, $obj->{c_popularity}*100;
+ h3 mt '_votestats_pop_title';
+ p mt '_votestats_pop_sum', $obj->{ranking}, $self->{stats}{vn}, sprintf('%0.2f',$obj->{c_popularity}*100);
end;
}
end;
@@ -506,10 +498,10 @@ sub htmlHistory {
pageurl => $url,
class => 'history',
header => [
- sub { td colspan => 2, class => 'tc1', 'Rev.' },
- [ 'Date' ],
- [ 'User' ],
- sub { td; a href => '#', id => 'history_comments', 'expand'; txt 'Page'; end; }
+ sub { td colspan => 2, class => 'tc1', mt '_hist_col_rev' },
+ [ mt '_hist_col_date' ],
+ [ mt '_hist_col_user' ],
+ sub { td; a href => '#', id => 'history_comments', 'expand'; txt mt '_hist_col_page'; end; }
],
row => sub {
my($s, $n, $i) = @_;
@@ -523,9 +515,9 @@ sub htmlHistory {
td class => 'tc1_2';
a href => $revurl, ".$i->{rev}";
end;
- td class => 'tc2', date $i->{added};
+ td class => 'tc2', $self->{l10n}->date($i->{added});
td class => 'tc3';
- lit userstr($i);
+ lit $self->{l10n}->userstr($i);
end;
td;
a href => $revurl, title => $i->{ioriginal}, shorten $i->{ititle}, 80;
@@ -548,14 +540,14 @@ sub htmlSearchBox {
fieldset class => 'search';
p class => 'searchtabs';
- 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 => '/g', $sel eq 'g' ? (class => 'sel') : (), 'Tags';
- a href => '/u/all', $sel eq 'u' ? (class => 'sel') : (), 'Users';
+ 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 => '/g', $sel eq 'g' ? (class => 'sel') : (), mt '_searchbox_tags';
+ a href => '/u/all', $sel eq 'u' ? (class => 'sel') : (), mt '_searchbox_users';
end;
input type => 'text', name => 'q', id => 'q', class => 'text', value => $v;
- input type => 'submit', class => 'submit', value => 'Search!';
+ input type => 'submit', class => 'submit', value => mt '_searchbox_submit';
end;
}
diff --git a/lib/VNDB/Util/FormHTML.pm b/lib/VNDB/Util/FormHTML.pm
index f8047c4c..2882b4c4 100644
--- a/lib/VNDB/Util/FormHTML.pm
+++ b/lib/VNDB/Util/FormHTML.pm
@@ -6,58 +6,11 @@ use warnings;
use YAWF ':html';
use Exporter 'import';
use POSIX 'strftime';
+use VNDB::Func;
our @EXPORT = qw| htmlFormError htmlFormPart htmlForm |;
-# form error messages
-my %formerr_names = (
- alias => 'Aliases',
- anime => 'Anime',
- desc => 'Description',
- description => 'Description',
- editsum => 'Edit summary',
- gtin => 'JAN/EAN/UPC',
- lang => 'Language',
- language => 'Language',
- length => 'Length',
- l_wp => 'Wikipedia link',
- l_encubed => 'Novelnews link',
- l_renai => 'Renai.us link',
- l_vnn => 'V-N.net link',
- mail => 'Email',
- media => 'Media',
- minage => 'Age rating',
- msg => 'Message',
- name => 'Name',
- notes => 'Notes',
- original => 'Original',
- platforms => 'Platforms',
- producers => 'Producers',
- released => 'Release date',
- boards => 'Boards',
- title => 'Title',
- type => 'Type',
- usrname => 'Username',
- usrpass => 'Password',
- usrpass2 => 'Password (confirm)',
- vn => 'Visual novels',
- website => 'Website',
-);
-my %formerr_exeptions = (
- login_failed => 'Invalid username or password',
- nomail => 'No user found with that email address',
- passmatch => 'Passwords do not match',
- usrexists => 'Someone already has this username, please choose something else',
- mailexists => 'Someone already registered with that email address',
- noimage => 'Image must be in JPEG or PNG format',
- toolarge => 'Image is too large, only 500kB allowed',
- oneaday => 'You can only register one account from the same IP within 24 hours',
- nochanges => 'No changes, please don\'t create an entry that is fully -identical- to another',
- doublepost => 'Please wait 30 seconds before making another post',
-);
-
-
# Displays friendly error message when form validation failed
# Argument is the return value of formValidate, and an optional
# argument indicating whether we should create a special mainbox
@@ -67,40 +20,25 @@ sub htmlFormError {
return if !$frm->{_err};
if($mainbox) {
div class => 'mainbox';
- h1 'Error';
+ h1 mt '_formerr_title';
}
div class => 'warning';
- h2 'Form could not be sent:';
+ h2 mt '_formerr_subtitle';
ul;
for my $e (@{$frm->{_err}}) {
if(!ref $e) {
- li $formerr_exeptions{$e};
+ li mt '_formerr_e_'.$e;
next;
}
my($field, $type, $rule) = @$e;
- $field = $formerr_names{$field}||$field;
- li sprintf '%s is a required field!', $field if $type eq 'required';
- li sprintf '%s should have at least %d characters', $field, $rule if $type eq 'minlength';
- li sprintf '%s: only %d characters allowed', $field, $rule if $type eq 'maxlength';
- li sprintf '%s must be one of the following: %s', $field, join ', ', @$rule if $type eq 'enum';
- li sprintf 'Wrong board: %s', $rule if $type eq 'wrongboard';
- if($type eq 'tagexists') {
- li;
- lit $rule->{state} != 1 ? qq|Tag <a href="/g$rule->{id}">$rule->{name}</a> already exists!|
- : qq|A tag <a href="/g$rule->{id}">with the same name</a> has been deleted in the past,|
- .qq| please use <a href="/t/db">the discussion board</a> if you want it to be re-added.|;
- end;
- }
+ li mt '_formerr_required', $field if $type eq 'required';
+ 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_tagexists', "/g$rule->{id}", $rule->{name} if $type eq 'tagexists';
li $rule->[1] if $type eq 'func' || $type eq 'regex';
- if($type eq 'template') {
- li sprintf
- $rule eq 'mail' ? 'Invalid email address' :
- $rule eq 'url' ? '%s: Invalid URL' :
- $rule eq 'asciiprint' ? '%s may only contain ASCII characters' :
- $rule eq 'int' ? '%s: Not a valid number' :
- $rule eq 'pname' ? '%s can only contain lowercase alphanumberic characters and a hyphen, and must start with a character' : '',
- $field;
- }
+ li mt "_formerr_tpl_$rule", $field if $type eq 'template';
}
end;
end;
@@ -246,21 +184,20 @@ sub htmlForm {
if(@subs > 2) {
ul class => 'maintabs notfirst', id => 'jt_select';
for (0..$#subs/2) {
- (my $short = lc $subs[$_*2]) =~ s/[^\w\d]+/_/g;
li class => 'left';
- a href => "#$short", id => "jt_sel_$short", $subs[$_*2];
+ a href => "#$subs[$_*2]", id => "jt_sel_$subs[$_*2]", $subs[$_*2+1][0];
end;
}
li class => 'left';
- a href => '#all', id => 'jt_sel_all', 'All items';
+ a href => '#all', id => 'jt_sel_all', mt '_form_tab_all';
end;
end;
}
# form subs
- while(my($name, $parts) = (shift(@subs), shift(@subs))) {
- last if !$name || !$parts;
- (my $short = lc $name) =~ s/[^\w\d]+/_/g;
+ while(my($short, $parts) = (shift(@subs), shift(@subs))) {
+ last if !$short || !$parts;
+ my $name = shift @$parts;
div class => 'mainbox', id => 'jt_box_'.$short;
h1 $name;
fieldset;
@@ -273,23 +210,26 @@ sub htmlForm {
}
# edit summary / submit button
- div class => 'mainbox';
- fieldset class => 'submit';
- if($options->{editsum}) {
- (my $txt = $options->{frm}{editsum}||'') =~ s/&/&amp;/;
- $txt =~ s/</&lt;/;
- $txt =~ s/>/&gt;/;
- h2 'Edit summary';
- textarea name => 'editsum', id => 'editsum', rows => 4, cols => 50;
- lit $txt;
- end;
- br;
- }
- b "Don't forget! -> " if $options->{hitsubmit};
- input type => 'submit', value => 'Submit', class => 'submit';
- b ' <-' if $options->{hitsubmit};
- end;
- end;
+ if(!$options->{nosubmit}) {
+ div class => 'mainbox';
+ fieldset class => 'submit';
+ if($options->{editsum}) {
+ (my $txt = $options->{frm}{editsum}||'') =~ s/&/&amp;/;
+ $txt =~ s/</&lt;/;
+ $txt =~ s/>/&gt;/;
+ h2;
+ txt mt '_form_editsum';
+ b class => 'standout', ' ('.mt('_inenglish').')';
+ end;
+ textarea name => 'editsum', id => 'editsum', rows => 4, cols => 50;
+ lit $txt;
+ end;
+ br;
+ }
+ input type => 'submit', value => mt('_form_submit'), class => 'submit';
+ end;
+ end;
+ }
end;
}
diff --git a/lib/VNDB/Util/LayoutHTML.pm b/lib/VNDB/Util/LayoutHTML.pm
index b5813330..85971ba9 100644
--- a/lib/VNDB/Util/LayoutHTML.pm
+++ b/lib/VNDB/Util/LayoutHTML.pm
@@ -38,7 +38,7 @@ sub htmlHeader { # %options->{ title, js, noindex, search }
div id => 'bgright', ' ';
div id => 'header';
h1;
- a href => '/', lc $self->{site_title};
+ a href => '/', lc mt '_site_title';
end;
end;
@@ -54,24 +54,34 @@ sub _menu {
div id => 'menulist';
div class => 'menubox';
- h2 'Menu';
+ h2;
+ span;
+ for (grep $self->{l10n}->language_tag() ne $_, $self->{l10n}->languages()) {
+ a href => "?l10n=$_";
+ cssicon "lang $_", mt "_lang_$_"; # NOTE: should actually be in the destination language...
+ end;
+ }
+ end;
+ txt mt '_menu';
+ end;
div;
- a href => '/', 'Home'; br;
- a href => '/v/all', 'Visual novels'; br;
- a href => '/r', 'Releases'; br;
- a href => '/p/all', 'Producers'; br;
- a href => '/g', 'Tags'; 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 => '/', mt '_menu_home'; br;
+ a href => '/v/all', mt '_menu_vn'; br;
+ a href => '/r', mt '_menu_releases'; br;
+ a href => '/p/all', mt '_menu_producers'; br;
+ a href => '/g', mt '_menu_tags'; 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'; br;
a href => 'irc://irc.synirc.net/vndb', '#vndb';
- lit ' (<a href="http://cgiirc.synirc.net/?chan=%23vndb">webchat</a>)';
+ lit ' (<a href="http://cgiirc.synirc.net/?chan=%23vndb">'.mt('_menu_webchat').'</a>)';
end;
form action => '/v/all', method => 'get', id => 'search';
fieldset;
legend 'Search';
- input type => 'text', class => 'text', id => 'sq', name => 'sq', value => $o{search}||'search';
+ input type => 'text', class => 'text', id => 'sq', name => 'sq', value => $o{search}||mt('_menu_emptysearch');
input type => 'submit', class => 'submit', value => 'Search';
end;
end;
@@ -82,24 +92,25 @@ sub _menu {
my $uid = sprintf '/u%d', $self->authInfo->{id};
h2;
a href => $uid, ucfirst $self->authInfo->{username};
- txt ' ('.$self->{user_ranks}[$self->authInfo->{rank}][0].')';
+ # note: user ranks aren't TL'ed (but might be in the future, hmm)
+ txt ' ('.mt('_urank_'.$self->authInfo->{rank}).')';
end;
div;
- a href => "$uid/edit", 'My Profile'; br;
- a href => "$uid/list", 'My Visual Novel List'; br;
- a href => "$uid/wish", 'My Wishlist'; br;
- a href => "/t$uid", sprintf 'My Messages (%d)', $self->authInfo->{mymessages}; br;
- a href => "$uid/hist", 'My Recent Changes'; br;
- a href => "$uid/tags", 'My Tags'; br;
+ a href => "$uid/edit", mt '_menu_myprofile'; br;
+ a href => "$uid/list", mt '_menu_myvnlist'; br;
+ a href => "$uid/wish", mt '_menu_mywishlist'; br;
+ a href => "/t$uid", mt '_menu_mymessages', $self->authInfo->{mymessages}; br;
+ a href => "$uid/hist", mt '_menu_mychanges'; br;
+ a href => "$uid/tags", mt '_menu_mytags'; br;
br;
- a href => '/v/new', 'Add Visual Novel'; br;
- a href => '/p/new', 'Add Producer'; br;
+ a href => '/v/new', mt '_menu_addvn'; br;
+ a href => '/p/new', mt '_menu_addproducer'; br;
br;
- a href => '/u/logout', 'Logout';
+ a href => '/u/logout', mt '_menu_logout';
end;
} else {
h2;
- a href => '/u/login', 'Login';
+ a href => '/u/login', mt '_menu_login';
end;
div;
form action => '/nospam?/u/login', id => 'loginform', method => 'post';
@@ -107,32 +118,23 @@ sub _menu {
legend 'Login';
input type => 'text', class => 'text', id => 'username', name => 'usrname';
input type => 'password', class => 'text', id => 'userpass', name => 'usrpass';
- input type => 'submit', class => 'submit', value => 'Login';
+ input type => 'submit', class => 'submit', value => mt '_menu_login';
end;
end;
p;
- lit 'Need to <a href="/u/register">register</a>,<br />';
- lit 'or <a href="/u/newpass">forgot your password?</a>';
+ lit mt '_menu_loginmsg', '/u/register', '/u/newpass';
end;
end;
}
end;
- my @stats = (
- [ vn => 'Visual Novels' ],
- [ releases => 'Releases' ],
- [ producers => 'Producers' ],
- [ users => 'Users' ],
- [ threads => 'Threads' ],
- [ posts => 'Posts' ],
- );
div class => 'menubox';
- h2 'Database Statistics';
+ h2 mt '_menu_dbstats';
div;
dl;
- for (@stats) {
- dt $$_[1];
- dd $self->{stats}{$$_[0]};
+ for (qw|vn releases producers users threads posts|) {
+ dt mt "_menu_stat_$_";
+ dd $self->{stats}{$_};
}
end;
clearfloat;
@@ -154,11 +156,11 @@ sub htmlFooter {
}
txt "vndb $self->{version} | ";
- a href => '/d7', 'about us';
+ a href => '/d7', mt '_footer_aboutus';
txt ' | ';
a href => "mailto:$self->{admin_email}", $self->{admin_email};
txt ' | ';
- a href => $self->{source_url}, 'source';
+ a href => $self->{source_url}, mt '_footer_source';
end;
end; # /div maincontent
end; # /body