Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

XtDisplayInitialize(1)

XtSetLanguageProc(1)

NAME

XtLanguageProc − interface definition for a procedure to set the locale and return the language string. 

Synopsis

typedef String (*XtLanguageProc)(Display*, String, XtPointer);

      Display *display;
      String language;
      XtPointer client_data;

Inputs

displaySpecifies the connection to the X server. 

languageSpecifies the initial language string obtained from the command line or server per-display resources, or NULL if no language specification is found. 

client_data
Specifies data registered with this function in the call to XtSetLanguageProc(). 

Returns

The language string for the display. 

Availability

Release 5 and later. 

Description

An XtLanguageProc and its client_data argument are registered with a call to XtSetLanguageProc().  It is invoked by XtDisplayInitialize() with the initial value of the language string or NULL.  A language procedure is passed the language string, if any, from the application command line or per-display resources, and should use that string to localize the application appropriately.  Setting the locale usually involves calling setlocale(), XSupportsLocale(), and XSetLocaleModifiers(), but applications that use other localization schemes may need to do different or additional initialization in this procedure.  An XtLanguageProc returns a string which will be set as the language string of the display by XtDisplayInitialize(), and will be used in future calls to XtResolvePathname() to find localized files.  The returned string may be different than the language argument.  If language is NULL, for example, a language procedure might determine the locale from an environment variable and return that value.  If the language procedure calls setlocale(), then the return value of this function is an appropriate return value for the function.  The Intrinsics will make a private copy of this string. 

Usage

All internationalized programs should call XtSetLanguageProc() before calling XtAppInitialize(), but most can simply use the default language procedure (pass NULL for the proc argument).  The default procedure should be sufficient for all applications that use only ANSI-C and X-based internationalization schemes. 

Example

The following is the Intrinsics default language procedure:

/*ARGSUSED*/
static String _XtDefaultLanguageProc(dpy, xnl, closure)
    Display   *dpy;     /* unused */
    String     xnl;
    XtPointer  closure; /* unused */
{
    if (! setlocale(LC_ALL, xnl))
        XtWarning("locale not supported by C library, locale unchanged");
     if (! XSupportsLocale()) {
        XtWarning("locale not supported by Xlib, locale set to C");
        setlocale(LC_ALL, "C");
    }
    if (! XSetLocaleModifiers(""))
        XtWarning("X locale modifiers not supported, using default");
     return setlocale(LC_ALL, NULL); /* re-query in case overwritten */
}

See Also

XtDisplayInitialize(1), XtSetLanguageProc(1). 
 
 
 
 
 
 
 
 
 

Copyright O’Reilly & Assoc.  —  X Toolkit Intrinsics Reference Manual © O’Reilly & Associates

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026