X Window System (Xlib) Internationalization Programming
Locale

In X Internationalization Programming, XSupportsLocale() is called after 'setlocale()' and XOpenDisplay() to see if Xlib supports the current locale. If so, XSupportsLocale() returns 'True'.

Next, XSetLocaleModifiers() is called to set modifiers to change the behavior of Xlib. The value of XMODIFIERS environment variable, which may be related to input method, is also set.

--------------------------------------------------------------------------
Function		Description
--------------------------------------------------------------------------
XSupportsLocale		Examines if Xlib supports a locale
XSetLocaleModifiers     Sets the modifiers to change the behavior of Xlib
--------------------------------------------------------------------------
Below is an example code.
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xlocale.h>

main (int argc, char* argv [])
{
    Display* d;
        :

    if (!setlocale(LC_ALL, "")) {
	fprintf (stderr, "setlocale() error\n");
	exit (1);
    }
    if (!(d = XOpenDisplay(NULL))) {
	fprintf (stderr, "Cannot open display\n");
	exit (1);
    }
    if (XSupportsLocale() == False) {
	fprintf (stderr, "Locale not supported by X\n");
	exit (1);
    }
    if (XSetLocaleModifiers("") == NULL){
	fprintf (stderr, "Cannot set locale modifiers\n");
	exit (1);
    }
    	:
}

Go to Internationalization Programming Top


Copyright (C) 2012 Kokusaika JP, Inc.
All rights reserved. No reproduction or republication without written permission.