summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/lang.txt322
-rw-r--r--lib/VNDB/Handler/Users.pm213
2 files changed, 410 insertions, 125 deletions
diff --git a/data/lang.txt b/data/lang.txt
index 5a62e50b..520f13e2 100644
--- a/data/lang.txt
+++ b/data/lang.txt
@@ -2058,6 +2058,328 @@ ru*:
#############################################################################
+## User pages ##
+#############################################################################
+# Util::Users
+
+
+# User page (/u+)
+
+:_userpage_title
+en : [_1]'s profile
+ru*:
+
+:_userpage_username
+en : Username
+ru*:
+
+:_userpage_registered
+en : Registered
+ru*:
+
+:_userpage_edits
+en : Edits
+ru*:
+
+:_userpage_votes
+en : Votes
+ru*:
+
+:_userpage_votes_item
+en : [url,_1,_2] ([_3] average)
+ru*:
+
+:_userpage_hidden
+en : hidden
+ru*:
+
+:_userpage_tags
+en : Tags
+ru*:
+
+:_userpage_tags_item
+en : [_1] [quant,_1,vote,votes] on [_2] distinct [quant,_2,tag,tags] and [_3] visual [quant,_3,novel,novels]
+ru*:
+
+:_userpage_list
+en : List stats
+ru*:
+
+:_userpage_list_item
+en : [_1] [quant,_1,release,releases] of [_2] visual [quant,_2,novel,novels]
+ru*:
+
+:_userpage_forum
+en : Forum stats
+ru*:
+
+:_userpage_forum_item
+en : [_1] [quant,_1,post,posts], [_2] new [quant,_2,thead,threads].
+ru*:
+
+:_userpage_forum_browse
+en : Browse posts
+ru*:
+
+:_userpage_votestats
+en : Vote statistics
+ru*:
+
+:_userpage_changes
+en : Recent changes
+ru*:
+
+
+# Login form (/u/login)
+
+:_login_title
+en : Login
+ru*:
+
+:_login_username
+en : Username
+ru*:
+
+:_login_register
+en : No account yet?
+ru*:
+
+:_login_password
+en : Password
+ru*:
+
+:_login_forgotpass
+en : Forgot your password?
+ru*:
+
+
+# Reset password (/u/newpass)
+
+:_newpass_mail_body
+en : Hello [_1]
+
+ Your password has been reset, you can now login at http://vndb.org/ with the
+ following information:
+
+ Username: [_1]
+ Password: [_2]
+
+ Now don't forget your password again! :-)
+
+ vndb.org
+ru*:
+
+:_newpass_mail_subject
+en : New password for [_1]
+ru*:
+
+:_newpass_title
+en : Forgot password
+ru*:
+
+:_newpass_msg
+en : Forgot your password and can't login to VNDB anymore?
+ Don't worry! Just give us the email address you used to register on VNDB,
+ and we'll send you a new password within a few minutes!
+ru*:
+
+:_newpass_reset_title
+en : Reset password
+ru*:
+
+:_newpass_mail
+en : Email
+ru*:
+
+:_newpass_sent_title
+en : New password
+ru*:
+
+:_newpass_sent_subtitle
+en : Password reset
+ru*:
+
+:_newpass_sent_msg
+en : Your password has been reset and your new password should reach your mailbox in a few minutes.[br]
+ You can always change your password again after logging in.[br]
+ [br]
+ [url,/u/login,Login] - [url,/,Home]
+ru*:
+
+
+# Register new account (/u/register)
+
+:_register_title
+en : Create an account
+ru*:
+
+:_register_why
+en : Why should I register?
+ru*:
+
+:_register_why_msg
+en : Creating an account is completely painless, the only thing we need to know is your prefered username
+ and a password. You can just use any email address that isn't yours, as we don't even confirm
+ that the address you gave us is really yours. Keep in mind, however, that you would probably
+ want to remember your password if you do choose to give us an invalid email address...[br]
+ [br]
+ Anyway, having an account here has a few advantages over being just a regular visitor[br]
+ - You can contribute to the database by editing any entries and adding new ones[br]
+ - Keep track of all visual novels and releases you have, you'd like to play, are playing, or have finished playing[br]
+ - Vote on the visual novels you liked or disliked[br]
+ - Contribute to the discussions on the boards
+ru*:
+
+:_register_form_title
+en : New account
+ru*:
+
+:_register_username
+en : Username
+ru*:
+
+:_register_username_msg
+en : Requested username. Must be lowercase and can only consist of alphanumeric characters.
+ru*:
+
+:_register_mail
+en : Email
+ru*:
+
+:_register_mail_msg
+en : Your email address will only be used in case you lose your password. We will never send
+ spam or newsletters unless you explicitly ask us for it.
+ru*:
+
+:_register_password
+en : Password
+ru*:
+
+:_register_confirm
+en : Confirm password
+ru*:
+
+
+# User edit (/u+/edit)
+
+:_usere_title
+en : My account
+ru*:
+
+:_usere_saved_title
+en : Settings saved
+ru*:
+
+:_usere_saved_msg
+en : Settings successfully saved.
+ru*:
+
+:_usere_geninfo
+en : General info
+ru*:
+
+:_usere_username
+en : Username
+ru*:
+
+:_usere_rank
+en : Rank
+ru*:
+
+:_usere_ignvotes
+en : Ignore votes in VN statistics
+ru*:
+
+:_usere_mail
+en : Email
+ru*:
+
+:_usere_changepass
+en : Change password
+ru*:
+
+:_usere_changepass_msg
+en : Leave blank to keep your current password
+ru*:
+
+:_usere_password
+en : Password
+ru*:
+
+:_usere_confirm
+en : Confirm password
+ru*:
+
+:_usere_options
+en : Options
+ru*:
+
+:_usere_flist
+en : Allow other people to see my visual novel list ([url,_1,_1]) and wishlist ([url,_2,_2])
+ru*:
+
+:_usere_fnsfw
+en : Disable warnings for images that are not safe for work.
+ru*:
+
+:_usere_skin
+en : Prefered skin
+ru*:
+
+:_usere_css
+en : Additional [url,http://en.wikipedia.org/wiki/Cascading_Style_Sheets,CSS]
+ru*:
+
+
+# Users posts (/u+/posts)
+
+:_uposts_title
+en : Posts made by [_1]
+ru*:
+
+:_uposts_noresults
+en : [_1] hasn't made any posts yet.
+ru*:
+
+:_uposts_col_date
+en : Date
+ru*:
+
+:_uposts_col_title
+en : Title
+ru*:
+
+
+# User list (/u/all)
+
+:_ulist_title
+en : Browse users
+ru*:
+
+:_ulist_col_username
+en : Username
+ru*:
+
+:_ulist_col_registered
+en : Registered
+ru*:
+
+:_ulist_col_votes
+en : Votes
+ru*:
+
+:_ulist_col_edits
+en : Edits
+ru*:
+
+:_ulist_col_tags
+en : Tags
+ru*:
+
+
+
+
+#############################################################################
## Misc. messages ##
#############################################################################
# Util::CommonHTML::htmlDenied,
diff --git a/lib/VNDB/Handler/Users.pm b/lib/VNDB/Handler/Users.pm
index ff1d9695..2e1250bc 100644
--- a/lib/VNDB/Handler/Users.pm
+++ b/lib/VNDB/Handler/Users.pm
@@ -29,20 +29,17 @@ sub userpage {
my $votes = $u->{c_votes} && $self->dbVoteStats(uid => $uid);
- $self->htmlHeader(title => ucfirst($u->{username})."'s profile");
+ my $title = mt '_userpage_title', $u->{username};
+ $self->htmlHeader(title => $title);
$self->htmlMainTabs('u', $u);
div class => 'mainbox userpage';
- h1 ucfirst($u->{username})."'s profile";
+ h1 $title;
table;
- Tr;
- td class => 'key', ' ';
- td ' ';
- end;
- my $i = 0;
+ my $i = 1;
- Tr ++$i % 2 ? (class => 'odd') : ();
- td 'Username';
+ Tr class => 'key odd';
+ td mt '_userpage_username';
td;
txt ucfirst($u->{username}).' (';
a href => "/u$uid", "u$uid";
@@ -51,12 +48,12 @@ sub userpage {
end;
Tr ++$i % 2 ? (class => 'odd') : ();
- td 'Registered';
+ td mt '_userpage_registered';
td $self->{l10n}->date($u->{registered});
end;
Tr ++$i % 2 ? (class => 'odd') : ();
- td 'Edits';
+ td mt '_userpage_edits';
td;
if($u->{c_changes}) {
a href => "/u$uid/hist", $u->{c_changes};
@@ -67,18 +64,17 @@ sub userpage {
end;
Tr ++$i % 2 ? (class => 'odd') : ();
- td 'Votes';
+ td mt '_userpage_votes';
td;
if(!$u->{show_list}) {
- txt 'hidden';
+ txt mt '_userpage_hidden';
} elsif($votes) {
my($total, $count) = (0, 0);
for (1..@$votes) {
$total += $_*$votes->[$_-1];
$count += $votes->[$_-1];
}
- a href => "/u$uid/list?v=1", $count;
- txt sprintf ' (%.2f average)', $total/$count;
+ lit mt '_userpage_votes_item', "/u$uid/list?v=1", $count, sprintf '%.2f', $total/$count;
} else {
txt '-';
}
@@ -86,27 +82,23 @@ sub userpage {
end;
Tr ++$i % 2 ? (class => 'odd') : ();
- td 'Tags';
- td !$u->{c_tags} ? '-' : sprintf '%d votes on %d distinct tags and %d visual novels',
- $u->{c_tags}, $u->{tagcount}, $u->{tagvncount};
+ td mt '_userpage_tags';
+ td !$u->{c_tags} ? '-' : mt '_userpage_tags_item', $u->{c_tags}, $u->{tagcount}, $u->{tagvncount};
end;
Tr ++$i % 2 ? (class => 'odd') : ();
- td 'List stats';
- td !$u->{show_list} ? 'hidden' :
- sprintf '%d release%s of %d visual novel%s',
- $u->{releasecount}, $u->{releasecount} != 1 ? 's' : '',
- $u->{vncount}, $u->{vncount} != 1 ? 's' : '';
+ td mt '_userpage_list';
+ td !$u->{show_list} ? mt('_userpage_hidden') :
+ mt('_userpage_list_item', $u->{releasecount}, $u->{vncount});
end;
Tr ++$i % 2 ? (class => 'odd') : ();
- td 'Forum stats';
+ td mt '_userpage_forum';
td;
- txt sprintf '%d post%s, %d new thread%s. ',
- $u->{postcount}, $u->{postcount} != 1 ? 's' : '',
- $u->{threadcount}, $u->{threadcount} != 1 ? 's' : '';
+ lit mt '_userpage_forum_item',$u->{postcount}, $u->{threadcount};
if($u->{postcount}) {
- a href => "/u$uid/posts"; lit 'Browse posts »'; end;
+ txt ' ';
+ a href => "/u$uid/posts"; lit mt('_userpage_forum_browse').' »'; end;
}
end;
end;
@@ -115,7 +107,7 @@ sub userpage {
if($u->{show_list} && $votes) {
div class => 'mainbox';
- h1 'Vote statistics';
+ h1 mt '_userpage_votestats';
$self->htmlVoteStats(u => $u, $votes);
end;
}
@@ -123,7 +115,7 @@ sub userpage {
if($u->{c_changes}) {
my $list = $self->dbRevisionGet(what => 'item user', uid => $uid, results => 5, hidden => 1);
h1 class => 'boxtitle';
- a href => "/u$uid/hist", 'Recent changes';
+ a href => "/u$uid/hist", mt '_userpage_changes';
end;
$self->htmlHistory($list, { p => 1 }, 0, "/u$uid/hist");
}
@@ -149,12 +141,12 @@ sub login {
$frm->{_err} = [ 'login_failed' ] if !$frm->{_err};
}
- $self->htmlHeader(title => 'Login', noindex => 1);
- $self->htmlForm({ frm => $frm, action => '/u/login' }, login => [ 'Login',
- [ input => name => 'Username', short => 'usrname' ],
- [ static => content => '<a href="/u/register">No account yet?</a>' ],
- [ passwd => name => 'Password', short => 'usrpass' ],
- [ static => content => '<a href="/u/newpass">Forgot your password?</a>' ],
+ $self->htmlHeader(noindex => 1, title => mt '_login_title');
+ $self->htmlForm({ frm => $frm, action => '/u/login' }, login => [ mt('_login_title'),
+ [ input => short => 'usrname', name => mt '_login_username' ],
+ [ static => content => '<a href="/u/register">'.mt('_login_register').'</a>' ],
+ [ passwd => short => 'usrpass', name => mt '_login_password' ],
+ [ static => content => '<a href="/u/newpass">'.mt('_login_forgotpass').'</a>' ],
]);
$self->htmlFooter;
}
@@ -185,38 +177,22 @@ sub newpass {
my %o;
($o{passwd}, $o{salt}) = $self->authPreparePass($pass);
$self->dbUserEdit($u->{id}, %o);
- my $body = <<'__';
-Hello %s,
-
-Your password has been reset, you can now login at http://vndb.org/ with the
-following information:
-
-Username: %1$s
-Password: %s
-
-Now don't forget your password again! :-)
-
-vndb.org
-__
- $self->mail(
- sprintf($body, $u->{username}, $pass),
+ $self->mail(mt('_newpass_mail_body', $u->{username}, $pass),
To => $u->{mail},
From => 'VNDB <noreply@vndb.org>',
- Subject => 'New password for '.$u->{username}
+ Subject => mt('_newpass_mail_subject', $u->{username}),
);
return $self->resRedirect('/u/newpass/sent', 'post');
}
}
- $self->htmlHeader(title => 'Forgot Password', noindex => 1);
+ $self->htmlHeader(title => mt('_newpass_title'), noindex => 1);
div class => 'mainbox';
- h1 'Forgot Password';
- p "Forgot your password and can't login to VNDB anymore?\n"
- ."Don't worry! Just give us the email address you used to register on VNDB,\n"
- ."and we'll send you a new password within a few minutes!";
+ h1 mt '_newpass_title';
+ p mt '_newpass_msg';
end;
- $self->htmlForm({ frm => $frm, action => '/u/newpass' }, newpass => [ 'Reset Password',
- [ input => name => 'Email', short => 'mail' ],
+ $self->htmlForm({ frm => $frm, action => '/u/newpass' }, newpass => [ mt('_newpass_reset_title'),
+ [ input => short => 'mail', name => mt '_newpass_mail' ],
]);
$self->htmlFooter;
}
@@ -225,15 +201,13 @@ __
sub newpass_sent {
my $self = shift;
return $self->resRedirect('/') if $self->authInfo->{id};
- $self->htmlHeader(title => 'New Password', noindex => 1);
+ $self->htmlHeader(title => mt('_newpass_sent_title'), noindex => 1);
div class => 'mainbox';
- h1 'New Password';
+ h1 mt '_newpass_sent_title';
div class => 'notice';
- h2 'Password Reset';
+ h2 mt '_newpass_sent_subtitle';
p;
- txt "Your password has been reset and your new password should reach your mailbox in a few minutes.\n"
- ."You can always change your password again after logging in.\n\n";
- lit '<a href="/u/login">Login</a> - <a href="/">Home</a>';
+ lit mt '_newpass_sent_msg';
end;
end;
end;
@@ -243,7 +217,7 @@ sub newpass_sent {
sub register {
my $self = shift;
- return $self->resRedirect('/') if $self->authInfo->{id};
+ #return $self->resRedirect('/') if $self->authInfo->{id};
my $frm;
if($self->reqMethod eq 'POST') {
@@ -265,33 +239,22 @@ sub register {
}
}
- $self->htmlHeader(title => 'Create an Account', noindex => 1);
+ $self->htmlHeader(title => mt('_register_title'), noindex => 1);
div class => 'mainbox';
- h1 'Create an Account';
- h2 'Why should I register?';
- p 'Creating an account is completely painless, the only thing we need to know is your prefered username '
- .'and a password. You can just use any email address that isn\'t yours, as we don\'t even confirm '
- .'that the address you gave us is really yours. Keep in mind, however, that you would probably '
- .'want to remember your password if you do choose to give us an invalid email address...';
-
- p 'Anyway, having an account here has a few advantages over being just a regular visitor:';
- ul;
- li 'You can contribute to the database by editing any entries and adding new ones';
- li 'Keep track of all visual novels and releases you have, you\'d like to play, are playing, or have finished playing';
- li 'Vote on the visual novels you liked or disliked';
- li 'Contribute to the discussions on the boards';
- li 'And boast about the fact that you have an account on the best visual novel database in the world!';
+ h1 mt '_register_title';
+ h2 mt '_register_why';
+ p;
+ lit mt '_register_why_msg';
end;
end;
- $self->htmlForm({ frm => $frm, action => '/u/register' }, register => [ 'New Account',
- [ input => short => 'usrname', name => 'Username' ],
- [ static => content => 'Requested username. Must be lowercase and can only consist of alphanumeric characters.' ],
- [ input => short => 'mail', name => 'Email' ],
- [ static => content => 'Your email address will only be used in case you lose your password. We will never send'
- .' spam or newsletters unless you explicitly ask us for it.<br /><br />' ],
- [ passwd => short => 'usrpass', name => 'Password' ],
- [ passwd => short => 'usrpass2', name => 'Confirm pass.' ],
+ $self->htmlForm({ frm => $frm, action => '/u/register' }, register => [ mt('_register_form_title'),
+ [ input => short => 'usrname', name => mt '_register_username' ],
+ [ static => content => mt '_register_username_msg' ],
+ [ input => short => 'mail', name => mt '_register_mail' ],
+ [ static => content => mt('_register_mail_msg').'<br /><br />' ],
+ [ passwd => short => 'usrpass', name => mt('_register_password') ],
+ [ passwd => short => 'usrpass2', name => mt('_register_confirm') ],
]);
$self->htmlFooter;
}
@@ -352,42 +315,39 @@ sub edit {
$frm->{ign_votes} = $u->{ign_votes} if !defined $frm->{ign_votes};
# create the page
- my $title = $self->authInfo->{id} != $uid ? "Edit $u->{username}'s Account" : 'My Account';
- $self->htmlHeader(title => $title, noindex => 1);
+ $self->htmlHeader(title => mt('_usere_title'), noindex => 1);
$self->htmlMainTabs('u', $u, 'edit');
if($self->reqParam('d')) {
div class => 'mainbox';
- h1 'Settings saved';
+ h1 mt '_usere_saved_title';
div class => 'notice';
- p 'Settings successfully saved.';
+ p mt '_usere_saved_msg';
end;
end
}
- $self->htmlForm({ frm => $frm, action => "/u$uid/edit" }, useredit => [ $title,
- [ part => title => 'General Info' ],
+ $self->htmlForm({ frm => $frm, action => "/u$uid/edit" }, useredit => [ mt('_usere_title'),
+ [ part => title => mt '_usere_geninfo' ],
$self->authCan('usermod') ? (
- [ input => short => 'usrname', name => 'Username' ],
- [ select => short => 'rank', name => 'Rank', options => [
+ [ input => short => 'usrname', name => mt('_usere_username') ],
+ [ select => short => 'rank', name => mt('_usere_rank'), options => [
map [ $_, mt '_urank_'.$_ ], 1..$#{$self->{user_ranks}} ] ],
- [ check => short => 'ign_votes', name => 'Ignore votes in VN statistics' ],
+ [ check => short => 'ign_votes', name => mt '_usere_ignvotes' ],
) : (
- [ static => label => 'Username', content => $frm->{usrname} ],
+ [ static => label => mt('_usere_username'), content => $frm->{usrname} ],
),
- [ input => short => 'mail', name => 'Email' ],
-
- [ part => title => 'Change Password' ],
- [ static => content => 'Leave blank to keep your current password' ],
- [ passwd => short => 'usrpass', name => 'Password' ],
- [ passwd => short => 'usrpass2', name => 'Confirm pass.' ],
-
- [ part => title => 'Options' ],
- [ check => short => 'flags_list', name =>
- qq|Allow other people to see my visual novel list (<a href="/u$uid/list">/u$uid/list</a>) |.
- qq|and wishlist (<a href="/u$uid/wish">/u$uid/wish</a>)| ],
- [ check => short => 'flags_nsfw', name => 'Disable warnings for images that are not safe for work.' ],
- [ select => short => 'skin', name => 'Prefered skin', width => 300, options => [
+ [ input => short => 'mail', name => mt '_usere_mail' ],
+
+ [ part => title => mt '_usere_changepass' ],
+ [ static => content => mt '_usere_changepass_msg' ],
+ [ passwd => short => 'usrpass', name => mt '_usere_password' ],
+ [ passwd => short => 'usrpass2', name => mt '_usere_confirm' ],
+
+ [ part => title => mt '_usere_options' ],
+ [ check => short => 'flags_list', name => mt '_usere_flist' ],
+ [ check => short => 'flags_nsfw', name => mt '_usere_fnsfw' ],
+ [ select => short => 'skin', name => mt('_usere_skin'), width => 300, options => [
map [ $_ eq $self->{skin_default} ? '' : $_, $self->{skins}{$_}.($self->debug?" [$_]":'') ], sort { $self->{skins}{$a} cmp $self->{skins}{$b} } keys %{$self->{skins}} ] ],
- [ textarea => short => 'customcss', name => 'Additional <a href="http://en.wikipedia.org/wiki/Cascading_Style_Sheets">CSS</a>' ],
+ [ textarea => short => 'customcss', name => mt '_usere_css' ],
]);
$self->htmlFooter;
}
@@ -406,12 +366,13 @@ sub posts {
my($posts, $np) = $self->dbPostGet(uid => $uid, hide => 1, what => 'thread', page => $f->{p}, order => 'tp.date DESC');
- $self->htmlHeader(title => "Posts made by $u->{username}", noindex => 1);
+ my $title = mt '_uposts_title', $u->{username};
+ $self->htmlHeader(title => $title, noindex => 1);
$self->htmlMainTabs(u => $u, 'posts');
div class => 'mainbox';
- h1 "Posts made by $u->{username}";
+ h1 $title;
if(!@$posts) {
- p "\u$u->{username} hasn't made any posts yet.";
+ p mt '_uposts_noresults', $u->{username};
}
end;
@@ -424,8 +385,8 @@ sub posts {
header => [
[ '' ],
[ '' ],
- [ 'Date' ],
- sub { td; a href => '#', id => 'history_comments', 'expand'; txt 'Title'; end; }
+ [ mt '_uposts_col_date' ],
+ sub { td; a href => '#', id => 'history_comments', 'expand'; txt mt '_uposts_col_title'; end; }
],
row => sub {
my($s, $n, $l) = @_;
@@ -450,6 +411,8 @@ sub delete {
my($self, $uid, $act) = @_;
return $self->htmlDenied if !$self->authCan('usermod');
+ # rarely used admin function, won't really need translating
+
# confirm
if(!$act) {
my $u = $self->dbUserGet(uid => $uid)->[0];
@@ -496,10 +459,10 @@ sub list {
);
return 404 if $f->{_err};
- $self->htmlHeader(title => 'Browse users');
+ $self->htmlHeader(noindex => 1, title => mt '_ulist_title');
div class => 'mainbox';
- h1 'Browse users';
+ h1 mt '_ulist_title';
form action => '/u/all', 'accept-charset' => 'UTF-8', method => 'get';
$self->htmlSearchBox('u', $f->{q});
end;
@@ -526,11 +489,11 @@ sub list {
pageurl => "/u/$char?o=$f->{o};s=$f->{s};q=$f->{q}",
sorturl => "/u/$char?q=$f->{q}",
header => [
- [ 'Username', 'username' ],
- [ 'Registered', 'registered' ],
- [ 'Votes', 'votes' ],
- [ 'Edits', 'changes' ],
- [ 'Tags', 'tags' ],
+ [ mt('_ulist_col_username'), 'username' ],
+ [ mt('_ulist_col_registered'), 'registered' ],
+ [ mt('_ulist_col_votes'), 'votes' ],
+ [ mt('_ulist_col_edits'), 'changes' ],
+ [ mt('_ulist_col_tags'), 'tags' ],
],
row => sub {
my($s, $n, $l) = @_;