? gtkcalendar.new.c
Index: gtkcalendar.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkcalendar.c,v
retrieving revision 1.72
diff -u -p -r1.72 gtkcalendar.c
--- gtkcalendar.c	22 Oct 2004 17:27:06 -0000	1.72
+++ gtkcalendar.c	8 Nov 2004 07:58:27 -0000
@@ -1418,15 +1418,17 @@ gtk_calendar_size_request (GtkWidget	  *
 	  max_header_height = MAX (max_header_height, logical_rect.height); 
 	}
       private_data->max_year_width = 0;
-      for (i=0; i<10; i++)
-	{
-	  g_snprintf (buffer, sizeof (buffer), "%d%d%d%d", i,i,i,i);
-	  pango_layout_set_text (layout, buffer, -1);	  
-	  pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
-	  private_data->max_year_width = MAX (private_data->max_year_width,
-					      logical_rect.width + 8);
-	  max_header_height = MAX (max_header_height, logical_rect.height); 
-	}
+
+      /* Translators:  This is a width/height measurement templates.
+       * Translate it to a longest/widest/highest year text.
+       *
+       * If you don't understand this, leave it as "2000"
+       */
+      pango_layout_set_text (layout, _("2000"), -1);       
+      pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
+      private_data->max_year_width = MAX (private_data->max_year_width,
+                                            logical_rect.width + 8);
+      max_header_height = MAX (max_header_height, logical_rect.height); 
     } 
   else 
     {
@@ -1746,6 +1748,9 @@ gtk_calendar_paint_header (GtkWidget *wi
   PangoLayout *layout;
   PangoRectangle logical_rect;
   gboolean year_left;
+  time_t tmp_time;
+  struct tm *tm;
+  gchar *str;
 
   calendar = GTK_CALENDAR (widget);
   private_data = GTK_CALENDAR_PRIVATE_DATA (widget);
@@ -1779,9 +1784,22 @@ gtk_calendar_paint_header (GtkWidget *wi
 		    NULL, widget, "calendar",
 		    0, 0, header_width, private_data->header_h);
   
-  
-  g_snprintf (buffer, sizeof (buffer), "%d", calendar->year);
-  layout = gtk_widget_create_pango_layout (widget, buffer);
+  tmp_time = 1;  /* Jan 1 1970, 00:00:01 UTC */
+  tm = gmtime (&tmp_time);
+  tm->tm_year = calendar->year - 1900;
+  /* Translators: This dictates how the year is displayed in
+   * gtkcalendar widget.  See strftime manual for the format.
+   * Use only ASCII in the translation.
+   *
+   * Also look for the msgid "2000".  Translate that entry
+   * to a year with the longest/widest/highest output of this
+   * msgid.  The original text is appropriate for most locales.
+   */
+  strftime ( buffer, sizeof (buffer), _("%Y"), tm);
+  str = g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL);
+  layout = gtk_widget_create_pango_layout (widget, str);
+  g_free (str);
+
   pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
   
   /* Draw title */
