rhalff: #1580 - i18n for comments system

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@46723 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2007-12-12 22:57:29 +00:00
parent d1ead49133
commit cf31a3d4e6
9 changed files with 64 additions and 42 deletions

View File

@ -36,22 +36,22 @@ class CommentAdmin extends LeftAndMain {
if($section == 'approved') {
$filter = 'IsSpam=0 AND NeedsModeration=0';
$title = "<h2>Approved Comments</h2>";
$title = "<h2>". _t('CommentAdmin.APPROVEDCOMMENTS', 'Approved Comments')."</h2>";
} else if($section == 'unmoderated') {
$filter = 'NeedsModeration=1';
$title = "<h2>Comments Awaiting Moderation</h2>";
$title = "<h2>"._t('CommentAdmin.COMMENTSAWAITINGMODERATION', 'Comments Awaiting Moderation')."</h2>";
} else {
$filter = 'IsSpam=1';
$title = "<h2>Spam</h2>";
$title = "<h2>"._t('CommentAdmin.SPAM', 'Spam')."</h2>";
}
$filter .= ' AND ParentID>0';
$tableFields = array(
"Name" => "Author",
"Comment" => "Comment",
"PageTitle" => "Page",
"Created" => "Date Posted"
"Name" => _t('CommentAdmin.AUTHOR', 'Author'),
"Comment" => _t('CommentAdmin.COMMENT', 'Comment'),
"PageTitle" => _t('CommentAdmin.PAGE', 'Page'),
"Created" => _t('CommentAdmin.DATEPOSTED', 'Date Posted')
);
$popupFields = new FieldSet(
@ -76,21 +76,21 @@ class CommentAdmin extends LeftAndMain {
$actions = new FieldSet();
if($section == 'unmoderated') {
$actions->push(new FormAction('acceptmarked', 'Accept'));
$actions->push(new FormAction('acceptmarked', _t('CommentAdmin.ACCEPT', 'Accept')));
}
if($section == 'approved' || $section == 'unmoderated') {
$actions->push(new FormAction('spammarked', 'Mark as spam'));
$actions->push(new FormAction('spammarked', _t('CommentAdmin.SPAMMARKED', 'Mark as spam')));
}
if($section == 'spam') {
$actions->push(new FormAction('hammarked', 'Mark as not spam'));
$actions->push(new FormAction('hammarked', _t('CommentAdmin.MARKASNOTSPAM', 'Mark as not spam')));
}
$actions->push(new FormAction('deletemarked', 'Delete'));
$actions->push(new FormAction('deletemarked', _t('CommentAdmin.DELETE', 'Delete')));
if($section == 'spam') {
$actions->push(new FormAction('deleteall', 'Delete All'));
$actions->push(new FormAction('deleteall', _t('CommentAdmin.DELETEALL', 'Delete All')));
}
$form = new Form($this, "EditForm", $fields, $actions);

View File

@ -133,12 +133,12 @@ class CommentTableField extends ComplexTableField {
function SearchForm() {
$searchFields = new FieldGroup(
new TextField('CommentSearch', 'Search'),
new TextField('CommentSearch', _t('CommentTableField.SEARCH', 'Search')),
new HiddenField("ctf[ID]",'',$this->mode),
new HiddenField('CommentFieldName','',$this->name)
);
$actionFields = new LiteralField('CommentFilterButton','<input type="submit" class="action" name="CommentFilterButton" value="Filter" id="CommentFilterButton"/>');
$actionFields = new LiteralField('CommentFilterButton','<input type="submit" name="CommentFilterButton" value="'. _t('CommentTableField.FILTER', 'Filter') .'" id="CommentFilterButton"/>');
$fieldContainer = new FieldGroup(
$searchFields,
@ -176,4 +176,4 @@ class CommentTableField_Item extends ComplexTableField_Item {
}
}
?>
?>

View File

@ -206,4 +206,4 @@ class PageComment extends DataObject {
}
?>
?>

View File

@ -33,17 +33,16 @@ class PageCommentInterface extends ViewableData {
$fields = new FieldSet(
new HiddenField("ParentID", "ParentID", $this->page->ID),
new TextField("Name", "Your name")
);
new TextField("Name", _t('PageCommentInterface.YOURNAME', 'Your name')));
if(MathSpamProtection::isEnabled()){
$fields->push(new TextField("Math","Spam protection question: ".MathSpamProtection::getMathQuestion()));
$fields->push(new TextField("Math", sprintf(_t('PageCommentInterface.SPAMQUESTION', "Spam protection question: %s"), MathSpamProtection::getMathQuestion())));
}
$fields->push(new TextareaField("Comment", "Comments"));
$fields->push(new TextareaField("Comment", _t('PageCommentInterface.YOURCOMMENT', "Comments")));
$form = new PageCommentInterface_Form($this->controller, $this->methodName . ".PostCommentForm",$fields, new FieldSet(
new FormAction("postcomment", "Post")
new FormAction("postcomment", _t('PageCommentInterface.POST', 'Post'))
));
$form->loadDataFrom(array(
@ -98,10 +97,9 @@ class PageCommentInterface_Form extends Form {
$comment->setField("IsSpam", true);
$comment->write();
}
echo "<b>Spam detected!!</b><br /><br />";
echo "If you believe this was in error, please email ";
echo ereg_replace("@", " _(at)_", Email::getAdminEmail());
echo ".<br /><br />The message you posted was:<br /><br />";
echo "<b>"._t('PageCommentInterface_Form.SPAMDETECTED', 'Spam detected!!') . "</b><br /><br />";
printf("If you believe this was in error, please email %s.", ereg_replace("@", " _(at)_", Email::getAdminEmail()));
echo "<br /><br />"._t('PageCommentInterface_Form.MSGYOUPOSTED', 'The message you posted was:'). "<br /><br />";
echo $data['Comment'];
return;
@ -131,7 +129,7 @@ class PageCommentInterface_Form extends Form {
if(Director::is_ajax()) {
if($comment->NeedsModeration){
echo "Your comment has been submitted and is now awating moderation.";
echo _t('PageCommentInterface_Form.AWAITINGMODERATION', "Your comment has been submitted and is now awating moderation.");
} else{
echo $comment->renderWith('PageCommentInterface_singlecomment');
}
@ -148,9 +146,9 @@ class PageCommentInterface_Controller extends ContentController {
function newspamquestion() {
if(Director::is_ajax()) {
echo Convert::raw2xml("Spam protection question: ".MathSpamProtection::getMathQuestion());
echo Convert::raw2xml(sprintf(_t('PageCommentInterface_Controller.SPAMQUESTION', "Spam protection question: %s"),MathSpamProtection::getMathQuestion()));
}
}
}
?>
?>

View File

@ -137,6 +137,20 @@ $lang['en_US']['CMSMain']['VISITRESTORE'] = array(
PR_LOW,
'restorepage/(ID) should not be translated (is an URL)'
);
$lang['en_US']['CommentAdmin']['APPROVEDCOMMENTS'] = 'Approved Comments';
$lang['en_US']['CommentAdmin']['COMMENTSAWAITINGMODERATION'] = 'Comments Awaiting Moderation';
$lang['en_US']['CommentAdmin']['SPAM'] = 'Spam';
$lang['en_US']['CommentAdmin']['AUTHOR'] = 'Author';
$lang['en_US']['CommentAdmin']['COMMENT'] = 'Comment';
$lang['en_US']['CommentAdmin']['PAGE'] = 'Page';
$lang['en_US']['CommentAdmin']['DATEPOSTED'] = 'Date Posted';
$lang['en_US']['CommentAdmin']['ACCEPT'] = 'Accept';
$lang['en_US']['CommentAdmin']['SPAMMARKED'] = 'Mark as spam';
$lang['en_US']['CommentAdmin']['MARKASNOTSPAM'] = 'Mark as not spam';
$lang['en_US']['CommentAdmin']['DELETE'] = 'Delete';
$lang['en_US']['CommentAdmin']['DELETEALL'] = 'Delete All';
$lang['en_US']['CommentTableField']['SEARCH'] = 'Search';
$lang['en_US']['CommentTableField']['FILTER'] = 'Filter';
$lang['en_US']['LeftAndMain']['PERMDEFAULT'] = 'Please choose an authentication method and enter your credentials to access the CMS.';
$lang['en_US']['LeftAndMain']['PERMALREADY'] = 'I\'m sorry, but you can\'t access that part of the CMS. If you want to log in as someone else, do so below';
$lang['en_US']['LeftAndMain']['PERMAGAIN'] = 'You have been logged out of the CMS. If you would like to log in again, enter a username and password below.';
@ -244,6 +258,11 @@ $lang['en_US']['CMSMain_versions.ss']['NOTPUB'] = 'Not published';
$lang['en_US']['CommentList.ss']['NOCOM'] = 'There are no comments on this page.';
$lang['en_US']['CommentList.ss']['CREATEDW'] = 'Comments are created whenever one of the \'workflow actions\'
are undertaken - Publish, Reject, Submit.';
$lang['en_US']['CommentTableField.ss']['APPROVECOMMENT'] = 'Approve this comment';
$lang['en_US']['CommentTableField.ss']['MARKASSPAM'] = 'Mark this comment as spam' ;
$lang['en_US']['CommentTableField.ss']['MARKNOSPAM'] = 'Mark this comment as not spam';
$lang['en_US']['CommentTableField.ss']['DELETEROW'] = 'Delete this row';
$lang['en_US']['CommentTableField.ss']['NOITEMSFOUND'] = 'No items found';
$lang['en_US']['ImageEditor.ss']['UNTITLED'] = 'Untitled Document';
$lang['en_US']['ImageEditor.ss']['SAVE'] = 'save&nbsp;image';
$lang['en_US']['ImageEditor.ss']['UNDO'] = 'undo';
@ -328,6 +347,10 @@ $lang['en_US']['CMSMain_right.ss']['CHOOSEPAGE'] = 'Please choose a page from th
$lang['en_US']['CMSRight.ss']['ECONTENT'] = 'Edit Content';
$lang['en_US']['CMSRight.ss']['WELCOMETO'] = 'Welcome to';
$lang['en_US']['CMSRight.ss']['CHOOSEPAGE'] = 'Please choose a page from the left.';
$lang['en_US']['CommentAdmin_left.ss']['COMMENTS'] = 'Comments';
$lang['en_US']['CommentAdmin_left.ss']['APPROVED'] = 'Approved';
$lang['en_US']['CommentAdmin_left.ss']['AWAITMODERATION'] = 'Awaiting Moderation';
$lang['en_US']['CommentAdmin_left.ss']['SPAM'] = 'Spam';
$lang['en_US']['GenericDataAdmin_left.ss']['ADDLISTING'] = 'Add Listing';
$lang['en_US']['GenericDataAdmin_left.ss']['SEARCHLISTINGS'] = 'Search Listings';
$lang['en_US']['GenericDataAdmin_left.ss']['SEARCHRESULTS'] = 'Search Results';
@ -454,6 +477,7 @@ $lang['en_US']['PageCommentInterface.ss']['COMMENTS'] = 'Comments';
$lang['en_US']['PageCommentInterface.ss']['PREV'] = 'previous';
$lang['en_US']['PageCommentInterface.ss']['NEXT'] = 'next';
$lang['en_US']['PageCommentInterface.ss']['NOCOMMENTSYET'] = 'No one has commented on this page yet.';
$lang['en_US']['PageCommentInterface.ss']['RSSFEEDCOMMENTS'] = 'RSS feed for comments on this page';
$lang['en_US']['PageCommentInterface_singlecomment.ss']['PBY'] = 'Posted by';
$lang['en_US']['PageCommentInterface_singlecomment.ss']['ISSPAM'] = 'this comment is spam';
$lang['en_US']['PageCommentInterface_singlecomment.ss']['ISNTSPAM'] = 'this comment is not spam';

View File

@ -1,15 +1,15 @@
<ul id="sitetree" class="tree unformatted">
<li id="$ID" class="Root"><a><strong>Comments</strong></a>
<li id="$ID" class="Root"><a><strong><% _t('COMMENTS', 'Comments') %></strong></a>
<ul>
<li id="record-approved" <% if Section=approved %>class="current"<% end_if %>>
<a href="$baseURL/admin/comments/showtable/approved" title="Approved">Approved</a>
<a href="$baseURL/admin/comments/showtable/approved" title="<% _t('APPROVED', 'Approved') %>"><% _t('APPROVED', 'Approved') %></a>
</li>
<li id="record-unmoderated" <% if Section=unmoderated %>class="current"<% end_if %>>
<a href="$baseURL/admin/comments/showtable/unmoderated" title="Awaiting Moderation">Awaiting Moderation</a>
<a href="$baseURL/admin/comments/showtable/unmoderated" title="<% _t('AWAITMODERATION', 'Awaiting Moderation') %>"><% _t('AWAITMODERATION', 'Awaiting Moderation') %></a>
</li>
<li id="record-spam">
<a href="$baseURL/admin/comments/showtable/spam" title="Spam" <% if Section=spam %>class="current"<% end_if %>>Spam</a>
<a href="$baseURL/admin/comments/showtable/spam" title="<% _t('SPAM', 'Spam') %>" <% if Section=spam %>class="current"<% end_if %>><% _t('SPAM', 'Spam') %></a>
</li>
</ul>
</li>
</ul>
</ul>

View File

@ -1,7 +1,7 @@
<h2>Comments</h2>
<h2><% _t('COMMENTS', 'Comments') %></h2>
<div id="treepanes">
<div id="sitetree_holder">
<% include CommentAdmin_SiteTree %>
</div>
</div>
</div>

View File

@ -47,23 +47,23 @@
<td width="18"><a class="popuplink editlink" href="$EditLink" target="_blank"><img src="cms/images/edit.gif" alt="edit" /></a></td>
<% end_if %>
<% if HasApproveButton %>
<td width="18"><a class="approvelink" href="$ApproveLink" title="Approve this comment"><img src="cms/images/approvecomment.png" alt="approve" /></a></td>
<td width="18"><a class="approvelink" href="$ApproveLink" title="<% _t('APPROVECOMMENT', 'Approve this comment') %>"><img src="cms/images/approvecomment.png" alt="approve" /></a></td>
<% end_if %>
<% if HasSpamButton %>
<td width="18"><a class="spamlink" href="$SpamLink" title="Mark this comment as spam"><img src="cms/images/declinecomment.png" alt="spam" /></a></td>
<td width="18"><a class="spamlink" href="$SpamLink" title="<% _t('MARKASSPAM', 'Mark this comment as spam') %>"><img src="cms/images/declinecomment.png" alt="spam" /></a></td>
<% end_if %>
<% if HasHamButton %>
<td width="18"><a class="hamlink" href="$HamLink" title="Mark this comment as not spam"><img src="cms/images/approvecomment.png" alt="ham" /></a></td>
<td width="18"><a class="hamlink" href="$HamLink" title="<% _t('MARKNOSPAM', 'Mark this comment as not spam') %>"><img src="cms/images/approvecomment.png" alt="ham" /></a></td>
<% end_if %>
<% if Can(delete) %>
<td width="18"><a class="deletelink" href="$DeleteLink" title="Delete this row"><img src="cms/images/delete.gif" alt="delete" /></a></td>
<td width="18"><a class="deletelink" href="$DeleteLink" title="<% _t('DELETEROW', 'Delete this row') %>"><img src="cms/images/delete.gif" alt="delete" /></a></td>
<% end_if %>
</tr>
<% end_control %>
<% else %>
<tr class="notfound">
<% if Markable %><th width="18">&nbsp;</th><% end_if %>
<td colspan="$Headings.Count"><i>No items found</i></td>
<td colspan="$Headings.Count"><i><% _t('NOITEMSFOUND', 'No items found') %></i></td>
<% if Can(edit) %><th width="18">&nbsp;</th><% end_if %>
<% if HasApproveButton %><th width="18">&nbsp;</th><% end_if %>
<% if HasSpamButton %><th width="18">&nbsp;</th><% end_if %>
@ -73,4 +73,4 @@
<% end_if %>
</tbody>
</table>
</div>
</div>

View File

@ -42,6 +42,6 @@
<p id="NoComments"><% _t('NOCOMMENTSYET','No one has commented on this page yet.') %></p>
<% end_if %>
</div>
<p id="CommentsRSSFeed"><a class="commentrss" href="$CommentRssLink">RSS feed for comments on this page</a></p>
<p id="CommentsRSSFeed"><a class="commentrss" href="$CommentRssLink"><% _t('RSSFEEDCOMMENTS', 'RSS feed for comments on this page') %></a></p>
</div>