Index: gtk/gtkaccellabel.c
===================================================================
--- gtk/gtkaccellabel.c	(revision 20323)
+++ gtk/gtkaccellabel.c	(working copy)
@@ -750,7 +750,7 @@ _gtk_accel_label_class_get_accelerator_l
 	      
 	      strcpy (msg, "keyboard label|");
 	      g_strlcat (msg, tmp, 128);
-	      str = dgettext (GETTEXT_PACKAGE, msg);
+	      str = _(msg);
 	      if (str == msg)
 		{
 		  g_string_append (gstring, tmp);
Index: gtk/gtkbuilder.c
===================================================================
--- gtk/gtkbuilder.c	(revision 20323)
+++ gtk/gtkbuilder.c	(working copy)
@@ -86,7 +86,7 @@ gtk_builder_class_init (GtkBuilderClass 
   * The translation domain used when translating property values that
   * have been marked as translatable in interface descriptions.
   * If the translation domain is %NULL, #GtkBuilder uses gettext(),
-  * otherwise dgettext().
+  * otherwise g_dgettext().
   *
   * Since: 2.12
   */
Index: gtk/gtkintl.h
===================================================================
--- gtk/gtkintl.h	(revision 20323)
+++ gtk/gtkintl.h	(working copy)
@@ -4,7 +4,7 @@
 #include <glib/gi18n-lib.h>
 
 #ifdef ENABLE_NLS
-#define P_(String) dgettext(GETTEXT_PACKAGE "-properties",String)
+#define P_(String) g_dgettext(GETTEXT_PACKAGE "-properties",String)
 #else 
 #define P_(String) (String)
 #endif
Index: gtk/gtkstock.c
===================================================================
--- gtk/gtkstock.c	(revision 20323)
+++ gtk/gtkstock.c	(working copy)
@@ -176,7 +176,7 @@ gtk_stock_lookup (const gchar  *stock_id
 	  if (translate != NULL && translate->func != NULL)
 	    item->label = (* translate->func) (item->label, translate->data);
 	  else
-	    item->label = dgettext (item->translation_domain, item->label);
+	    item->label = g_dgettext (item->translation_domain, item->label);
 	}
     }
 
@@ -417,7 +417,7 @@ static const GtkStockItem builtin_items 
  * a stock item.
  *
  * If no function is registered for a translation domain,
- * dgettext() is used.
+ * g_dgettext() is used.
  *
  * Since: 2.8
  * 
@@ -457,7 +457,7 @@ sgettext_swapped (const gchar *msgid, 
 {
   gchar *domainname = data;
 
-  return (gchar *)g_strip_context (msgid, dgettext (domainname, msgid));
+  return (gchar *)g_strip_context (msgid, g_dgettext (domainname, msgid));
 }
 
 
Index: gtk/gtkimmulticontext.c
===================================================================
--- gtk/gtkimmulticontext.c	(revision 20323)
+++ gtk/gtkimmulticontext.c	(working copy)
@@ -590,7 +590,7 @@ gtk_im_multicontext_append_menuitems (Gt
 #ifdef HAVE_BIND_TEXTDOMAIN_CODESET
 	      bind_textdomain_codeset (contexts[i]->domain, "UTF-8");
 #endif
-	      translated_name = dgettext (contexts[i]->domain, contexts[i]->context_name);
+	      translated_name = g_dgettext (contexts[i]->domain, contexts[i]->context_name);
 	    }
 	  else
 	    {
Index: gtk/gtkmain.c
===================================================================
--- gtk/gtkmain.c	(revision 20323)
+++ gtk/gtkmain.c	(working copy)
@@ -527,22 +527,13 @@ enum_locale_proc (LPTSTR locale)
 #endif
 
 static void
-do_pre_parse_initialization (int    *argc,
-			     char ***argv)
+setlocale_initialization (void)
 {
-  const gchar *env_string;
-  
-#if	0
-  g_set_error_handler (gtk_error);
-  g_set_warning_handler (gtk_warning);
-  g_set_message_handler (gtk_message);
-  g_set_print_handler (gtk_print);
-#endif
+  static gboolean initialized = FALSE;
 
-  if (pre_initialized)
+  if (initialized)
     return;
-
-  pre_initialized = TRUE;
+  initialized = TRUE;
 
   if (do_setlocale)
     {
@@ -607,6 +598,25 @@ do_pre_parse_initialization (int    *arg
 	g_warning ("Locale not supported by C library.\n\tUsing the fallback 'C' locale.");
 #endif
     }
+}
+
+static void
+do_pre_parse_initialization (int    *argc,
+			     char ***argv)
+{
+  const gchar *env_string;
+  
+#if	0
+  g_set_error_handler (gtk_error);
+  g_set_warning_handler (gtk_warning);
+  g_set_message_handler (gtk_message);
+  g_set_print_handler (gtk_print);
+#endif
+
+  if (pre_initialized)
+    return;
+
+  pre_initialized = TRUE;
 
   gdk_pre_parse_libgtk_only ();
   gdk_event_handler_set ((GdkEventFunc)gtk_main_do_event, NULL, NULL);
@@ -630,6 +640,8 @@ do_pre_parse_initialization (int    *arg
 static void
 gettext_initialization (void)
 {
+  setlocale_initialization ();
+
 #ifdef ENABLE_NLS
   bindtextdomain (GETTEXT_PACKAGE, GTK_LOCALEDIR);
   bindtextdomain (GETTEXT_PACKAGE "-properties", GTK_LOCALEDIR);
Index: gtk/gtkactiongroup.c
===================================================================
--- gtk/gtkactiongroup.c	(revision 20323)
+++ gtk/gtkactiongroup.c	(working copy)
@@ -1278,9 +1278,9 @@ static gchar *
 dgettext_swapped (const gchar *msgid, 
 		  const gchar *domainname)
 {
-  /* Pass through dgettext if and only if msgid is nonempty. */
+  /* Pass through g_dgettext if and only if msgid is nonempty. */
   if (msgid && *msgid) 
-    return dgettext (domainname, msgid); 
+    return (gchar*) g_dgettext (domainname, msgid); 
   else
     return (gchar*) msgid;
 }
@@ -1288,9 +1288,9 @@ dgettext_swapped (const gchar *msgid, 
 /**
  * gtk_action_group_set_translation_domain:
  * @action_group: a #GtkActionGroup
- * @domain: the translation domain to use for dgettext() calls
+ * @domain: the translation domain to use for g_dgettext() calls
  * 
- * Sets the translation domain and uses dgettext() for translating the 
+ * Sets the translation domain and uses g_dgettext() for translating the 
  * @label and @tooltip of #GtkActionEntry<!-- -->s added by 
  * gtk_action_group_add_actions().
  *
Index: gtk/gtkbuilderparser.c
===================================================================
--- gtk/gtkbuilderparser.c	(revision 20323)
+++ gtk/gtkbuilderparser.c	(working copy)
@@ -827,13 +827,12 @@ start_element (GMarkupParseContext *cont
  * GNU gettext uses '\004' to separate context and msgid in .mo files.
  */
 static const char *
-dpgettext (const char *domain,
-           const char *msgctxt,
-           const char *msgid)
+_dpgettext (const char *domain,
+            const char *msgctxt,
+            const char *msgid)
 {
   size_t msgctxt_len = strlen (msgctxt) + 1;
   size_t msgid_len = strlen (msgid) + 1;
-  const char *translation;
   char* msg_ctxt_id;
 
   msg_ctxt_id = g_alloca (msgctxt_len + msgid_len);
@@ -842,19 +841,7 @@ dpgettext (const char *domain,
   msg_ctxt_id[msgctxt_len - 1] = '\004';
   memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
 
-  translation = dgettext (domain, msg_ctxt_id);
-
-  if (translation == msg_ctxt_id) 
-    {
-      /* try the old way of doing message contexts, too */
-      msg_ctxt_id[msgctxt_len - 1] = '|';
-      translation = dgettext (domain, msg_ctxt_id);
-  
-      if (translation == msg_ctxt_id)
-        return msgid;
-    }
- 
-  return translation;
+  return g_dpgettext (domain, msg_ctxt_id, 0);
 }
 
 gchar *
@@ -865,9 +852,9 @@ _gtk_builder_parser_translate (const gch
   const char *s;
 
   if (context)
-    s = dpgettext (domain, context, text);
+    s = _dpgettext (domain, context, text);
   else
-    s = dgettext (domain, text);
+    s = g_dgettext (domain, text);
 
   return g_strdup (s);
 }
