Function
Gtkstock_set_translate_func
deprecated: 3.10 since: 2.8
Declaration [src]
void
gtk_stock_set_translate_func (
const gchar* domain,
GtkTranslateFunc func,
gpointer data,
GDestroyNotify notify
)
Description [src]
Sets a function to be used for translating the label
of
a stock item.
If no function is registered for a translation domain,
g_dgettext()
is used.
The function is used for all stock items whose
translation_domain
matches domain
. Note that it is possible
to use strings different from the actual gettext translation domain
of your application for this, as long as your GtkTranslateFunc
uses
the correct domain when calling dgettext(). This can be useful, e.g.
when dealing with message contexts:
GtkStockItem items[] = {
{ MY_ITEM1, NC_("odd items", "Item 1"), 0, 0, "odd-item-domain" },
{ MY_ITEM2, NC_("even items", "Item 2"), 0, 0, "even-item-domain" },
};
gchar *
my_translate_func (const gchar *msgid,
gpointer data)
{
gchar *msgctxt = data;
return (gchar*)g_dpgettext2 (GETTEXT_PACKAGE, msgctxt, msgid);
}
...
gtk_stock_add (items, G_N_ELEMENTS (items));
gtk_stock_set_translate_func ("odd-item-domain", my_translate_func, "odd items");
gtk_stock_set_translate_func ("even-item-domain", my_translate_func, "even items");
Available since: 2.8
Deprecated since: 3.10
Please do not use it in newly written code.
Parameters
domain
-
Type:
const gchar*
The translation domain for which
func
shall be used.The data is owned by the caller of the function. The value is a NUL terminated UTF-8 string. func
-
Type:
GtkTranslateFunc
A
GtkTranslateFunc
. data
-
Type:
gpointer
Data to pass to
func
.The argument can be NULL
.The data is owned by the caller of the function. notify
-
Type:
GDestroyNotify
A
GDestroyNotify
that is called whendata
is no longer needed.