Previous: Progress Meter Callback, Up: Context Attributes

7.3.9 Locale

A locale setting can be associated with a context. This locale is passed to the crypto engine, and used for applications like the PIN entry, which is displayed to the user when entering a passphrase is required.

The default locale is used to initialize the locale setting of all contexts created afterwards.

— Function: gpgme_error_t gpgme_set_locale (gpgme_ctx_t ctx, int category, const char *value)

The function gpgme_set_locale sets the locale of the context ctx, or the default locale if ctx is a null pointer.

The locale settings that should be changed are specified by category. Supported categories are LC_CTYPE, LC_MESSAGES, and LC_ALL, which is a wildcard you can use if you want to change all the categories at once.

The value to be used for the locale setting is value, which will be copied to GPGME's internal data structures. value can be a null pointer, which disables setting the locale, and will make PIN entry and other applications use their default setting, which is usually not what you want.

Note that the settings are only used if the application runs on a text terminal, and that the settings should fit the configuration of the output terminal. Normally, it is sufficient to initialize the default value at startup.

The function returns an error if not enough memory is available.