[comp.windows.x.motif] The LANG environment variable

dbrooks@osf.org (03/23/91)

> > 	Hello.  I have what I think is a quick question concerning the
> > 	LANG environment variable.  How does this variable get set and
> > 	how is it used by Motif?  I tried to RTFM but I didn't know
> > 	which FM to R.  Thanks.
> Hopefully this will work better at 1.2.  We shall see.  The LANG variable
> is an X/Open specified environment variable.  The user sets it to a value
> indicating the language that they wish to use.  Then certain tools (the
> X/Open Message Catalog being one) load the appropriate text files using that
> information.  I believe that X11R5 will use it to load the resource files,
> for instance.

X11R4 does.  To paraphrase section 2.2 of the Intrinsics C Language interface:
magic is used to look for a resource {name|Class}.XnlLanguage; if that fails,
the value of LANG is used...

which is called "%L", and split by the semantics language[_territory][.codeset],
as described by Kee, into parts called %l, %t, %c...

which is used by XtResolvePathname, which can also consult XFILESEARCHPATH,
which will often mention %L or %l (ibid, 11.11)...

which is used to look up the application-specific per-user resource file using
XUSERFILESEARCHPATH (which can use %L, %l, %t, %c), which defaults to something
involving XAPPLRESDIR, %L and %l, which, after a good strong cup of coffee,
defaults to something involving $HOME, %L and %l...

and is also used by MrmOpenHierarchy, which in the absence of UIDPATH uses a
path again involviong %L and %l (Motif PRM, MrmOpenHierarchy)...

and is also used by XmGetPixmap, which in the absence of XBMLANGPATH again has a
default involving %L and %l. (ibid, XmGetPixmap).

Aren't you glad you asked.  Actually, all this means is that if you set LANG
appropriately, and have subdirectories named by your locale, it all works neatly.

> Incidently, if someone at OSF can speak on what is going to happen here at 1.2
> I'd appreciate it...

Sorry.  It's still not for public consumption, but you may be able to bribe a
member.  Compatibility considerations would suggest the above scheme would still
work.

David Brooks
Systems Engineering
Open Software Foundation

dbrooks@osf.org (03/23/91)

I wrote:

>X11R4 does.

(Long and boring description of Xt's i18n deleted).

It occurs to me that all that verbiage hides the central points.  So, for
clarity's sake:

- you can specify a language, using the LANG variable or the server
  database, on a per-application-context basis.

- the language can be used to select a set of resource files, uid files,
  and a bitmap directory (yes, even icons are often culture-specific).

- If you use the normal standard setup, all the administrator has to do is
  deposit the required files in the right subdirectories: for example,
  /usr/lib/X11/app-defaults/french/.

David Brooks
OSF