~ubuntu-branches/debian/squeeze/tasks/squeeze

« back to all changes in this revision

Viewing changes to libkoto/ical-util.c

  • Committer: Bazaar Package Importer
  • Author(s): Ross Burton
  • Date: 2008-09-29 10:24:11 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20080929102411-vv4quqpp2m0ppl3q
Tags: 0.14-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
 * Return a human-readable for the date @due, relative to the current date.
43
43
 */
44
44
char *
45
 
ical_util_get_human_date (GDate *due)
 
45
ical_util_get_human_due_date (GDate *due)
46
46
{
47
47
  GDate today;
48
48
  int days;
55
55
 
56
56
  days = g_date_days_between (&today, due);
57
57
  if (days == 0)
58
 
    return g_strdup (_("today"));
 
58
    return g_strdup (_("due today"));
59
59
  else if (days == 1)
60
 
    return g_strdup (_("tomorrow"));
 
60
    return g_strdup (_("due tomorrow"));
61
61
  else if (days == -1)
62
 
    return g_strdup (_("yesterday"));
 
62
    return g_strdup (_("due yesterday"));
63
63
  else if (days > 1 && days < 7) {
64
64
    /* Return name of the day if it is in the next 6 days */
65
65
    g_date_add_days (&today, days);
66
 
    g_date_strftime (buffer, sizeof (buffer), "%A", &today);
 
66
    g_date_strftime (buffer, sizeof (buffer), _("due %A"), &today);
67
67
    return g_strdup (buffer);
68
68
  } else {
69
69
    /* Fallback to returning the preferred date representation */
70
 
    g_date_strftime (buffer, sizeof (buffer), "%x", due);
 
70
    g_date_strftime (buffer, sizeof (buffer), _("due %x"), due);
71
71
    return g_strdup (buffer);
72
72
  }
73
73
}