229
229
g_type_class_add_private (gobject_class, sizeof (GnomeWallClockPrivate));
232
/* Some of our translations use the ratio symbol which isn't
233
* convertible to non-UTF-8 locale encodings.
236
filter_ratio_for_locale (const char *input)
238
char **pieces = NULL;
241
if (g_get_charset (NULL)) /* UTF-8 is ok */
242
return g_strdup (input);
244
/* else, we'll replace ratio with a plain colon */
245
pieces = g_strsplit (input, "∶", -1);
246
output = g_strjoinv (":", pieces);
233
252
update_clock (gpointer data)
235
254
GnomeWallClock *self = data;
236
255
GDesktopClockFormat clock_format;
237
256
const char *format_string;
257
char *safe_format_string;
238
258
gboolean show_full_date;
239
259
gboolean show_weekday;
240
260
gboolean show_seconds;
266
286
self->priv->ampm_available == FALSE) {
267
287
if (show_full_date) {
268
288
/* Translators: This is the time format with full date used
270
The character between %R and %S is U+2236 RATIO */
271
format_string = show_seconds ? _("%a %b %e, %R∶%S")
290
format_string = show_seconds ? _("%a %b %e, %R:%S")
272
291
: _("%a %b %e, %R");
273
292
} else if (show_weekday) {
274
293
/* Translators: This is the time format with day used
276
The character between %R and %S is U+2236 RATIO */
277
format_string = show_seconds ? _("%a %R∶%S")
295
format_string = show_seconds ? _("%a %R:%S")
280
298
/* Translators: This is the time format without date used
282
The character between %R and %S is U+2236 RATIO */
283
format_string = show_seconds ? _("%R∶%S") : _("%R");
300
format_string = show_seconds ? _("%R:%S") : _("%R");
286
303
if (show_full_date) {
287
304
/* Translators: This is a time format with full date used
289
The Unicode characters are U+2236 RATIO and
291
format_string = show_seconds ? _("%a %b %e, %l∶%M∶%S %p")
292
: _("%a %b %e, %l∶%M %p");
306
format_string = show_seconds ? _("%a %b %e, %l:%M:%S %p")
307
: _("%a %b %e, %l:%M %p");
293
308
} else if (show_weekday) {
294
309
/* Translators: This is a time format with day used
296
The Unicode characters are U+2236 RATIO and
298
format_string = show_seconds ? _("%a %l∶%M∶%S %p")
311
format_string = show_seconds ? _("%a %l:%M:%S %p")
301
314
/* Translators: This is a time format without date used
303
The Unicode characters are U+2236 RATIO and
305
format_string = show_seconds ? _("%l∶%M∶%S %p")
316
format_string = show_seconds ? _("%l:%M:%S %p")
321
safe_format_string = filter_ratio_for_locale (format_string);
310
323
g_free (self->priv->clock_string);
311
self->priv->clock_string = g_date_time_format (now, format_string);
324
self->priv->clock_string = g_date_time_format (now, safe_format_string);
313
326
g_date_time_unref (now);
314
327
g_date_time_unref (expiry);
328
g_free (safe_format_string);
316
330
g_object_notify ((GObject*)self, "clock");