Merge lp:~gunnarhj/ubuntu/raring/evolution-data-server/days-months into lp:ubuntu/raring/evolution-data-server

Proposed by Gunnar Hjalmarsson
Status: Work in progress
Proposed branch: lp:~gunnarhj/ubuntu/raring/evolution-data-server/days-months
Merge into: lp:ubuntu/raring/evolution-data-server
Diff against target: 136 lines (+118/-0)
3 files modified
debian/changelog (+8/-0)
debian/patches/01_days_months_in_current_language.patch (+109/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~gunnarhj/ubuntu/raring/evolution-data-server/days-months
Reviewer Review Type Date Requested Status
Jamie Strandboge Needs Information
Mathieu Trudel-Lapierre Pending
Ubuntu branches Pending
Review via email: mp+159975@code.launchpad.net

Commit message

debian/patches/01_days_months_in_current_language.patch:
Display names of weekdays and months in the current language
(LP: #1160441).

To post a comment you must log in.
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

The patch states "Forwarded: no". Does this not affect upstream?

review: Needs Information
Revision history for this message
Iain Lane (laney) wrote :

Any news on that question?

Unmerged revisions

186. By Gunnar Hjalmarsson

debian/patches/01_days_months_in_current_language.patch:
Display names of weekdays and months in the current language
(LP: #1160441).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2013-03-21 11:01:22 +0000
+++ debian/changelog 2013-04-21 12:10:34 +0000
@@ -1,3 +1,11 @@
1evolution-data-server (3.6.4-0ubuntu2) UNRELEASED; urgency=low
2
3 * debian/patches/01_days_months_in_current_language.patch:
4 Display names of weekdays and months in the current language
5 (LP: #1160441).
6
7 -- Gunnar Hjalmarsson <gunnarhj@ubuntu.com> Sun, 21 Apr 2013 13:09:00 +0200
8
1evolution-data-server (3.6.4-0ubuntu1) raring; urgency=low9evolution-data-server (3.6.4-0ubuntu1) raring; urgency=low
210
3 * New upstream release.11 * New upstream release.
412
=== added directory 'debian/patches'
=== added file 'debian/patches/01_days_months_in_current_language.patch'
--- debian/patches/01_days_months_in_current_language.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/01_days_months_in_current_language.patch 2013-04-21 12:10:34 +0000
@@ -0,0 +1,109 @@
1Description: Display names of weekdays and months in the current language
2Bug: https://launchpad.net/bugs/1160441
3Forwarded: no
4Author: Gunnar Hjalmarsson <gunnarhj@ubuntu.com>
5
6--- evolution-data-server-3.6.4.orig/libedataserver/e-data-server-util.c 2012-11-13 10:12:28 +0000
7+++ evolution-data-server-3.6.4/libedataserver/e-data-server-util.c 2013-04-21 03:42:42 +0200
8@@ -21,6 +21,7 @@
9
10 #include "config.h"
11
12+#include <locale.h>
13 #include <string.h>
14 #include <sys/stat.h>
15 #include <time.h>
16@@ -584,6 +585,75 @@
17 }
18
19 /**
20+ * Helper for e_strftime()
21+ *
22+ * Translate names of days and months using the current language by
23+ * splitting a format specification and applying a suitable locale
24+ * when converting respective token.
25+ **/
26+static gsize
27+strftime_days_months (gchar *string,
28+ gsize max,
29+ const gchar *fmt,
30+ const struct tm *tm)
31+{
32+ gchar *tmp = NULL;
33+ gint i, j;
34+ gchar formatted_token[100];
35+
36+ gchar **tokens = g_strsplit (fmt, " ", 0);
37+
38+ /* Conversion specifications for names of days and months */
39+ const gchar *dm_names[] = { "%a", "%A", "%b", "%B", "%h", NULL };
40+
41+ /* Get some locale info */
42+ const gchar *time_locale = setlocale (LC_TIME, NULL);
43+ const gchar *message_locale = setlocale (LC_MESSAGES, NULL);
44+
45+ for (i = 0; tokens[i] != NULL; i++)
46+ {
47+ gboolean is_day_month = FALSE;
48+
49+ for (j = 0; dm_names[j] != NULL; j++) {
50+ if (g_strrstr (tokens[i], dm_names[j]) != NULL) {
51+ is_day_month = TRUE;
52+ break;
53+ }
54+ }
55+
56+ if (is_day_month)
57+ setlocale (LC_TIME, message_locale);
58+ else
59+ setlocale (LC_TIME, time_locale);
60+
61+ if (strlen (tokens[i]) == 0)
62+ formatted_token[0] = '\0';
63+ else {
64+ if (!strftime (formatted_token, max, tokens[i], tm)) {
65+ g_free (tmp);
66+ break;
67+ }
68+ }
69+
70+ if (i == 0)
71+ tmp = g_strdup (formatted_token);
72+ else
73+ tmp = g_strjoin (" ", tmp, formatted_token, NULL);
74+ }
75+
76+ /* Reset the locale */
77+ setlocale (LC_TIME, time_locale);
78+
79+ g_strfreev (tokens);
80+ if (!tmp)
81+ return 0;
82+
83+ strcpy (string, tmp);
84+ g_free (tmp);
85+ return strlen (string);
86+}
87+
88+/**
89 * e_strftime:
90 * @string: The string array to store the result in.
91 * @max: The size of array @s.
92@@ -612,7 +682,7 @@
93 g_return_val_if_fail (tm != NULL, 0);
94
95 #ifdef HAVE_LKSTRFTIME
96- ret = strftime (string, max, fmt, tm);
97+ ret = strftime_days_months (string, max, fmt, tm);
98 #else
99 ffmt = g_strdup (fmt);
100 ff = ffmt;
101@@ -636,7 +706,7 @@
102 }
103 #endif
104
105- ret = strftime (string, max, ffmt, tm);
106+ ret = strftime_days_months (string, max, ffmt, tm);
107 g_free (ffmt);
108 #endif
109
0110
=== added file 'debian/patches/series'
--- debian/patches/series 1970-01-01 00:00:00 +0000
+++ debian/patches/series 2013-04-21 12:10:34 +0000
@@ -0,0 +1,1 @@
101_days_months_in_current_language.patch

Subscribers

People subscribed via source and target branches