Internationalization.dgettext

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 not %NULL

- 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.

struct Internationalization
static
string
dgettext
(
string domain
,
string msgid
)

Parameters

domain string

the translation domain to use, or %NULL to use the domain set with textdomain()

msgid string

message to translate

Return Value

Type: string

The translated string

Meta

Since

2.18