v.golev: #1982 - Blog module i18n patch

This commit is contained in:
Andrew O'Neil 2007-12-18 01:41:51 +00:00
parent 2c6edcf0df
commit 6229b8960d
13 changed files with 149 additions and 53 deletions

View File

@ -27,7 +27,7 @@ class ArchiveWidget extends Widget {
function getCMSFields() {
return new FieldSet(
new OptionsetField("DisplayMode","Display by",array("month"=>"month","year"=>"year"))
new OptionsetField("DisplayMode",_t('ArchiveWidget.DispBY', "Display by"),array("month"=>_t('ArchiveWidget.MONTH',"month"),"year"=>_t('ArchiveWidget.YEAR', "year")))
);
}

View File

@ -3,7 +3,7 @@
/**
* @package blog
*/
/**
* An individual blog entry page to show a blog entry in full
*/
@ -64,19 +64,19 @@ class BlogEntry extends Page {
if(!self::$allow_wysiwyg_editing) {
$fields->removeFieldFromTab("Root.Content.Main","Content");
$fields->addFieldToTab("Root.Content.Main", new TextareaField("Content", "Content", 20));
$fields->addFieldToTab("Root.Content.Main", new TextareaField("Content", _t("BlogEntry.CN", "Content"), 20));
}
$fields->addFieldToTab("Root.Content.Main", new CalendarDateField("Date", "Date"),"Content");
$fields->addFieldToTab("Root.Content.Main", new TextField("Author", "Author", $firstName),"Content");
$fields->addFieldToTab("Root.Content.Main", new CalendarDateField("Date", _t("BlogEntry.DT", "Date")),"Content");
$fields->addFieldToTab("Root.Content.Main", new TextField("Author", _t("BlogEntry.AU", "Author"), $firstName),"Content");
if(!self::$allow_wysiwyg_editing) {
$fields->addFieldToTab("Root.Content.Main", new LiteralField("BBCodeHelper", "<div id='BBCode' class='field'>" .
"<a id=\"BBCodeHint\" target='new'>BBCode help</a>" .
"<a id=\"BBCodeHint\" target='new'>" . _t("BlogEntry.BBH", "BBCode help") / "</a>" .
"<div id='BBTagsHolder' style='display:none;'>".$codeparser->useable_tagsHTML()."</div></div>"));
}
$fields->addFieldToTab("Root.Content.Main", new TextField("Tags", "Tags (comma sep.)"),"Content");
$fields->addFieldToTab("Root.Content.Main", new TextField("Tags", _t("BlogEntry.TS", "Tags (comma sep.)")),"Content");
return $fields;
}
@ -134,7 +134,7 @@ class BlogEntry extends Page {
}
/**
* Link for editing this blog entry
* Link for editing this blog entry
*/
function EditURL(){
return $this->getParent()->Link('post')."/".$this->ID."/";

View File

@ -3,11 +3,11 @@
/**
* @package blog
*/
/**
* Blog holder to display summarised blog entries
*/
class BlogHolder extends Page {
static $icon = "blog/images/blogholder";
@ -43,7 +43,7 @@ class BlogHolder extends Page {
*/
function getNewsletters() {
return DataObject::get('NewsletterType');
}
}
/**
* The DataObject of blog entries
@ -68,12 +68,11 @@ class BlogHolder extends Page {
} else {
$year = Director::urlParam('Action');
$month = Director::urlParam('ID');
if(is_numeric($month) && is_numeric($month)){
$dateCheck = "AND `BlogEntry`.Date BETWEEN '$year-$month-1' AND '$year-$month-31'";
}
else if(isset($year)){
$dateCheck = "AND `BlogEntry`.Date BETWEEN '$year-1-1' AND '$year-12-31'";
} else if(isset($year)){
$dateCheck = "AND `BlogEntry`.Date BETWEEN '$year-1-1' AND '$year-12-31'";
}
}
}
@ -85,6 +84,9 @@ class BlogHolder extends Page {
* Only display the blog entries that have the specified tag
*/
function Tag() {
if(Director::urlParam('Action') == 'tag') {
return Director::urlParam('ID');
}
return isset($_GET['tag']) ? $_GET['tag'] : false;
}
@ -110,19 +112,19 @@ class BlogHolder extends Page {
new HiddenField("ParentID", "ParentID", $this->ID),
new HiddenField("ID","ID"),
new HiddenField("Date","Date"),
new TextField("Title","Subject"),
new TextField("Author","Author",$membername),
new TextField("Title",_t('BlogHolder.SJ', "Subject")),
new TextField("Author",_t('BlogEntry.AU'),$membername),
new CompositeField(
new LiteralField("BBCodeHelper","<a id=\"BBCodeHint\" target='new'>BBCode help</a><div class='clear'><!-- --></div>" ),
new TextareaField("Content", "Content",20),
new LiteralField("BBCodeHelper","<a id=\"BBCodeHint\" target='new'>"._t("BlogEntry.BBH")."</a><div class='clear'><!-- --></div>" ),
new TextareaField("Content", _t("BlogEntry.CN"),20),
new LiteralField("BBCodeTags","<div id='BBTagsHolder' style='display:none;'>".$codeparser->useable_tagsHTML()."</div>")
),
new TextField("Tags","Tags"),
new LiteralField("Tagsnote"," <label id='tagsnote'>For example: sport, personal, science fiction<br/>" .
"Please separate tags using commas.</label>")
new LiteralField("Tagsnote"," <label id='tagsnote'>"._t('BlogHolder.TE', "For example: sport, personal, science fiction")."<br/>" .
_t('BlogHolder.SPUC', "Please separate tags using commas.")."</label>")
);
$submitAction = new FormAction('postblog', 'Post blog entry');
$submitAction = new FormAction('postblog', _t('BlogHolder.POST', 'Post blog entry'));
$actions = new FieldSet($submitAction);
$validator = new RequiredFields('Title','Content');
@ -136,7 +138,7 @@ class BlogHolder extends Page {
return $form;
}
/**
* Check if url has "/post"
*/
@ -150,7 +152,7 @@ class BlogHolder extends Page {
function postURL(){
return $this->Link('post');
}
/**
* Create default blog setup
*/
@ -185,11 +187,11 @@ class BlogHolder extends Page {
$widgetarea->write();
$blog = new BlogEntry();
$blog->Title = "SilverStripe blog module successfully installed";
$blog->Title = _t('BlogHolder.SUCTITLE', "SilverStripe blog module successfully installed");
$blog->URLSegment = 'sample-blog-entry';
$blog->setDate(date("Y-m-d H:i:s",time()));
$blog->Tags = "silverstripe, blog";
$blog->Content = "Congratulations, the SilverStripe blog module has been successfully installed. This blog entry can be safely deleted. You can configure aspects of your blog (such as the widgets displayed in the sidebar) in [url=admin]the CMS[/url].";
$blog->Tags = _t('BlogHolder.SUCTAGS',"silverstripe, blog");
$blog->Content = _t('BlogHolder.SUCCONTENT',"Congratulations, the SilverStripe blog module has been successfully installed. This blog entry can be safely deleted. You can configure aspects of your blog (such as the widgets displayed in the sidebar) in [url=admin]the CMS[/url].");
$blog->Status = "Published";
$blog->ParentID = $blogholder->ID;
$blog->write();
@ -202,16 +204,17 @@ class BlogHolder extends Page {
class BlogHolder_Controller extends Page_Controller {
function init() {
parent::init();
parent::init();
// This will create a <link> tag point to the RSS feed
RSSFeed::linkToFeed($this->Link() . "rss", "RSS feed of this blog");
RSSFeed::linkToFeed($this->Link() . "rss", _t('BlogHolder.RSSFEED',"RSS feed of this blog"));
Requirements::themedCSS("blog");
Requirements::themedCSS("bbcodehelp");
}
/**
* Get the archived blogs for a particular month or year, in the format /year/month/ eg: /2008/10/
* Gets the archived blogs for a particular month or year, in the format /year/month/ eg: /2008/10/
*/
function showarchive() {
$month = addslashes($this->urlParams['ID']);
@ -236,7 +239,7 @@ class BlogHolder_Controller extends Page_Controller {
}
/**
* Get the rss fee for this blog holder's entries
* Get the rss feed for this blog holder's entries
*/
function rss() {
global $project;
@ -257,7 +260,7 @@ class BlogHolder_Controller extends Page_Controller {
function post(){
if(!Permission::check('ADMIN')){
Security::permissionFailure($this,
"Posting blogs is an administrator task. Please log in.");
_t('BlogHolder.HAVENTPERM',"Posting blogs is an administrator task. Please log in."));
}
return array();
}
@ -270,7 +273,6 @@ class BlogHolder_Controller extends Page_Controller {
return parent::defaultAction($action);
}
}
/**

View File

@ -10,11 +10,11 @@ class BlogManagementWidget extends Widget {
function CommentText() {
$unmoderatedcount = DB::query("SELECT COUNT(*) FROM PageComment WHERE NeedsModeration=1")->value();
if($unmoderatedcount == 1) {
return "You have 1 unmoderated comment";
return _t("BlogManagementWidget.UNM1", "You have 1 unmoderated comment");
} else if($unmoderatedcount > 1) {
return "You have $unmoderatedcount unmoderated comments";
return sprintf(_t("BlogManagementWidget.UNMM", "You have %i unmoderated comments"), $unmoderatedcount);
} else {
return "Comment administration";
return _t("BlogManagementWidget.COMADM", "Comment administration");
}
}

View File

@ -17,9 +17,9 @@ class RSSWidget extends Widget {
function getCMSFields() {
return new FieldSet(
new TextField("CustomTitle","Custom title for the feed"),
new TextField("RssUrl", "URL of RSS Feed"),
new NumericField("NumberToShow", "Number of Items to show")
new TextField("CustomTitle", _t('RSSWidget.CT', "Custom title for the feed")),
new TextField("RssUrl", _t('RSSWidget.URL', "URL of RSS Feed")),
new NumericField("NumberToShow", _t('RSSWidget.NTS', "Number of Items to show"))
);
}

View File

@ -30,8 +30,8 @@ class TagCloudWidget extends Widget {
function getCMSFields() {
return new FieldSet(
new TextField("Limit", "Limit number of tags"),
new OptionsetField("Sortby","Sort by",array("alphabet"=>"alphabet","frequency"=>"frequency"))
new TextField("Limit", _t("TagCloudWidget.LIMIT", "Limit number of tags")),
new OptionsetField("Sortby",_t("TagCloudWidget.SORTBY","Sort by"),array("alphabet"=>_t("TagCloudWidget.SBAL", "alphabet"),"frequency"=>_t("TagCloudWidget.SBFREQ", "frequency")))
);
}

0
lang/_manifest_exclude Normal file
View File

47
lang/en_US.php Normal file
View File

@ -0,0 +1,47 @@
<?php
global $lang;
$lang['en_US']['ArchiveWidget']['DISPBY'] = 'Display by';
$lang['en_US']['ArchiveWidget']['MONTH'] = 'month';
$lang['en_US']['ArchiveWidget']['YEAR'] = 'year';
$lang['en_US']['BlogEntry']['CN'] = 'Content';
$lang['en_US']['BlogEntry']['DT'] = 'Date';
$lang['en_US']['BlogEntry']['AU'] = 'Author';
$lang['en_US']['BlogEntry']['BBH'] = 'BBCode help';
$lang['en_US']['BlogEntry']['TS'] = 'Tags (comma sep.)';
$lang['en_US']['BlogHolder']['SJ'] = 'Subject';
$lang['en_US']['BlogHolder']['TE'] = 'For example: sport, personal, science fiction';
$lang['en_US']['BlogHolder']['SPuC'] = 'Please separate tags using commas.';
$lang['en_US']['BlogHolder']['POST'] = 'Post blog entry';
$lang['en_US']['BlogHolder']['SUCTITLE'] = 'SilverStripe blog module successfully installed';
$lang['en_US']['BlogHolder']['SUCTAGS'] = 'silverstripe, blog';
$lang['en_US']['BlogHolder']['SUCCONTENT'] = 'Congratulations, the SilverStripe blog module has been successfully installed. This blog entry can be safely deleted. You can configure aspects of your blog (such as the widgets displayed in the sidebar) in [url=admin]the CMS[/url].';
$lang['en_US']['BlogHolder']['RSSFEED'] = 'RSS feed of this blog';
$lang['en_US']['BlogHolder']['HAVENTPERM'] = 'Posting blogs is an administrator task. Please log in.';
$lang['en_US']['BlogManagementWidget']['UNM1'] = 'You have 1 unmoderated comment';
$lang['en_US']['BlogManagementWidget']['UNMM'] = 'You have %i unmoderated comments';
$lang['en_US']['BlogManagementWidget']['COMADM'] = 'Comment administration';
$lang['en_US']['RSSWidget']['CT'] = 'Custom title for the feed';
$lang['en_US']['RSSWidget']['URL'] = 'URL of RSS Feed';
$lang['en_US']['RSSWidget']['NTS'] = 'Number of Items to show';
$lang['en_US']['TagCloudWidget']['LIMIT'] = 'Limit number of tags';
$lang['en_US']['TagCloudWidget']['SORTBY'] = 'Sort by';
$lang['en_US']['TagCloudWidget']['SBAL'] = 'alphabet';
$lang['en_US']['TagCloudWidget']['SBFREQ'] = 'frequency';
$lang['en_US']['BlogManagementWidget.ss']['POSTNEW'] = 'Post a new blog entry';
$lang['en_US']['BlogManagementWidget.ss']['LOGOUT'] = 'Logout';
$lang['en_US']['BlogSummary.ss']['VIEWFULL'] = 'View full post titled -';
$lang['en_US']['BlogSummary.ss']['POSTEDON'] = 'on';
$lang['en_US']['BlogSummary.ss']['COMMENTS'] = 'Comments';
$lang['en_US']['BlogEntry.ss']['POSTEDBY'] = 'Posted by';
$lang['en_US']['BlogEntry.ss']['POSTEDON'] = 'on';
$lang['en_US']['BlogEntry.ss']['COMMENTS'] = 'Comments';
$lang['en_US']['BlogEntry.ss']['TAGS'] = 'Tags:';
$lang['en_US']['BlogEntry.ss']['VIEWALLPOSTTAGGED'] = 'View all posts tagged';
$lang['en_US']['BlogEntry.ss']['EDITTHIS'] = 'Edit this post';
$lang['en_US']['BlogEntry.ss']['UNPUBLISHTHIS'] = 'Unpublish this post';
$lang['en_US']['BlogHolder.ss']['VIEWINGTAGGED'] = 'Viewing entries tagged with';
$lang['en_US']['BlogHolder.ss']['NOENTRIES'] = 'There are no blog entries';
?>

47
lang/ru_RU.php Normal file
View File

@ -0,0 +1,47 @@
<?php
global $lang;
$lang['ru_RU']['ArchiveWidget']['DISPBY'] = 'Ďîęŕçűâŕňü ďî';
$lang['ru_RU']['ArchiveWidget']['MONTH'] = 'ěĺń˙öŕě';
$lang['ru_RU']['ArchiveWidget']['YEAR'] = 'ăîäŕě';
$lang['ru_RU']['BlogEntry']['CN'] = 'Ňĺęńň';
$lang['ru_RU']['BlogEntry']['DT'] = 'Äŕňŕ';
$lang['ru_RU']['BlogEntry']['AU'] = 'Ŕâňîđ';
$lang['ru_RU']['BlogEntry']['BBH'] = 'Ńďđŕâęŕ ďî BBCode';
$lang['ru_RU']['BlogEntry']['TS'] = 'Ňĺăč (÷ĺđĺç çŕď˙ňóţ)';
$lang['ru_RU']['BlogHolder']['SJ'] = 'Ňĺěŕ';
$lang['ru_RU']['BlogHolder']['TE'] = 'Íŕďđčěĺđ: ńďîđň, íŕó÷íŕ˙ ôŕíňŕńňčęŕ, ëč÷íîĺ';
$lang['ru_RU']['BlogHolder']['SPuC'] = 'Ďîćŕëóéńňŕ, đŕçäĺë˙éňĺ ňĺăč çŕď˙ňűěč.';
$lang['ru_RU']['BlogHolder']['POST'] = 'Îňďđŕâčňü â áëîă';
$lang['ru_RU']['BlogHolder']['SUCTITLE'] = 'Ěîäóëü áëîăŕ äë˙ SilverStripe óńďĺříî óńňŕíîâëĺí!';
$lang['ru_RU']['BlogHolder']['SUCTAGS'] = 'silverstripe, blog';
$lang['ru_RU']['BlogHolder']['SUCCONTENT'] = 'Ďîçäđŕâë˙ĺě, ěîäóëü áëîăŕ äë˙ SilverStripe óńďĺříî óńňŕíîâëĺí. Âű ěîćĺňĺ óäŕëčňü ýňó çŕďčńü. Âű ěîćĺňĺ ďîěĺí˙ňü âíĺříčé âčä ýňîăî áëîăŕ (íŕďđčěĺđ, âčäćĺňű íŕ áîęîâîé ďŕíĺëč) â [url=admin]CMS[/url].';
$lang['ru_RU']['BlogHolder']['RSSFEED'] = 'RSS-ďîňîę áëîăŕ';
$lang['ru_RU']['BlogHolder']['HAVENTPERM'] = 'Ďčńŕňü â áëîă ěîăóň ëčřü ŕäěčíčńňđŕňîđű. Ďîćŕëóéńňŕ, çŕéäčňĺ íŕ ńŕéň.';
$lang['ru_RU']['BlogManagementWidget']['UNM1'] = 'Ĺńňü îäčí íĺďđîâĺđĺííűé ęîěěĺíňŕđčé';
$lang['ru_RU']['BlogManagementWidget']['UNMM'] = 'Ĺńňü %i íĺďđîâĺđĺííűő ęîěěĺíňŕđčĺâ';
$lang['ru_RU']['BlogManagementWidget']['COMADM'] = 'Óďđŕâëĺíčĺ ęîíňĺíňîě';
$lang['ru_RU']['RSSWidget']['CT'] = 'Íŕçâŕíčĺ RSS-ďîňîęŕ';
$lang['ru_RU']['RSSWidget']['URL'] = 'URL RSS-ďîňîęŕ';
$lang['ru_RU']['RSSWidget']['NTS'] = 'Ęîëč÷ĺńňâî îňîáđŕćŕĺěűő ýëĺěĺíňîâ';
$lang['ru_RU']['TagCloudWidget']['LIMIT'] = 'Îăđŕíč÷čňü ęîëč÷ĺńňâî ňĺăîâ';
$lang['ru_RU']['TagCloudWidget']['SORTBY'] = 'Ńîđňčđîâŕňü ďî';
$lang['ru_RU']['TagCloudWidget']['SBAL'] = 'ŕëôŕâčňó';
$lang['ru_RU']['TagCloudWidget']['SBFREQ'] = '÷ŕńňîňĺ';
$lang['ru_RU']['BlogManagementWidget.ss']['POSTNEW'] = 'Íŕďčńŕňü â áëîă';
$lang['ru_RU']['BlogManagementWidget.ss']['LOGOUT'] = 'Âűőîä';
$lang['ru_RU']['BlogSummary.ss']['VIEWFULL'] = 'Ďîńěîňđĺňü ďîëíűé ňĺęńň -';
$lang['ru_RU']['BlogSummary.ss']['POSTEDON'] = 'â';
$lang['ru_RU']['BlogSummary.ss']['COMMENTS'] = 'Ęîěěĺíňŕđčč';
$lang['ru_RU']['BlogEntry.ss']['POSTEDBY'] = 'Ŕâňîđ: ';
$lang['ru_RU']['BlogEntry.ss']['POSTEDON'] = 'â';
$lang['ru_RU']['BlogEntry.ss']['COMMENTS'] = 'Ęîěěĺíňŕđčč';
$lang['ru_RU']['BlogEntry.ss']['TAGS'] = 'Ňĺăč:';
$lang['ru_RU']['BlogEntry.ss']['VIEWALLPOSTTAGGED'] = 'Âńĺ çŕďčńč ń ňĺăîě';
$lang['ru_RU']['BlogEntry.ss']['EDITTHIS'] = 'Đĺäŕęňčđîâŕňü';
$lang['ru_RU']['BlogEntry.ss']['UNPUBLISHTHIS'] = 'Îňďóáëčęîâŕňü';
$lang['ru_RU']['BlogHolder.ss']['VIEWINGTAGGED'] = 'Ďđîńěîňđ çŕďčńĺé ń ňĺăîě';
$lang['ru_RU']['BlogHolder.ss']['NOENTRIES'] = 'Íĺň çŕďčńĺé';
?>

View File

@ -1,5 +1,5 @@
<ul>
<li><a href="$PostLink">Post a new blog entry</a></li>
<li><a href="$PostLink"><% _t('POSTNEW', 'Post a new blog entry') %></a></li>
<li><a href="$CommentLink">$CommentText</a></li>
<li><a href="Security/logout">Logout</a></li>
<li><a href="Security/logout"><% _t('LOGOUT', 'Logout') %></a></li>
</ul>

View File

@ -1,6 +1,6 @@
<div class="blogSummary">
<h2><a href="$Link" title="View full post titled - '$Title'">$MenuTitle</a></h2>
<p class="authorDate">Posted by $Author.XML on $Date.Long | <a href="$Link#PageComments_holder" title="View Comments Posted">$Comments.Count Comments</a></p>
<h2><a href="$Link" title="<% _t('VIEWFULL', 'View full post titled -') %> '$Title'">$MenuTitle</a></h2>
<p class="authorDate"><% _t('BlogEntry.ss.POSTEDBY') %> $Author.XML <% _t('BlogEntry.ss.POSTEDON', 'on') %> $Date.Long | <a href="$Link#PageComments_holder" title="View Comments Posted">$Comments.Count <% _t('BlogEntry.ss.COMMENTS', 'Comments') %></a></p>
<% if Tags %>
<p class="tags">
Tags:

View File

@ -4,19 +4,19 @@
<div class="blogEntry">
<h2>$Title</h2>
<p class="authorDate">Posted by $Author.XML on $Date.Long | $Comments.Count Comments</p>
<p class="authorDate"><% _t('POSTEDBY', 'Posted by') %> $Author.XML <% _t('POSTEDON', 'on') %> $Date.Long | $Comments.Count <% _t('COMMENTS', 'Comments') %></p>
<% if Tags %>
<p class="tags">
Tags:
<% _t('TAGS', 'Tags:') %>
<% control Tags %>
<a href="$Link" title="View all posts tagged '$Tag'" rel="tag">$Tag</a><% if Last %><% else %>,<% end_if %>
<a href="$Link" title="<% _t('VIEWALLPOSTTAGGED', 'View all posts tagged') %> '$Tag'" rel="tag">$Tag</a><% if Last %><% else %>,<% end_if %>
<% end_control %>
</p>
<% end_if %>
<p>$ParsedContent</p>
<br />
</div>
<% if CurrentMember %><p><a href="$EditURL" id="editpost" title="Edit this post">Edit this post</a> | <a href="$Link(unpublishPost)" id="unpublishpost">Unpublish this post</a></p><% end_if %>
<% if CurrentMember %><p><a href="$EditURL" id="editpost" title="<% _t('EDITTHIS', 'Edit this post') %>"><% _t('EDITTHIS', 'Edit this post') %></a> | <a href="$Link(unpublishPost)" id="unpublishpost"><% _t('UNPUBLISHTHIS', 'Unpublish this post') %></a></p><% end_if %>
$PageComments

View File

@ -5,7 +5,7 @@
<% include BreadCrumbs %>
<% if Tag %>
<h3>Viewing entries tagged with '$Tag'</h3>
<h3><% _t('VIEWINGTAGGED', 'Viewing entries tagged with') %> '$Tag'</h3>
<% end_if %>
<% if BlogEntries %>
@ -13,9 +13,9 @@
<% include BlogSummary %>
<% end_control %>
<% else %>
<h3>There are no blog entries</h3>
<h3><% _t('NOENTRIES', 'There are no blog entries') %></h3>
<% end_if %>
<% include BlogPagination %>
</div>
</div>