aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog7
-rw-r--r--calendar/gui/calendar-config.c8
-rw-r--r--calendar/gui/e-itip-control.c17
-rw-r--r--calendar/gui/e-timezone-entry.c42
4 files changed, 59 insertions, 15 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 3b856c3df5..3ed9734e9e 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,10 @@
+2002-01-11 Damon Chaplin <damon@ximian.com>
+
+ * gui/e-timezone-entry.c:
+ * gui/e-itip-control.c (write_label_piece):
+ * gui/calendar-config.c (on_timezone_set): translate timezone names
+ when displayed. Fixes bug #6544.
+
2002-01-03 JP Rosevear <jpr@ximian.com>
* gui/tasks-control.c (tasks_control_complete_cmd): new verb
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c
index e0313fe3a7..80f7f856d8 100644
--- a/calendar/gui/calendar-config.c
+++ b/calendar/gui/calendar-config.c
@@ -1000,11 +1000,15 @@ on_timezone_set (GnomeDialog *dialog,
ETimezoneDialog *etd)
{
char *display_name;
+ icaltimezone *zone;
e_timezone_dialog_get_timezone (etd, &display_name);
- if (display_name && display_name[0]) {
- calendar_config_set_timezone (display_name);
+ /* We know it can only be a builtin timezone, since there is no way
+ to set it to anything else. */
+ zone = e_timezone_dialog_get_builtin_timezone (display_name);
+ if (zone) {
+ calendar_config_set_timezone (icaltimezone_get_location (zone));
calendar_config_write ();
update_all_config_settings ();
diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c
index bb935ea396..66abdb89be 100644
--- a/calendar/gui/e-itip-control.c
+++ b/calendar/gui/e-itip-control.c
@@ -489,11 +489,22 @@ write_label_piece (EItipControl *itip, CalComponentDateTime *dt,
/* Output timezone after time, e.g. " America/New_York". */
if (zone) {
+ /* Note that this returns UTF-8, since all iCalendar data is
+ UTF-8. But it probably is not translated. */
display_name = icaltimezone_get_display_name (zone);
- /* These are ASCII strings, so should be OK as UTF-8.*/
- if (display_name) {
+ if (display_name && *display_name) {
strcat (buffer, " ");
- strcat (buffer, display_name);
+
+ /* We check if it is one of our builtin timezone names,
+ in which case we call gettext to translate it, and
+ we need to convert to UTF-8. If it isn't a builtin
+ timezone name, we use it as-is, as it is already
+ UTF-8. */
+ if (icaltimezone_get_builtin_timezone (display_name)) {
+ strcat (buffer, U_(display_name));
+ } else {
+ strcat (buffer, display_name);
+ }
}
}
diff --git a/calendar/gui/e-timezone-entry.c b/calendar/gui/e-timezone-entry.c
index eb8ebe8df4..84c512b574 100644
--- a/calendar/gui/e-timezone-entry.c
+++ b/calendar/gui/e-timezone-entry.c
@@ -34,6 +34,7 @@
#include <gtk/gtkentry.h>
#include <gtk/gtksignal.h>
#include <gnome.h>
+#include <gal/widgets/e-unicode.h>
#include <widgets/e-timezone-dialog/e-timezone-dialog.h>
#include "e-timezone-entry.h"
@@ -77,7 +78,8 @@ static void on_entry_changed (GtkEntry *entry,
static void on_button_clicked (GtkWidget *widget,
ETimezoneEntry *tentry);
-static char* e_timezone_entry_get_display_name (icaltimezone *zone);
+static char* e_timezone_entry_get_display_name (ETimezoneEntry *tentry,
+ icaltimezone *zone);
static void e_timezone_entry_set_entry_visibility (ETimezoneEntry *tentry);
@@ -287,9 +289,7 @@ e_timezone_entry_get_timezone (ETimezoneEntry *tentry)
builtin timezone or 'local time' (i.e. no timezone). */
display_name = gtk_entry_get_text (GTK_ENTRY (priv->entry));
- if (display_name && display_name[0])
- return icaltimezone_get_builtin_timezone (display_name);
- return NULL;
+ return e_timezone_dialog_get_builtin_timezone (display_name);
}
@@ -298,6 +298,7 @@ e_timezone_entry_set_timezone (ETimezoneEntry *tentry,
icaltimezone *zone)
{
ETimezoneEntryPrivate *priv;
+ gchar *display_name;
g_return_if_fail (E_IS_TIMEZONE_ENTRY (tentry));
@@ -306,20 +307,41 @@ e_timezone_entry_set_timezone (ETimezoneEntry *tentry,
priv->zone = zone;
priv->changed = FALSE;
+ display_name = e_timezone_entry_get_display_name (tentry, zone);
gtk_entry_set_text (GTK_ENTRY (priv->entry),
- zone ? e_timezone_entry_get_display_name (zone) : "");
+ display_name ? display_name : "");
+ g_free (display_name);
e_timezone_entry_set_entry_visibility (tentry);
}
-/* Returns the timezone name to display to the user. . We prefer to use the
- Olson city name, but fall back on the TZNAME, or finally the TZID. We don't
- want to use "" as it may be wrongly interpreted as a 'local time'. */
+/* Returns the timezone name to display to the user, in the locale's encoding.
+ We prefer to use the Olson city name, but fall back on the TZNAME, or
+ finally the TZID. We don't want to use "" as it may be wrongly interpreted
+ as a 'local time'. If zone is NULL, NULL is returned. The returned string
+ should be freed. */
static char*
-e_timezone_entry_get_display_name (icaltimezone *zone)
+e_timezone_entry_get_display_name (ETimezoneEntry *tentry,
+ icaltimezone *zone)
{
- return icaltimezone_get_display_name (zone);
+ char *display_name;
+
+ if (!zone)
+ return NULL;
+
+ /* Get the UTF-8 display name from the icaltimezone. */
+ display_name = icaltimezone_get_display_name (zone);
+
+ /* We check if it is one of our builtin timezone names, in which case
+ we call gettext to translate it. If it isn't a builtin timezone
+ name, we need to convert it to the GTK+ encoding. */
+ if (icaltimezone_get_builtin_timezone (display_name)) {
+ return g_strdup (_(display_name));
+ } else {
+ return e_utf8_to_gtk_string (GTK_WIDGET (tentry),
+ display_name);
+ }
}