Commit bcb4e587 authored by Felix Häcker's avatar Felix Häcker

Merge branch 'duplicates-in-remaining-time' into 'master'

Fix possible duplicates in plurals

Closes #75 und #70

See merge request !74
parents 3d0c6699 30e83c1b
Pipeline #181953 canceled with stage
in 3 minutes and 42 seconds
......@@ -11,21 +11,21 @@ public interface org.freedesktop.FileManager1 : Object {
public class Fragments.Utils{
public static string time_to_string (uint total_seconds) {
if (total_seconds > 86400) return "more than a day";
if (total_seconds > 86400) return _("more than a day");
uint seconds = (total_seconds % 60);
uint minutes = (total_seconds % 3600) / 60;
uint hours = (total_seconds % 86400) / 3600;
uint days = (total_seconds % (86400 * 30)) / 86400;
var str_days = ngettext ("%u day", "%u days left", days).printf (days);
var str_hours = ngettext ("%u hour", "%u hours left", hours).printf (hours);
var str_minutes = ngettext ("%u minute", "%u minutes left", minutes).printf (minutes);
var str_seconds = ngettext ("%u second", "%u seconds left", seconds).printf (seconds);
var str_days = ngettext ("%u day", "%u days", days).printf (days);
var str_hours = ngettext ("%u hour", "%u hours", hours).printf (hours);
var str_minutes = ngettext ("%u minute", "%u minutes", minutes).printf (minutes);
var str_seconds = ngettext ("%u second", "%u seconds", seconds).printf (seconds);
if (days > 0) return "%s, %s".printf (str_days, str_hours);
if (hours > 0) return "%s, %s".printf (str_hours, str_minutes);
if (minutes > 0) return "%s".printf (str_minutes);
if (minutes > 0) return str_minutes;
if (seconds > 0) return str_seconds;
return "";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment