[gnote] Make last change format more compact



commit cb41c907b8850f87e956b5dd6b05e2825d46113f
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sat Jul 20 22:25:35 2013 +0300

    Make last change format more compact
    
    Fixes Bug 704113.

 src/test/dttest.cpp |   12 ++----------
 src/utils.cpp       |   38 ++------------------------------------
 2 files changed, 4 insertions(+), 46 deletions(-)
---
diff --git a/src/test/dttest.cpp b/src/test/dttest.cpp
index b7c47ce..adb1607 100644
--- a/src/test/dttest.cpp
+++ b/src/test/dttest.cpp
@@ -1,6 +1,7 @@
 /*
  * gnote
  *
+ * Copyright (C) 2013 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -34,7 +35,6 @@ bool string_ends_with(const std::string & s, const std::string & other)
 
 int test_main(int /*argc*/, char ** /*argv*/)
 {
-  std::string format = "%Y-%m-%dT%T  7f@%z";
   sharp::DateTime d(678901234, 67890);
 
   std::string date_string = sharp::XmlConvert::to_string(d);
@@ -62,25 +62,17 @@ int test_main(int /*argc*/, char ** /*argv*/)
   date_string = gnote::utils::get_pretty_print_date(d4, false, false);
   BOOST_CHECK(date_string == "Tomorrow");
 
-  d4.add_days(2);
-  date_string = gnote::utils::get_pretty_print_date(d4, false, false);
-  BOOST_CHECK(date_string == "In 3 days");
-
   sharp::DateTime d5 = sharp::DateTime::now();
   d5.add_days(-1);
   date_string = gnote::utils::get_pretty_print_date(d5, false, false);
   BOOST_CHECK(date_string == "Yesterday");
 
-  d5.add_days(-3);
-  date_string = gnote::utils::get_pretty_print_date(d5, false, false);
-  BOOST_CHECK(date_string == "4 days ago");
-
   sharp::DateTime d6 = sharp::DateTime::from_iso8601("2009-03-24T13:34:35.2914680-04:00");
   date_string = gnote::utils::get_pretty_print_date(d6, true, false);
   BOOST_CHECK(string_ends_with(date_string, "19:34"));
 
   date_string = gnote::utils::get_pretty_print_date(d6, true, true);
-  BOOST_CHECK(string_ends_with(date_string, "7:34 PM"));
+  BOOST_CHECK(string_ends_with(date_string, "7:34 pm"));
 
   return 0;
 }
diff --git a/src/utils.cpp b/src/utils.cpp
index df52a15..c78f57d 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -219,23 +219,6 @@ namespace gnote {
             str(boost::format(_("Yesterday, %1%")) % short_time) :
             _("Yesterday");
         }
-        else if ((date.day_of_year() < now.day_of_year())
-                  && (date.day_of_year() > now.day_of_year() - 6)) {
-          int num_days = now.day_of_year() - date.day_of_year();
-          const char * fmt;
-          if(show_time) {
-            /* TRANSLATORS: 2 or more days ago, up to one week.
-               First argument is number of days, second is time. */
-            fmt = ngettext("%1% day ago, %2%", "%1% days ago, %2%", num_days);
-            pretty_str = str(boost::format(fmt) % num_days % short_time);
-          }
-          else {
-            /* TRANSLATORS: 2 or more days ago, up to one week.
-               Argument is number of days. */
-            fmt = ngettext("%1% day ago", "%1% days ago", num_days);
-            pretty_str = str(boost::format(fmt) % num_days);
-          }
-        }
         else if (date.day_of_year() > now.day_of_year()
                  && date.day_of_year() == now.day_of_year() + 1) {
           pretty_str = show_time ?
@@ -243,26 +226,9 @@ namespace gnote {
             str(boost::format(_("Tomorrow, %1%")) % short_time) :
             _("Tomorrow");
         }
-        else if (date.day_of_year() > now.day_of_year()
-                 && date.day_of_year() < now.day_of_year() + 6) {
-          int num_days = date.day_of_year() - now.day_of_year();
-          const char * fmt;
-          if(show_time) {
-            /* TRANSLATORS: In 2 or more days, up to one week.
-               First argument is number of days, second is time. */
-            fmt = ngettext("In %1% day, %2%", "In %1% days, %2%", num_days);
-            pretty_str = str(boost::format(fmt) % num_days % short_time); 
-          }
-          else {
-            /* TRANSLATORS: In 2 or more days, up to one week.
-               Argument is number of days. */
-            fmt = ngettext("In %1% day", "In %1% days", num_days);
-            pretty_str = str(boost::format(fmt) % num_days);
-          }
-        }
         else {
           /* TRANSLATORS: date in current year. */
-          pretty_str = date.to_string(_("%B %d")); // "MMMM d"
+          pretty_str = date.to_string(_("%b %d")); // "MMMM d"
           if(show_time) {
             /* TRANSLATORS: first argument is date, second is time. */
             pretty_str = str(boost::format(_("%1%, %2%")) % pretty_str % short_time);
@@ -274,7 +240,7 @@ namespace gnote {
       }
       else {
         /* TRANSLATORS: date in other than current year. */
-        pretty_str = date.to_string(_("%B %d %Y")); // "MMMM d yyyy"
+        pretty_str = date.to_string(_("%b %d %Y")); // "MMMM d yyyy"
         if(show_time) {
           /* TRANSLATORS: first argument is date, second is time. */
           pretty_str = str(boost::format(_("%1%, %2%")) % pretty_str % short_time);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]