Index: panel-plugin/time-out-countdown.c =================================================================== --- panel-plugin/time-out-countdown.c (revision 7841) +++ panel-plugin/time-out-countdown.c (working copy) @@ -416,6 +416,11 @@ } else { + + gchar * hrs = g_strdup_printf (ngettext ("%d hour", "%d hours", hours), hours); + gchar * mins = g_strdup_printf (ngettext ("%d minute", "%d minutes", minutes), minutes); + gchar * secs = g_strdup_printf (ngettext("%d second", "%d seconds", seconds), seconds); + if (display_hours) { if (display_seconds) @@ -424,88 +429,38 @@ { if (minutes <= 0) { - if (seconds <= 1) - g_string_printf (str, _("Time left: 1 second")); - else - g_string_printf (str, _("Time left: %d seconds"), seconds); + /* Translators: this is %s seconds/minutes/hours */ + g_string_printf (str, _("Time left: %s"), secs); } - else if (minutes == 1) - { - if (seconds <= 0) - g_string_printf (str, _("Time left: 1 minute")); - else if (seconds == 1) - g_string_printf (str, _("Time left: 1 minute 1 second")); - else - g_string_printf (str, _("Time left: 1 minute %d seconds"), seconds); - } else { if (seconds <= 0) - g_string_printf (str, _("Time left: %d minutes"), minutes); - else if (seconds == 1) - g_string_printf (str, _("Time left: %d minutes 1 second"), minutes); + g_string_printf (str, _("Time left: %s"), mins); else - g_string_printf (str, _("Time left: %d minutes %d seconds"), minutes, seconds); + /* Translators: this is %s minutes, %s seconds */ + g_string_printf (str, _("Time left: %s %s"), mins, secs); } } - else if (hours == 1) - { - if (minutes <= 0) - { - if (seconds <= 0) - g_string_printf (str, _("Time left: 1 hour")); - if (seconds == 1) - g_string_printf (str, _("Time left: 1 hour 1 second")); - else - g_string_printf (str, _("Time left: 1 hour %d seconds"), seconds); - } - else if (minutes == 1) - { - if (seconds <= 0) - g_string_printf (str, _("Time left: 1 hour 1 minute")); - else if (seconds == 1) - g_string_printf (str, _("Time left: 1 hour 1 minute 1 second")); - else - g_string_printf (str, _("Time left: 1 hour 1 minute %d seconds"), seconds); - } - else - { - if (seconds <= 0) - g_string_printf (str, _("Time left: 1 hour %d minutes"), minutes); - if (seconds == 1) - g_string_printf (str, _("Time left: 1 hour %d minutes 1 second"), minutes); - else - g_string_printf (str, _("Time left: 1 hour %d minutes %d seconds"), minutes, seconds); - } - } else { if (minutes <= 0) { if (seconds <= 0) - g_string_printf (str, _("Time left: %d hours"), hours); - else if (seconds == 1) - g_string_printf (str, _("Time left: %d hours 1 second"), hours); - else - g_string_printf (str, _("Time left: %d hours %d seconds"), hours, seconds); + g_string_printf (str, _("Time left: %s"), hrs); + else + { + /* Translators: this is %s hours %s seconds */ + g_string_printf (str, _("Time left: %s %s"), hrs, secs); + } } - else if (minutes == 1) - { - if (seconds <= 0) - g_string_printf (str, _("Time left: %d hours 1 minute"), hours); - else if (seconds == 1) - g_string_printf (str, _("Time left: %d hours 1 minute 1 second"), hours); - else - g_string_printf (str, _("Time left: %d hours 1 minute %d seconds"), hours, seconds); - } else { if (seconds <= 0) - g_string_printf (str, _("Time left: %d hours %d minutes"), hours, minutes); - else if (seconds == 1) - g_string_printf (str, _("Time left: %d hours %d minutes 1 second"), hours, minutes); + /* Translators: this is %s hours, %s minutes */ + g_string_printf (str, _("Time left: %s %s"), hrs, mins); else - g_string_printf (str, _("Time left: %d hours %d minutes %d seconds"), hours, minutes, seconds); + /* Translators: this is %s hours, %s minutes, %s seconds */ + g_string_printf (str, _("Time left: %s %s %s"), hrs, mins, secs); } } } @@ -515,35 +470,37 @@ { if (minutes < 1) { - g_string_printf (str, _("Time left: 1 minute")); + /* Do not show 0 minutes */ + minutes = 1; } - else + if (seconds == 0) + g_string_printf (str, _("Time left: %s"), mins); + else { - if (seconds == 0) - g_string_printf (str, _("Time left: %d minutes"), minutes); - else - g_string_printf (str, _("Time left: %d minutes"), minutes + 1); + /* Round up the number of minutes */ + mins = g_strdup_printf (ngettext ("%d minute", "%d minutes", minutes), minutes + 1); + g_string_printf (str, _("Time left: %s"), mins); + g_free (mins); } } - else if (hours == 1) - { - if (minutes < 1) - g_string_printf (str, _("Time left: 1 hour 1 minute")); - else - if (seconds == 0) - g_string_printf (str, _("Time left: 1 hour %d minutes"), minutes); - else - g_string_printf (str, _("Time left: 1 hour %d minutes"), minutes + 1); - } else { if (minutes < 1) - g_string_printf (str, _("Time left: %d hours 1 minute"), hours); + { + /* Do not show 0 minutes */ + minutes = 1; + } + if (seconds == 0) + /* Translators: this is %s hours, %s minutes */ + g_string_printf (str, _("Time left: %s %s"), hrs, mins); else - if (seconds == 0) - g_string_printf (str, _("Time left: %d hours %d minutes"), hours, minutes); - else - g_string_printf (str, _("Time left: %d hours %d minutes"), hours, minutes + 1); + { + /* Round up the number of minutes */ + mins = g_strdup_printf (ngettext ("%d minute", "%d minutes", minutes), minutes + 1); + /* Translators: this is %s hours, %s minutes */ + g_string_printf (str, _("Time left: %s %s"), hrs, mins); + g_free (mins); + } } } } @@ -555,43 +512,37 @@ { if (minutes <= 0) { - if (seconds <= 1) - g_string_printf (str, _("Time left: 1 second")); - else - g_string_printf (str, _("Time left: %d seconds"), seconds); + g_string_printf (str, _("Time left: %s"), secs); } - else if (minutes == 1) + else { if (seconds <= 0) - g_string_printf (str, _("Time left: 1 minute")); - else if (seconds == 1) - g_string_printf (str, _("Time left: 1 minute 1 second")); + g_string_printf (str, _("Time left: %s"), mins); else - g_string_printf (str, _("Time left: 1 minute %d seconds"), seconds); + /* Translators: this is %s minutes %s seconds */ + g_string_printf (str, _("Time left: %s %s"), mins, secs); } - else - { - if (seconds <= 0) - g_string_printf (str, _("Time left: %d minutes"), minutes); - else if (seconds == 1) - g_string_printf (str, _("Time left: %d minutes 1 second"), minutes); - else - g_string_printf (str, _("Time left: %d minutes %d seconds"), minutes, seconds); - } } else { - if (minutes < 1) - g_string_printf (str, _("Time left: 1 minute")); + if (minutes < 1) + { + /* Do not show 0 minutes */ + minutes = 1; + } + if (seconds == 0) + g_string_printf (str, _("Time left: %s"), mins); else - if (seconds == 0) - g_string_printf (str, _("Time left: %d minutes"), minutes); - else - g_string_printf (str, _("Time left: %d minutes"), minutes + 1); + { + /* Round up the number of minutes */ + mins = g_strdup_printf (ngettext ("%d minute", "%d minutes", minutes), minutes + 1); + g_string_printf (str, _("Time left: %s"), mins); + g_free (mins); + } } } + g_free (hrs), g_free (mins), g_free (secs); } - /* Return generated string */ return str; }