Function
GLibdgettext
since: 2.18
Declaration [src]
const gchar*
g_dgettext (
const gchar* domain,
const gchar* msgid
)
Description [src]
This function is a wrapper of dgettext()
which does not translate
the message if the default domain as set with textdomain()
has no
translations for the current locale.
The advantage of using this function over dgettext()
proper is that
libraries using this function (like GTK) will not use translations
if the application using the library does not have translations for
the current locale. This results in a consistent English-only
interface instead of one having partial translations. For this
feature to work, the call to textdomain()
and setlocale()
should
precede any g_dgettext()
invocations. For GTK, it means calling
textdomain()
before gtk_init or its variants.
This function disables translations if and only if upon its first call all the following conditions hold:
-
domain
is notNULL
-
textdomain()
has been called to set a default text domain -
there is no translations available for the default text domain and the current locale
-
current locale is not “C” or any English locales (those starting with “en_”)
Note that this behavior may not be desired for example if an application
has its untranslated messages in a language other than English. In those
cases the application should call textdomain()
after initializing GTK.
Applications should normally not use this function directly, but use the _() macro for translations.
Available since: 2.18
Parameters
domain
-
Type:
const gchar*
The translation domain to use, or
NULL
to use the domain set with textdomain().The argument can be NULL
.The data is owned by the caller of the function. The value is a NUL terminated UTF-8 string. msgid
-
Type:
const gchar*
Message to translate.
The data is owned by the caller of the function. The value is a NUL terminated UTF-8 string.