Xt translated labels ?

Glynn Clements glynn at gclements.plus.com
Fri Aug 25 07:22:31 PDT 2006


Samuel Thibault wrote:

> Xt is great in that you can change application labels etc.  But there
> does not seem to be any agreement on how it might be possible to have Xt
> applications automatically translated according to the current locale. I
> mean, there could be
> 
> /usr/lib/X11/app-defaults/fr/
> /usr/lib/X11/app-defaults/fr_BE/
> /usr/lib/X11/app-defaults/de/
> /usr/lib/X11/app-defaults/jp/
> etc.
> 
> containing the translated labels, and XtVaOpenApplications should not
> only look at /usr/lib/X11/app-defaults, but also at the directory
> corresponding to the current locale, for getting the translated labels.
> 
> Any thoughts?

It already does this, except the locale has to come first, i.e. 
/usr/lib/X11/fr/app-defaults/ etc.

The default search path for app-defaults (and similar) files is:

	/usr/lib/X11/%L/%T/%N%C%S:\
	/usr/lib/X11/%l/%T/%N%C%S:\
	/usr/lib/X11/%T/%N%C%S:\
	/usr/lib/X11/%L/%T/%N%S:\
	/usr/lib/X11/%l/%T/%N%S:\
	/usr/lib/X11/%T/%N%S

where %L is the full locale (e.g. "en_GB.utf8") and %l is just the
language part; %T is the type (e.g. "app-defaults"), %N is the
application's class name (e.g. "XTerm"), %C is a customisation value
(e.g. "-color") and %S is a suffix (not normally used).

The search path can be overriden through the XFILESEARCHPATH
environment variable.

See the XtResolvePathname(3) manual page for more details.

Note that the application will only use the first matching file, so if
there's one in the locale-specific directory, it will use that instead
of the one in app-defaults, not in addition to it. However,
app-defaults files can #include other files, so you can make the
locale-specific version include the generic version rather than
duplicating common settings.

-- 
Glynn Clements <glynn at gclements.plus.com>



More information about the xorg mailing list