Common Desktop Environment: Internationalization Programmer's Guide

Locale and Modifier Dependencies

The internationalized Xlib functions operate in the current locale configured by the host environment and in the X locale modifiers set by the XSetLocaleModifiers() function, or in the locale and modifiers configured at the time some object supplied to the function was created. For each locale-dependent function, Table 5-1 lists locale and modifier dependencies.

Table 5-1 Locale and Modifier Dependencies

Locale from... 

Affects the Function... 

In the... 

 

Locale Query/Configuration

 

setlocalle

XSupportsLocale

XSetLocaleModifiers

Locale queried Locale modified 

 

Resources

 

setlocale

XrmGetFileDatabase

XrmGetStringDatabase

Locale of XrmDatabase 

XrmDatabase 

XrmPutFileDatabase

XrmLocaleOfDatabase

Locale of XrmDatabase 

 

Setting Standard Properties

 

setlocale

XmbSetWMProperties

Encoding of supplied returned text (some WM_ property text in environment locale)

setlocalle

XmbTextPropertyToTextList

XwcTextPropertyToTextList

XmbTextListToTextProperty

XwcTextListToTextProperty

Encoding of supplied/returned text 

 

Text Input

 

setlocalle

XOpenIM

XIM input method 

XIM  

XCreateIC

XLocaleOfIM, etc.

XIC input method configuration Queried locale 

XIC 

XmbLookupText

XwcLookupText

Keyboard layout Encoding of returned text 

 

Text Drawing

 

setlocale

XCreateFontSet

Charsets of fonts in XFontSet  

XFontSet 

XmbDrawText,

XwcDrawText, etc.

XExtentsOfFontSet, etc.

XmbTextExtents,

XwcTextExtents, etc.

Locale of supplied text 

Locale of supplied text 

Locale-dependent metrics 

 

Xlib Errors

 

setlocalle

XGetErrorDatabaseText 

XGetErrorText 

Locale of error message 

Clients can assume that a locale-encoded text string returned by an X function can be passed to a C library function, or the string result of a C library function can be passed to an X function, if the locale is the same at the two calls.

All text strings processed by internationalized Xlib functions are assumed to begin in the initial state of the encoding of the locale, if the encoding is state-dependent. All Xlib functions behave as if they do not change the current locale or X modifier setting. (This means that any function, provided within a library either by Xlib or by the application, that changes the locale or calls the XSetLocaleModifiers() function with a nonnull argument, must save and restore the current locale state on entry and exit.) Also, Xlib functions on implementations that conform to the ANSI C library do not alter the global state associated with the mblen(), mbtowc(), wctomb(), and strtok() ANSI C functions.