From 990cab1ec8acd0f5f776336b492d5abcd067423c Mon Sep 17 00:00:00 2001 From: Yorhel Date: Mon, 17 Aug 2009 15:26:34 +0200 Subject: L10N: Converted Handler::Discussions and the discussion_boards list --- data/global.pl | 8 +- data/lang.txt | 179 ++++++++++++++++++++++++++++++++++++++++ lib/VNDB/Handler/Discussions.pm | 82 +++++++++--------- lib/VNDB/Handler/Misc.pm | 2 +- 4 files changed, 223 insertions(+), 48 deletions(-) diff --git a/data/global.pl b/data/global.pl index 4c9edbdc..ba95638b 100644 --- a/data/global.pl +++ b/data/global.pl @@ -33,13 +33,7 @@ our %S = (%S, ], languages => [qw|cs da de en es fi fr it ja ko nl no pl pt ru sv tr vi zh|], producer_types => [qw|co in ng|], - discussion_boards => { - an => 'Announcements', # 0 - usage restricted to boardmods - db => 'VNDB Discussions', # 0 - v => 'Visual novels', # vid - p => 'Producers', # pid - u => 'Users', # uid - }, + discussion_boards => [qw|an db v p u|], vn_lengths => [ [ 'Unknown', '', '' ], [ 'Very short', '< 2 hours', 'OMGWTFOTL, A Dream of Summer' ], diff --git a/data/lang.txt b/data/lang.txt index 4c1e9e5d..31d8cf5f 100644 --- a/data/lang.txt +++ b/data/lang.txt @@ -315,6 +315,29 @@ en : Trial ru*: +# Discussion board types + +:_dboard_an +en : Announcements +ru*: + +:_dboard_db +en : VNDB Discussions +ru*: + +:_dboard_v +en : Visual novels +ru*: + +:_dboard_p +en : Producers +ru*: + +:_dboard_u +en : Users +ru*: + + ############################################################################# @@ -767,6 +790,162 @@ ru*: +############################################################################# +## Discussion board (/t/*) ## +############################################################################# +# Handler::Discussions + + +# thread page (/t+) + +:_thread_postedin +en : Posted in +ru*: + +:_thread_byuser +en : by [userstr,_1] +ru*: + +:_thread_editpost +en : edit +ru*: + +:_thread_deletedpost +en : Post deleted. +ru*: + +:_thread_lastmodified +en : Last modified on [date,_1,full] +ru*: + +:_thread_noreply_title +en : Reply +ru*: + +:_thread_noreply_locked +en : This thread has been locked, you can't reply to it anymore +ru*: + +:_thread_noreply_login +en : You must be logged in to reply to this thread. +ru*: + +:_thread_quickreply_title +en : Quick reply +ru*: + +:_thread_quickreply_submit +en : Reply +ru*: + + +# Post edit/reply/new thread form + +:_postedit_newthread +en : Start new thread +ru*: + +:_postedit_replyto +en : Reply to [_1] +ru*: + +:_postedit_edit +en : Edit post +ru*: + +:_postedit_form_username +en : Username +ru*: + +:_postedit_form_title +en : Thread title +ru*: + +:_postedit_form_boards +en : Board(s) +ru*: + +:_postedit_form_boards_info +en : Read [url,/d9.2,d9.2] for information about how to specify boards. +ru*: + +:_postedit_form_locked +en : Locked +ru*: + +:_postedit_form_topic +en : Topic +ru*: + +:_postedit_form_hidden +en : Hidden +ru*: + +:_postedit_form_nolastmod +en : Don't update last modified field +ru*: + +:_postedit_form_msg +en : Message +ru*: + +:_postedit_form_msg_format +en : See [url,/d9.3,d9.3] for the allowed formatting codes +ru*: + + +# Browsing threads by board (/t/{board_id}) + +:_disboard_item_title +en : Related discussions for [_1] +ru*: + +:_disboard_rootlink +en : Discussion board +ru*: + +:_disboard_nothreads +en : No related threads found +ru*: + +:_disboard_createyourown +en : Why not create one yourself? +ru*: + +:_disboard_startnew +en : Start a new thread +ru*: + + +# The discussion board index (/t) + +:_disindex_title +en : Discussion board index +ru*: + + +# Thread list (on discussion board index and board browser) + +:_threadlist_col_topic +en : Topic +ru*: + +:_threadlist_col_replies +en : Replies +ru*: + +:_threadlist_col_starter +en : Starter +ru*: + +:_threadlist_col_lastpost +en : Last post +ru*: + + + + + ############################################################################# ## Misc. messages ## ############################################################################# diff --git a/lib/VNDB/Handler/Discussions.pm b/lib/VNDB/Handler/Discussions.pm index 22b2eed2..311b1344 100644 --- a/lib/VNDB/Handler/Discussions.pm +++ b/lib/VNDB/Handler/Discussions.pm @@ -33,11 +33,11 @@ sub thread { div class => 'mainbox'; h1 $t->{title}; - h2 'Posted in'; + h2 mt '_thread_postedin'; ul; for (sort { $a->{type}.$a->{iid} cmp $b->{type}.$b->{iid} } @{$t->{boards}}) { li; - a href => "/t/$_->{type}", $self->{discussion_boards}{$_->{type}}; + a href => "/t/$_->{type}", mt "_dboard_$_->{type}"; if($_->{iid}) { txt ' > '; a style => 'font-weight: bold', href => "/t/$_->{type}$_->{iid}", "$_->{type}$_->{iid}"; @@ -60,8 +60,7 @@ sub thread { td class => 'tc1'; a href => "/t$tid.$_->{num}", name => $_->{num}, "#$_->{num}"; if(!$_->{hidden}) { - txt ' by '; - lit $self->{l10n}->userstr($_); + lit ' '.mt "_thread_byuser", $_; br; lit $self->{l10n}->date($_->{date}, 'full'); } @@ -70,15 +69,15 @@ sub thread { if($self->authCan('boardmod') || $self->authInfo->{id} && $_->{uid} == $self->authInfo->{id} && !$_->{hidden}) { i class => 'edit'; txt '< '; - a href => "/t$tid.$_->{num}/edit", 'edit'; + a href => "/t$tid.$_->{num}/edit", mt '_thread_editpost'; txt ' >'; end; } if($_->{hidden}) { - i class => 'deleted', 'Post deleted.'; + i class => 'deleted', mt '_thread_deletedpost'; } else { lit bb2html $_->{msg}; - i class => 'lastmod', 'Last modified on '.$self->{l10n}->date($_->{edited}, 'full') if $_->{edited}; + i class => 'lastmod', mt '_thread_lastmodified', $_->{edited} if $_->{edited}; } end; end; @@ -89,24 +88,24 @@ sub thread { if($t->{locked}) { div class => 'mainbox'; - h1 'Reply'; - p class => 'center', 'This thread has been locked, you can\'t reply to it anymore.'; + h1 mt '_thread_noreply_title'; + p class => 'center', mt '_thread_noreply_locked'; end; } elsif($t->{count} <= $page*25 && $self->authCan('board')) { form action => "/t$tid/reply", method => 'post', 'accept-charset' => 'UTF-8'; div class => 'mainbox'; fieldset class => 'submit'; - h2 'Quick reply'; + h2 mt '_thread_quickreply_title'; textarea name => 'msg', id => 'msg', rows => 4, cols => 50, ''; br; - input type => 'submit', value => 'Reply', class => 'submit'; + input type => 'submit', value => mt('_thread_quickreply_submit'), class => 'submit'; end; end; end; } elsif(!$self->authCan('board')) { div class => 'mainbox'; - h1 'Reply'; - p class => 'center', 'You must be logged in to reply to this thread.'; + h1 mt '_thread_noreply_title'; + p class => 'center', mt '_thread_noreply_login'; end; } @@ -177,7 +176,7 @@ sub edit { my($ty, $id) = ($1, $2) if /^([a-z]{1,2})([0-9]*)$/; push @boards, [ $ty, $id ]; push @{$frm->{_err}}, [ 'boards', 'wrongboard', $_ ] if - !$ty || !$self->{discussion_boards}{$ty} + !$ty || !grep($_ eq $ty, @{$self->{discussion_boards}}) || $ty eq 'an' && ($id || !$self->authCan('boardmod')) || $ty eq 'db' && $id || $ty eq 'v' && (!$id || !$self->dbVNGet(id => $id)->[0]{id}) @@ -229,31 +228,31 @@ sub edit { $frm->{nolastmod} = 1 if $num && $self->authCan('boardmod') && !exists $frm->{nolastmod}; # generate html - my $title = !$tid ? 'Start new thread' : - !$num ? 'Reply to '.$t->{title} : - 'Edit post'; + my $title = mt !$tid ? '_postedit_newthread' : + !$num ? ('_postedit_replyto', $t->{title}) : + '_postedit_edit'; my $url = !$tid ? "/t/$board/new" : !$num ? "/t$tid/reply" : "/t$tid.$num/edit"; $self->htmlHeader(title => $title, noindex => 1); $self->htmlForm({ frm => $frm, action => $url }, $title => [ - [ static => label => 'Username', content => $self->{l10n}->userstr($self->authInfo->{id}, $self->authInfo->{username}) ], + [ static => label => mt('_postedit_form_username'), content => $self->{l10n}->userstr($self->authInfo->{id}, $self->authInfo->{username}) ], !$tid || $num == 1 ? ( - [ input => short => 'title', name => 'Thread title' ], - [ input => short => 'boards', name => 'Board(s)' ], - [ static => content => 'Read d9.2 for information about how to specify boards' ], + [ input => short => 'title', name => mt('_postedit_form_title') ], + [ input => short => 'boards', name => mt('_postedit_form_boards') ], + [ static => content => mt('_postedit_form_boards_info') ], $self->authCan('boardmod') ? ( - [ check => name => 'Locked', short => 'locked' ], + [ check => name => mt('_postedit_form_locked'), short => 'locked' ], ) : (), ) : ( - [ static => label => 'Topic', content => qq||.xml_escape($t->{title}).'' ], + [ static => label => mt('_postedit_form_topic'), content => qq||.xml_escape($t->{title}).'' ], ), $self->authCan('boardmod') ? ( - [ check => name => 'Hidden', short => 'hidden' ], + [ check => name => mt('_postedit_form_hidden'), short => 'hidden' ], $num ? ( - [ check => name => 'Don\'t update last modified field', short => 'nolastmod' ], + [ check => name => mt('_postedit_form_nolastmod'), short => 'nolastmod' ], ) : (), ) : (), - [ text => name => 'Message', short => 'msg', rows => 10 ], - [ static => content => 'See d9.3 for the allowed formatting codes' ], + [ text => name => mt('_postedit_form_msg'), short => 'msg', rows => 10 ], + [ static => content => mt('_postedit_form_msg_format') ], ]); $self->htmlFooter; } @@ -275,7 +274,7 @@ sub board { $self->dbVNGet(id => $iid)->[0]; return 404 if $iid && !$obj; my $ititle = $obj && ($obj->{title}||$obj->{name}||$obj->{username}); - my $title = !$obj ? $self->{discussion_boards}{$type} : 'Related discussions for '.$ititle; + my $title = !$obj ? mt("_dboard_$type") : mt '_disboard_item_title', $ititle; my($list, $np) = $self->dbThreadGet( type => $type, @@ -292,9 +291,9 @@ sub board { div class => 'mainbox'; h1 $title; p; - a href => '/t', 'Discussion board'; + a href => '/t', mt '_disboard_rootlink'; txt ' > '; - a href => "/t/$type", $self->{discussion_boards}{$type}; + a href => "/t/$type", mt "_dboard_$type"; if($iid) { txt ' > '; a style => 'font-weight: bold', href => "/t/$type$iid", "$type$iid"; @@ -304,11 +303,11 @@ sub board { end; p class => 'center'; if(!@$list) { - b 'No related threads found'; + b mt '_disboard_nothreads'; br; br; - a href => "/t/$type$iid/new", 'Why not create one yourself?'; + a href => "/t/$type$iid/new", mt '_disboard_createyourown'; } else { - a href => '/t/'.($iid ? $type.$iid : 'db').'/new', 'Start a new thread'; + a href => '/t/'.($iid ? $type.$iid : 'db').'/new', mt '_disboard_startnew'; } end; end; @@ -322,11 +321,11 @@ sub board { sub index { my $self = shift; - $self->htmlHeader(title => 'Discussion board index'); + $self->htmlHeader(title => mt '_disindex_title'); div class => 'mainbox'; - h1 'Discussion board index'; + h1 mt '_disindex_title'; p class => 'browseopts'; - a href => '/t/'.$_, $self->{discussion_boards}{$_} + a href => '/t/'.$_, mt "_dboard_$_" for (qw|an db v p u|); end; end; @@ -340,7 +339,7 @@ sub index { order => 'tpl.date DESC', ); h1 class => 'boxtitle'; - a href => "/t/$_", $self->{discussion_boards}{$_}; + a href => "/t/$_", mt "_dboard_$_"; end; _threadlist($self, $list, {p=>1}, 0, "/t"); } @@ -358,7 +357,10 @@ sub _threadlist { pageurl => $url, class => 'discussions', header => [ - [ 'Topic' ], [ 'Replies' ], [ 'Starter' ], [ 'Last post' ] + [ mt '_threadlist_col_topic' ], + [ mt '_threadlist_col_replies' ], + [ mt '_threadlist_col_starter' ], + [ mt '_threadlist_col_lastpost' ], ], row => sub { my($self, $n, $o) = @_; @@ -386,8 +388,8 @@ sub _threadlist { last if $i++ > 5; txt ', ' if $i > 2; a href => "/t/$_->{type}".($_->{iid}||''), - title => $_->{original}||$self->{discussion_boards}{$_->{type}}, - shorten $_->{title}||$self->{discussion_boards}{$_->{type}}, 30; + title => $_->{original}||mt("_dboard_$_->{type}"), + shorten $_->{title}||mt("_dboard_$_->{type}"), 30; } txt ', ...' if @{$o->{boards}} > 5; end; diff --git a/lib/VNDB/Handler/Misc.pm b/lib/VNDB/Handler/Misc.pm index 82e947d7..f1e1b774 100644 --- a/lib/VNDB/Handler/Misc.pm +++ b/lib/VNDB/Handler/Misc.pm @@ -96,7 +96,7 @@ sub homepage { my $posts = $self->dbThreadGet(what => 'lastpost boardtitles', results => 10, order => 'tpl.date DESC', notusers => 1); ul; for (@$posts) { - my $boards = join ', ', map $self->{discussion_boards}{$_->{type}}.($_->{iid}?' > '.$_->{title}:''), @{$_->{boards}}; + my $boards = join ', ', map mt("_dboard_$_->{type}").($_->{iid}?' > '.$_->{title}:''), @{$_->{boards}}; li; lit mt '_home_recentposts_item', $_->{ldate}, sprintf('%s', "/t$_->{id}.$_->{count}", -- cgit v1.2.3