Next | Prev | Up | Top | Contents | Index

Getting X Internationalization Started

Xlib's internationalization state, like that of libc, needs to be initialized.


Initialization for Toolkit Programming

If you're using Xt (with a widget set such as IRIS IM, Motif, or XaW), then don't use setlocale(). Instead, use

XtSetLanguageProc(NULL, NULL, NULL)
If you're using a toolkit other than Xt, call setlocale() as early as possible after execution begins.


Initialization for Xlib Programming

Initialize Xlib's internationalization state after calling setlocale(). Xlib is being initialized, not a server or server-specific object, so a server connection is not necessary.

Example 6-5 : Initializing Xlib for a Locale

if ( setlocale(LC_ALL, "") == NULL )
    exit_with_error();
if ( ! XSupportsLocale() )
    exit_with_other_error();
if ( XSetLocaleModifiers("") == NULL)
    give_warning();
XSetLocaleModifiers() is required only for input. Just as passing an empty string to setlocale() honors the user's environment, so does passing an empty string to XSetLocaleModifiers().


Next | Prev | Up | Top | Contents | Index