Common Desktop Environment: Internationalization Programmer's Guide

Window Titles

The standard way for setting titles is to use resources. But for applications that set the titles of their windows directly, a localized title must be sent to the Window Manager. Use the XCompoundTextStyle() encoding defined in XICCEncodingStyle(), as well as the following guidelines:

Following is an example of displaying a localized title and icon name. Compound text is made from the compound string in this example.

include       <nl_types.h>  
Widget         toplevel;  
Arg            al[10];  
int            ac;  
XTextProperty  title;  
char           *localized_string;  
nl_catd        fd;   

XtSetLanguageProc( NULL, NULL, NULL );  
fd = catopen( "my_prog", 0 );  
localized_string = catgets(fd, set_num, mes_num, "defaulttitle");  
XmbTextListToTextProperty( XtDisplay(toplevel), &localized_string,
         1, XCompoundTextStyle, &title);  ac = 0;  
XtSetArg(al[ac], XmNtitle, title.value); ac++;  
XtSetArg(al[ac], XmNtitleEncoding, title.encoding); ac++;  
XtSetValues(toplevel, al, ac);

If you are using a window rather than widgets, the XmbSetWMProperties() function automatically converts a localized string into the proper XICCEncodingStyle().