[shotwell] Sort out locale-dependent times



commit 45dfd3402677d91d9efaea99f4fb6eb7a630c299
Author: Jens Georg <mail jensge org>
Date:   Tue Aug 16 21:02:34 2016 +0200

    Sort out locale-dependent times
    
    Signed-off-by: Jens Georg <mail jensge org>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=716533

 Makefile.am        |    1 +
 shotwell.am        |    2 +-
 src/Resources.vala |    6 +++---
 vapi/langinfo.vapi |   25 +++++++++++++++++++++++++
 4 files changed, 30 insertions(+), 4 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index c133334..a4dda52 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -146,6 +146,7 @@ dist_noinst_DATA += \
        plugins/shotwell-plugin-common.h \
        vapi/gphoto.h \
        vapi/LConv.vapi \
+       vapi/langinfo.vapi \
        vapi/libexif.vapi \
        vapi/libgphoto2.vapi \
        vapi/libraw.vapi \
diff --git a/shotwell.am b/shotwell.am
index fa157d4..8bb6d21 100644
--- a/shotwell.am
+++ b/shotwell.am
@@ -16,7 +16,7 @@ shotwell_VALAFLAGS = $(COMMON_VALAFLAGS) \
        --vapidir $(abs_top_srcdir)/vapi \
        --pkg libgphoto2 --pkg posix --pkg LConv --pkg libraw --pkg gexiv2 \
        --pkg libexif --pkg gudev-1.0 --pkg gstreamer-1.0 \
-       --pkg gstreamer-pbutils-1.0 \
+       --pkg gstreamer-pbutils-1.0 --pkg langinfo \
        $(UNITY_VALAFLAGS) \
        $(COMMON_VALAFLAGS_POST)
 
diff --git a/src/Resources.vala b/src/Resources.vala
index acc933c..4fe1f69 100644
--- a/src/Resources.vala
+++ b/src/Resources.vala
@@ -770,13 +770,13 @@ along with Shotwell; if not, write to the Free Software Foundation, Inc.,
         /// Locale-specific time format for 12-hour time, i.e. 8:31 PM
         /// Precede modifier with a dash ("-") to pad with spaces, otherwise will pad with zeroes
         /// See http://developer.gnome.org/glib/2.32/glib-GDateTime.html#g-date-time-format
-        HH_MM_FORMAT_STRING = _("%-I:%M %p");
+        HH_MM_FORMAT_STRING = "%X";
         
         /// Locale-specific time format for 12-hour time with seconds, i.e. 8:31:42 PM
         /// Precede modifier with a dash ("-") to pad with spaces, otherwise will pad with zeroes
         /// See http://developer.gnome.org/glib/2.32/glib-GDateTime.html#g-date-time-format
-        HH_MM_SS_FORMAT_STRING = _("%-I:%M:%S %p");
-        
+        HH_MM_SS_FORMAT_STRING = Nl.langinfo (Nl.Item.T_FMT);
+
         /// Locale-specific calendar date format, i.e. "Tue Mar 08, 2006"
         /// See http://developer.gnome.org/glib/2.32/glib-GDateTime.html#g-date-time-format
         LONG_DATE_FORMAT_STRING = _("%a %b %d, %Y");
diff --git a/vapi/langinfo.vapi b/vapi/langinfo.vapi
new file mode 100644
index 0000000..46903c5
--- /dev/null
+++ b/vapi/langinfo.vapi
@@ -0,0 +1,25 @@
+/* Copyright 2016 Jens Georg <mail jensge org>
+ *
+ * This software is licensed under the GNU LGPL (version 2.1 or later).
+ * See the COPYING file in this distribution.
+ */
+namespace Nl {
+    [CCode (cname="nl_item", cheader_filename = "langinfo.h")]
+    enum Item {
+        [CCode (cname="CODESET")]
+        CODESET,
+        [CCode (cname="D_T_FMT")]
+        D_T_FMT,
+        [CCode (cname="D_FMT")]
+        D_FMT,
+        [CCode (cname="T_FMT")]
+        T_FMT,
+        [CCode (cname="THOUSEP")]
+        THOUSEP,
+        [CCode (cname="RADIXCHAR")]
+        RADIXCHAR
+    }
+
+    [CCode (cheader_filename = "langinfo.h")]
+    static unowned string? langinfo (Item item);
+}


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