Bug 519958 - "makeFriendlyDateAgo improperly l10n'ified" [r=Standard8 ui-r=clarkbw a=blocking-tb3]
authorDavid Ascher <david.ascher@gmail.com>
Wed, 07 Oct 2009 16:06:25 +0100
changeset 4077 07c07166b28eb0ea4d04804bd3929f0b2f98fb7b
parent 4076 5e5004818ead7df0d9002516dd13a567d8890734
child 4078 d95028ef8a8715f142c25a5f7b27994a903fb14c
push idunknown
push userunknown
push dateunknown
reviewersStandard8, clarkbw, blocking-tb3
bugs519958
Bug 519958 - "makeFriendlyDateAgo improperly l10n'ified" [r=Standard8 ui-r=clarkbw a=blocking-tb3]
mailnews/base/util/templateUtils.js
--- a/mailnews/base/util/templateUtils.js
+++ b/mailnews/base/util/templateUtils.js
@@ -40,16 +40,18 @@ const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cr = Components.results;
 const Cu = Components.utils;
 
 Cu.import("resource://app/modules/StringBundle.js");
 
 const gTemplateUtilsStrings =
   new StringBundle("chrome://messenger/locale/templateUtils.properties");
+const gDownloadManagerStrings =
+  new StringBundle("chrome://mozapps/locale/downloads/downloads.properties");
 
 /**
  * Helper function to generate a localized "friendly" representation of
  * time relative to the present.  If the time input is "today", it returns
  * a string corresponding to just the time.  If it's yesterday, it returns
  * "yesterday" (localized).  If it's in the last week, it returns the day
  * of the week. If it's before that, it returns the date.
  *
@@ -86,29 +88,22 @@ function makeFriendlyDateAgo(time)
   } else if (today - end < k6DaysInMsecs) {
     // activity finished after last week started, show day of week
     dateTime = end.toLocaleFormat("%A");
   } else if (now.getFullYear() == end.getFullYear()) {
     // activity must have been from some time ago.. show month/day
     let month = end.toLocaleFormat("%B");
     // Remove leading 0 by converting the date string to a number
     let date = Number(end.toLocaleFormat("%d"));
-    //dateTime = replaceInsert(this.text.monthDate, 1, month);
-    dateTime = replaceInsert("#1 #2", 1, month);
+    let dayMonth = gDownloadManagerStrings.get("monthDate")
+    dateTime = replaceInsert(dayMonth, 1, month);
     dateTime = replaceInsert(dateTime, 2, date);
   } else {
-    // not this year, so show year as wel
-    let month = end.toLocaleFormat("%B");
-    let year = end.toLocaleFormat("%Y");
-    // Remove leading 0 by converting the date string to a number
-    let date = Number(end.toLocaleFormat("%d"));
-    //dateTime = replaceInsert(this.text.monthDate, 1, month);
-    dateTime = replaceInsert("#1 #2 #3", 1, month);
-    dateTime = replaceInsert(dateTime, 2, date);
-    dateTime = replaceInsert(dateTime, 3, year);
+    // not this year, so show full date format
+    dateTime = end.toLocaleDateString();
   }
   return dateTime;
 }
 
 /**
  * Helper function to replace a placeholder string with a real string
  *
  * @param aText