From 887a487b8650014642bec28260246e88f1f6fa72 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Wed, 16 Mar 2011 23:21:13 +0000 Subject: [PATCH] [controller] make date format localisable and only show the year if it's a different year --- SparkleShare/SparkleController.cs | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/SparkleShare/SparkleController.cs b/SparkleShare/SparkleController.cs index dd5e5d6a..742c3e34 100644 --- a/SparkleShare/SparkleController.cs +++ b/SparkleShare/SparkleController.cs @@ -15,8 +15,6 @@ // along with this program. If not, see . -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 ("", - "" + activity_day.DateTime.ToString ("ddd MMM d, yyyy") + ""); + if (activity_day.DateTime.Year != DateTime.Now.Year) { + + // TRANSLATORS: This is the date in the event logs + day_entry = day_entry_html.Replace ("", + "" + activity_day.DateTime.ToString (_("ddd MMM d, yyyy")) + ""); + + } else { + + // TRANSLATORS: This is the date in the event logs, without the year + day_entry = day_entry_html.Replace ("", + "" + activity_day.DateTime.ToString (_("ddd MMM d")) + ""); + + } }