aboutsummaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
Diffstat (limited to 'main/src')
-rw-r--r--main/src/ui/conversation_selector/conversation_row.vala15
-rw-r--r--main/src/ui/conversation_summary/message_item.vala19
-rw-r--r--main/src/ui/util.vala7
3 files changed, 31 insertions, 10 deletions
diff --git a/main/src/ui/conversation_selector/conversation_row.vala b/main/src/ui/conversation_selector/conversation_row.vala
index d05973db..2e7e321a 100644
--- a/main/src/ui/conversation_selector/conversation_row.vala
+++ b/main/src/ui/conversation_selector/conversation_row.vala
@@ -170,17 +170,22 @@ public abstract class ConversationRow : ListBoxRow {
if (timespan > 365 * TimeSpan.DAY) {
return datetime.get_year().to_string();
} else if (timespan > 7 * TimeSpan.DAY) {
- return datetime.format("%d.%m");
+ // Day and month
+ // xgettext:no-c-format
+ return datetime.format(_("%b %d"));
} else if (timespan > 2 * TimeSpan.DAY) {
return datetime.format("%a");
} else if (timespan > 1 * TimeSpan.DAY) {
- return "Yesterday";
+ return _("Yesterday");
} else if (timespan > 9 * TimeSpan.MINUTE) {
- return datetime.format("%H:%M");
+ return datetime.format(Util.is_24h_format() ?
+ /* xgettext:no-c-format */ /* Time in 24h format (w/o seconds) */ _("%H\u2236%M") :
+ /* xgettext:no-c-format */ /* Time in 12h format (w/o seconds) */ _("%l\u2236%M %p"));
} else if (timespan > 1 * TimeSpan.MINUTE) {
- return (timespan / TimeSpan.MINUTE).to_string() + " min ago";
+ ulong mins = (ulong) (timespan.abs() / TimeSpan.MINUTE);
+ return n("%i min ago", "%i mins ago", mins).printf(mins);
} else {
- return "Just now";
+ return _("Just now");
}
}
}
diff --git a/main/src/ui/conversation_summary/message_item.vala b/main/src/ui/conversation_summary/message_item.vala
index 4b26a289..74d46805 100644
--- a/main/src/ui/conversation_summary/message_item.vala
+++ b/main/src/ui/conversation_summary/message_item.vala
@@ -94,15 +94,24 @@ public class MessageItem : Grid, ConversationItem {
DateTime now = new DateTime.now_local();
TimeSpan timespan = now.difference(datetime);
if (timespan > 365 * TimeSpan.DAY) {
- return datetime.format("%d.%m.%Y %H:%M");
+ return datetime.format(Util.is_24h_format() ?
+ /* xgettext:no-c-format */ /* Date + time in 24h format (w/o seconds) */ _("%x, %H\u2236%M") :
+ /* xgettext:no-c-format */ /* Date + time in 12h format (w/o seconds)*/ _("%x, %l\u2236%M %p"));
} else if (timespan > 7 * TimeSpan.DAY) {
- return datetime.format("%d.%m %H:%M");
+ return datetime.format(Util.is_24h_format() ?
+ /* xgettext:no-c-format */ /* Month, day and time in 24h format (w/o seconds) */ _("%b %d, %H\u2236%M") :
+ /* xgettext:no-c-format */ /* Month, day and time in 12h format (w/o seconds) */ _("%b %d, %l\u2236%M %p"));
} else if (timespan > 1 * TimeSpan.DAY) {
- return datetime.format("%a, %H:%M");
+ return datetime.format(Util.is_24h_format() ?
+ /* xgettext:no-c-format */ /* Day of week and time in 12h format (w/o seconds) */ _("%a, %H\u2236%M") :
+ /* xgettext:no-c-format */ _("%a, %l\u2236%M %p"));
} else if (timespan > 9 * TimeSpan.MINUTE) {
- return datetime.format("%H:%M");
+ return datetime.format(Util.is_24h_format() ?
+ /* xgettext:no-c-format */ /* Time in 24h format (w/o seconds) */ _("%H\u2236%M") :
+ /* xgettext:no-c-format */ /* Time in 12h format (w/o seconds) */ _("%l\u2236%M %p"));
} else if (timespan > TimeSpan.MINUTE) {
- return (timespan / TimeSpan.MINUTE).to_string() + " min ago";
+ ulong mins = (ulong) (timespan.abs() / TimeSpan.MINUTE);
+ return n("%i min ago", "%i mins ago", mins).printf(mins);
} else {
return _("Just now");
}
diff --git a/main/src/ui/util.vala b/main/src/ui/util.vala
index 4df785c0..696ce2d1 100644
--- a/main/src/ui/util.vala
+++ b/main/src/ui/util.vala
@@ -112,6 +112,13 @@ public class Util : Object {
Gdk.RGBA bg = widget.get_style_context().get_background_color(StateFlags.NORMAL);
return (bg.red < 0.5 && bg.green < 0.5 && bg.blue < 0.5);
}
+
+ public static bool is_24h_format() {
+ GLib.Settings settings = new GLib.Settings("org.gnome.desktop.interface");
+ string settings_format = settings.get_string("clock-format");
+ string p_format = (new DateTime.now_local()).format("%p");
+ return settings_format == "24h" || p_format == " ";
+ }
}
} \ No newline at end of file