mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-12-02 11:44:41 +08:00
#18776: Fixing month localization in Blog Archives
Work Item: 18776 --HG-- branch : 1.x
This commit is contained in:
@@ -4,6 +4,8 @@
|
|||||||
Style.Require("BlogsArchives");
|
Style.Require("BlogsArchives");
|
||||||
Script.Require("BlogsArchives");
|
Script.Require("BlogsArchives");
|
||||||
IEnumerable<KeyValuePair<ArchiveData, int>> archives = Model.Archives;
|
IEnumerable<KeyValuePair<ArchiveData, int>> archives = Model.Archives;
|
||||||
|
var dateTimeLocalization = WorkContext.Resolve<Orchard.Core.Shapes.Localization.IDateTimeLocalization>();
|
||||||
|
var monthNames = dateTimeLocalization.MonthNames.Text.Split(new [] {','}, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).ToArray();
|
||||||
}
|
}
|
||||||
<div class="archives">
|
<div class="archives">
|
||||||
@if (archives.Count() > 20) {
|
@if (archives.Count() > 20) {
|
||||||
@@ -18,21 +20,21 @@
|
|||||||
if (year == lastYear) {
|
if (year == lastYear) {
|
||||||
<li>
|
<li>
|
||||||
<h4>@year</h4>
|
<h4>@year</h4>
|
||||||
@Html.UnorderedList(yearMonths, (t, i) => Html.Link(string.Format("{0:MMMM} ({1})", t.Key.ToDateTime(), t.Value), Url.BlogArchiveMonth((BlogPart)Model.Blog, t.Key.Year, t.Key.Month)), "archiveMonthList")
|
@Html.UnorderedList(yearMonths, (t, i) => Html.Link(string.Format("{0} ({1})", monthNames[t.Key.ToDateTime().Month], t.Value), Url.BlogArchiveMonth((BlogPart)Model.Blog, t.Key.Year, t.Key.Month)), "archiveMonthList")
|
||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
|
|
||||||
if (year != lastYear) {
|
if (year != lastYear) {
|
||||||
<li class="previous">
|
<li class="previous">
|
||||||
<h4>@year <span>(@yearMonths.Sum(ym => ym.Value))</span></h4>
|
<h4>@year <span>(@yearMonths.Sum(ym => ym.Value))</span></h4>
|
||||||
@Html.UnorderedList(yearMonths, (t, i) => Html.Link(string.Format("{0:MMMM} ({1})", t.Key.ToDateTime(), t.Value), Url.BlogArchiveMonth((BlogPart)Model.Blog, t.Key.Year, t.Key.Month)), "archiveMonthList")
|
@Html.UnorderedList(yearMonths, (t, i) => Html.Link(string.Format("{0} ({1})", monthNames[t.Key.ToDateTime().Month], t.Value), Url.BlogArchiveMonth((BlogPart)Model.Blog, t.Key.Year, t.Key.Month)), "archiveMonthList")
|
||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</ul>
|
</ul>
|
||||||
}
|
}
|
||||||
else if (archives.Count() > 0) {
|
else if (archives.Count() > 0) {
|
||||||
@Html.UnorderedList(archives, (t, i) => Html.Link(string.Format("{0:MMMM yyyy} ({1})", t.Key.ToDateTime(), t.Value), Url.BlogArchiveMonth((BlogPart)Model.Blog, t.Key.Year, t.Key.Month)), "archiveMonthList")
|
@Html.UnorderedList(archives, (t, i) => Html.Link(string.Format("{0} {2} ({1})", monthNames[t.Key.ToDateTime().Month], t.Value, t.Key.ToDateTime().Year), Url.BlogArchiveMonth((BlogPart)Model.Blog, t.Key.Year, t.Key.Month)), "archiveMonthList")
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
<div class="message info">@T("None found")</div>
|
<div class="message info">@T("None found")</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user