From: schoeller@gooey.enet.dec.com (Dick Schoeller)
Newsgroups: comp.windows.x.motif
Subject: Re: Multi-language application questions
Date: 10 Apr 92 17:37:59 GMT
Reply-To: schoeller@gooey.enet.dec.com (Dick Schoeller)
Organization: Digital Equipment Corporation, Nausea, Cow Hampshire


In article <ku6lebINN92k@news.bbn.com>, swalker@BBN.COM (Susan Walker) writes:
|>I am in the process of modifying an existing application so the text
|>strings can be translated into German and French. The application uses UIL
|>for it's dialog boxes.  It currently has all text string resources
|>directly embedded throughout the UIL code.  I am looking for solutions
|>which will affect little if any of my C code.  Can any one help me out on
|>these questions?
|>
|>1) Are there any guidelines about keyboard accelerators and keyboard
|>   mnemonics for languages other than English?  Do I use the same English
|>   characters even though they may not make sense in another language?
|>

It is certainly the practice here at DEC to use language specific mnemonics
and non-specific accelerators.  Mnemonics are, after all, connected to the
menu text.

|>
|>2) I can think of 2 ways to extract the text from the UIL code.  Is there any
|>   advantage of one way over another? 
|>
|>   method #1 - 
|>        File 1:  frenchstuff.msg which contains
|>
|>      		       value
|>         		   FOO:  "This is a sentence.";
|>
|>        File 2:  mybox.uil which contains
|>
|>      		       module mybox
|>         		   include file "frenchstuff.msg"
|>	    	       object  
|>	       		   mytitle: XmLabel
|>	          	   {
|>                               arguments
|>		               {
|>			       XmNlabelString = FOO;
|>			       .
|>	     		       .
|>
|>   method # 2 -
|>        File 1:  frenchstuff.msg which contains
|>
|>      		       value
|>         		   FOO: exported compounded_string("This is a sentence.");
|>
|>        File 2:  mybox.uil which contains
|>
|>      		       module mybox
|>            
|>	               value FOO: imported compound_string;
|>            	       object  
|>	       		   mytitle: XmLabel
|>	          	   {
|>                               arguments
|>		               {
|>			       XmNlabelString = FOO;
|>			       .
|>			       .
|>

We tend to do method 1.  Because Mrm will automatically find the UID file
based on the contents of LANG or the resource xnlLanguage, you can just
produce one UID file each language and put them in different directories.
You don't need any special C code to find the UID file.  You could, I think,
do method 2 and just have multiple UID files in the hierarchy list.  However,
it will only save you a small amount of disk space.

|>3a) Ideally I would like to have multiple languages available with minimal
|>    duplication of files.  Is it possible to have 1 set of UIL files for
|>    my dialog boxes and multiple sets of UIL files (1 set per language)
|>    for the text strings and have the correct text strings loaded at
|>    runtime?  I know about using $LANG, but how do I compile the UIL files
|>    so that I have 1 set of language independent UID files?
|>

You are confusing UIL files (source) with UID files (run-time).  Many UIL
files can be used to make a single UID.  The way in which to build multiple
UID files with some sources the same and the ones with the text different
on UNIX systems is to have language specific build directories and links
to where the files really are.

This build approach can be done for both method 1 and method 2.

|>3b) I would rather not have to use lots of MrMFetchliteral calls all over
|>    the place.  Is this the only way?
|>

In any case, you don't have to do this.  You can make sure that all of the
literals are picked up by the widgets in the UID(s) and get used when you
fetch the widgets.

|>
|>Any other related advice is greatly appreciated!
|>
|>- Susan
|>

Another reader commented on moving much of this into the app-defaults.  This
is appropriate for the resources that you really want the user to customize.
I am not real sure that it is a good idea for labels.  Especially, what do
you do about non-Latin 1 languages?  I haven't seen a String (read ASCII)
to non-Latin 1 XmString type converter.

Dick

Dick Schoeller                  | dick.schoeller@zko.mts.dec.com
Digital Equipment Corporation   | 603-881-2965
110 Spit Brook Rd., ZKO2-2/M28  | "Either Judaism has something to say to the
Nashua, NH 03062-2642           | world or it has nothing to say to Jews."
                                |                             - Dennis Prager