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:
Compound text can be created either by XmbTextListToTextProperty() or XwcTextListToTextProperty().
Localized titles can be displayed using the XmNtitle() and XmNtitleEncoding() resources of the WMShell() widget. Localized icon names can be displayed using the XmNiconName() and XmNiconNameEncoding() resources of the TopLevelShell() widget.
Localized titles of dialog boxes can also be displayed using the XmNdialogTitle() resource of the XmBulletinBoard() widget.
Window Manager should have an appropriate fontlist for displaying localized strings.
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().