[controller] make date format localisable and only show the year if it's a different year

This commit is contained in:
Hylke Bons 2011-03-16 23:21:13 +00:00
parent 11700b0850
commit 887a487b86

View file

@ -15,8 +15,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using Mono.Unix;
using SparkleLib;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@ -28,6 +26,9 @@ using System.Xml;
using System.Security.Cryptography;
using System.Text;
using Mono.Unix;
using SparkleLib;
namespace SparkleShare {
public abstract class SparkleController {
@ -76,6 +77,13 @@ namespace SparkleShare {
public delegate void NotificationRaisedEventHandler (SparkleCommit commit, string repository_path);
// Short alias for the translations
public static string _ (string s)
{
return Catalog.GetString (s);
}
public SparkleController ()
{
@ -399,8 +407,19 @@ namespace SparkleShare {
} else {
day_entry = day_entry_html.Replace ("<!-- $day-entry-header -->",
"<b>" + activity_day.DateTime.ToString ("ddd MMM d, yyyy") + "</b>");
if (activity_day.DateTime.Year != DateTime.Now.Year) {
// TRANSLATORS: This is the date in the event logs
day_entry = day_entry_html.Replace ("<!-- $day-entry-header -->",
"<b>" + activity_day.DateTime.ToString (_("ddd MMM d, yyyy")) + "</b>");
} else {
// TRANSLATORS: This is the date in the event logs, without the year
day_entry = day_entry_html.Replace ("<!-- $day-entry-header -->",
"<b>" + activity_day.DateTime.ToString (_("ddd MMM d")) + "</b>");
}
}