Localize 'Last updated' display of feeds and quote URIs

This commit is contained in:
Christian Dywan 2009-04-29 23:46:41 +02:00
parent 5257a9e6c5
commit b7e852fe09
2 changed files with 16 additions and 7 deletions

View file

@ -376,19 +376,28 @@ feed_panel_cursor_or_row_changed_cb (GtkTreeView* treeview,
date = katze_item_get_added (item); date = katze_item_get_added (item);
if (date) if (date)
{ {
SoupDate* sdate; time_t date_t;
const struct tm* tm;
static gchar date_format[512];
const gchar* puri; const gchar* puri;
KatzeItem* parent; KatzeItem* parent;
sdate = soup_date_new_from_time_t ((time_t) date); gchar* last_updated;
date_t = (time_t)date;
tm = localtime (&date_t);
/* Some gcc versions complain about "%c" for no reason */
strftime (date_format, sizeof (date_format), "%c", tm);
parent = katze_item_get_parent (item); parent = katze_item_get_parent (item);
g_assert (KATZE_IS_ARRAY (parent)); g_assert (KATZE_IS_ARRAY (parent));
puri = katze_item_get_uri (parent); puri = katze_item_get_uri (parent);
/* i18n: The local date a feed was last updated */
last_updated = g_strdup_printf (C_("Feed", "Last updated: %s."),
date_format);
text = g_strdup_printf ( text = g_strdup_printf (
"<html><head><title>feed</title></head>" "<html><head><title>feed</title></head>"
"<body><h3>%s</h3><p />Last updated %s.</body></html>", "<body><h3>%s</h3><p />%s</body></html>",
puri, soup_date_to_string (sdate, SOUP_DATE_HTTP)); puri, last_updated);
soup_date_free (sdate); g_free (last_updated);
} }
} }
webkit_web_view_load_html_string ( webkit_web_view_load_html_string (

View file

@ -111,7 +111,7 @@ feed_add_item (KatzeArray* feeds,
NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
_("Error")); _("Error"));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
_("Feed %s already exists"), uri); _("Feed '%s' already exists"), uri);
gtk_window_set_title (GTK_WINDOW (dialog), EXTENSION_NAME); gtk_window_set_title (GTK_WINDOW (dialog), EXTENSION_NAME);
gtk_widget_show (dialog); gtk_widget_show (dialog);
g_signal_connect_swapped (dialog, "response", g_signal_connect_swapped (dialog, "response",
@ -188,7 +188,7 @@ feed_status_cb (KatzeNetRequest* request,
{ {
gchar* msg; gchar* msg;
msg = g_strdup_printf (_("Error loading feed %s"), msg = g_strdup_printf (_("Error loading feed '%s'"),
katze_item_get_uri (KATZE_ITEM (netpriv->feed))); katze_item_get_uri (KATZE_ITEM (netpriv->feed)));
feed_handle_net_error (netpriv, msg); feed_handle_net_error (netpriv, msg);
g_free (msg); g_free (msg);