Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

xtsetlanguageproc(3) [x11r4 man page]

XtSetLanguageProc(3)						   XT FUNCTIONS 					      XtSetLanguageProc(3)

NAME
XtSetLanguageProc - set the language procedure SYNTAX
Widget XtSetLanguageProc(XtAppContext app_context, XtLanguageProc proc, XtPointer client_data); ARGUMENTS
app_context Specifies the application context in which the language procedure is to be used, or NULL. proc Specifies the language procedure, or NULL. client_data Specifies additional client data to be passed to the language procedure when it is called. DESCRIPTION
XtSetLanguageProc sets the language procedure that will be called from XtDisplayInitialize for all subsequent Displays initialized in the specified application context. If app_context is NULL, the specified language procedure is registered in all application contexts created by the calling process, including any future application contexts that may be created. If proc is NULL a default language procedure is reg- istered. XtSetLanguageProc returns the previously registered language procedure. If a language procedure has not yet been registered, the return value is unspecified but if this return value is used in a subsequent call to XtSetLanguageProc, it will cause the default language procedure to be registered. The default language procedure does the following: o Sets the locale according to the environment. On ANSI C-based systems this is done by calling setlocale( LC_ALL, language ). If an error is encountered a warning message is issued with XtWarning. o Calls XSupportsLocale to verify that the current locale is supported. If the locale is not supported, a warning message is issued with XtWarning and the locale is set to ``C''. o Calls XSetLocaleModifiers specifying the empty string. o Returns the value of the current locale. On ANSI C-based systems this is the return value from a final call to setlocale( LC_ALL, NULL ). A client wishing to use this mechanism to establish locale can do so by calling XtSetLanguageProc prior to XtDisplayInitialize. SEE ALSO
X Toolkit Intrinsics - C Language Interface Xlib - C Language X Interface X Version 11 libXt 1.0.5 XtSetLanguageProc(3)

Check Out this Related Man Page

XtLanguageProc()														  XtLanguageProc()

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
  display   Specifies the connection to the X server.

  language  Specifies  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  XSetLo-
  caleModifiers(),  but applications that use other localization schemes may need to do different or additional initialization in this proce-
  dure.

  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  lan-
  guage  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).

Xt - Locale Management														  XtLanguageProc()
Man Page