#error "config.h must be included prior to glibintl.h"
#endif
-G_CONST_RETURN gchar *glib_gettext (const gchar *str) G_GNUC_FORMAT(1);
+G_CONST_RETURN gchar *glib_gettext (const gchar *str) G_GNUC_FORMAT(1);
+G_CONST_RETURN gchar *glib_pgettext (const gchar *msgctxtid,
+ gsize msgidoffset) G_GNUC_FORMAT(1);
#ifdef ENABLE_NLS
#define _(String) glib_gettext(String)
/* Split out this in the code, but keep it in the same domain for now */
#define P_(String) glib_gettext(String)
-#define C_(Context,String) g_dpgettext (NULL, Context "\004" String, strlen (Context) + 1)
+#define C_(Context,String) glib_pgettext (Context "\004" String, strlen (Context) + 1)
#ifdef gettext_noop
#define N_(String) gettext_noop(String)
#endif /* G_OS_WIN32 */
-/**
- * glib_gettext:
- * @str: The string to be translated
- *
- * Returns the translated string from the glib translations.
- * This is an internal function and should only be used by
- * the internals of glib (such as libgio).
- *
- * Returns: the transation of @str to the current locale
- */
-G_CONST_RETURN gchar *
-glib_gettext (const gchar *str)
+static void
+ensure_gettext_initialized(void)
{
static gboolean _glib_gettext_initialized = FALSE;
# endif
_glib_gettext_initialized = TRUE;
}
-
+}
+
+/**
+ * glib_gettext:
+ * @str: The string to be translated
+ *
+ * Returns the translated string from the glib translations.
+ * This is an internal function and should only be used by
+ * the internals of glib (such as libgio).
+ *
+ * Returns: the transation of @str to the current locale
+ */
+G_CONST_RETURN gchar *
+glib_gettext (const gchar *str)
+{
+ ensure_gettext_initialized();
+
return g_dgettext (GETTEXT_PACKAGE, str);
}
+/**
+ * glib_pgettext:
+ * @msgctxtid: a combined message context and message id, separated
+ * by a \004 character
+ * @msgidoffset: the offset of the message id in @msgctxid
+ *
+ * This function is a variant of glib_gettext() which supports
+ * a disambiguating message context. See g_dpgettext() for full
+ * details.
+ *
+ * This is an internal function and should only be used by
+ * the internals of glib (such as libgio).
+ *
+ * Returns: the transation of @str to the current locale
+ */
+G_CONST_RETURN gchar *
+glib_pgettext(const gchar *msgctxtid,
+ gsize msgidoffset)
+{
+ ensure_gettext_initialized();
+
+ return g_dpgettext (GETTEXT_PACKAGE, msgctxtid, msgidoffset);
+}
+
#if defined (G_OS_WIN32) && !defined (_WIN64)
/* Binary compatibility versions. Not for newly compiled code. */