mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Using T.Plural in code
--HG-- branch : dev
This commit is contained in:
@@ -10,16 +10,18 @@ if (Model.Entries.Count() > 0) { %>
|
||||
entry.ContentItemViewModel.Zones.AddAction("meta", html => {
|
||||
int draftCount = entry.TotalPostCount - entry.ContentItemViewModel.Item.PostCount;
|
||||
int totalPostCount = entry.TotalPostCount;
|
||||
var draftText = (draftCount == 0 ? "": string.Format(" ({0} draft{1})", draftCount, draftCount == 1 ? "" : "s"));
|
||||
|
||||
var linkText = T.Plural("1 post", "{0} posts", totalPostCount).ToString();
|
||||
if (draftCount==0){
|
||||
linkText = linkText + " (" + T.Plural("1 draft", "{0} drafts", draftCount).ToString() + ")";
|
||||
}
|
||||
|
||||
var linkContent = _Encoded("{0} post{1}{2}", totalPostCount, totalPostCount == 1 ? "" : "s", draftText);
|
||||
|
||||
html.ViewContext.Writer.Write(html.Link(linkContent.ToString(), Url.BlogForAdmin(entry.ContentItemViewModel.Item.Slug)));
|
||||
html.ViewContext.Writer.Write(html.Link(linkText, Url.BlogForAdmin(entry.ContentItemViewModel.Item.Slug)));
|
||||
});
|
||||
|
||||
// Display the summary for the blog post
|
||||
return Html.DisplayForItem(entry.ContentItemViewModel).ToHtmlString();
|
||||
}, "blogs contentItems")%><%
|
||||
} else { %>
|
||||
<div class="info message"><%=T("There are no blogs for you to see. Want to <a href=\"{0}\">add one</a>?", Url.BlogCreate()).ToString()%></div><%
|
||||
<div class="info message"><%:T("There are no blogs for you to see. Want to <a href=\"{0}\">add one</a>?", Url.BlogCreate())%></div><%
|
||||
} %>
|
@@ -4,4 +4,4 @@
|
||||
<%@ Import Namespace="Orchard.Blogs.Models"%>
|
||||
<h2><%=Html.Link(Html.Encode(Model.Item.Name), Url.Blog(Model.Item.Slug)) %></h2>
|
||||
<% if (!string.IsNullOrEmpty(Model.Item.Description)) { %><p><%: Model.Item.Description %></p><% } %>
|
||||
<div class="blog metadata"><%: T("{0} post{1}", Model.Item.PostCount, Model.Item.PostCount == 1 ? "" : "s")%> | <%Html.Zone("meta");%></div>
|
||||
<div class="blog metadata"><%: T.Plural("1 post", "{0} posts", Model.Item.PostCount)%> | <%Html.Zone("meta");%></div>
|
||||
|
Reference in New Issue
Block a user