[comp.windows.ms] Changing resource language dynamically

deepak@ncst.ernet.in (Deepak G Patil) (12/11/90)

We want to change application language dynamically while the application
is running.  The intended interface is, a menu which lists all the languages,
and when changed, it shall update all the resources being used by the 
application.

Does MS windows provide any support for this? Especially non-latin
languages such as Kanji or Hindi.

Even for Roman Scripts, say changing from English to German.. how can
it be achieved?

thanks.

------------------------------------------------------------------------------
       /\           Quality is the continuing stimulus which causes us to
      /  )          create the world in which we live.
      ( /           All of it.
       V            Every last bit.
     _/\_
    |    |o
    |    |0.
    |    |                                         deepak@shakti.ncst.ernet.in

rommel@lan.informatik.tu-muenchen.dbp.de (Kai-Uwe Rommel) (12/12/90)

In article <1169@shakti.ncst.ernet.in> deepak@ncst.ernet.in (Deepak G Patil) writes:
>We want to change application language dynamically while the application
>is running.  The intended interface is, a menu which lists all the languages,
>and when changed, it shall update all the resources being used by the 
>application.
>
>Does MS windows provide any support for this? Especially non-latin
>languages such as Kanji or Hindi.
>
>Even for Roman Scripts, say changing from English to German.. how can
>it be achieved?


During the last days I converted an app. to support exactly what you
describe that you want to have it. It's not that easy. There is no
simple way only to change some ressource file (at least, I don't know
one). I used the following method:

1. Have all resources for all languages in a single res. script.
2. Prefix all their names with a language prefix (i.e. "E_" for english,
   "G_" for german etc.
3. At all places where the resources are called, wrap the resource name
   with a function which prefixes the parameter string with the current
   language prefix, i.e. change
       DialogBox("FileOpen", ...);  to
       DialogBox(LangRes("FileOpen"), ...);
   where LangRes is of type char * and returns a pointer to its argument
   prefixed with "E_" or "G_".
4. When you change the language, you must manually cause all resources
   to be reloaded. But usually you will not have any Dialog boxes open
   so you may only have to update Window titles etc. from Stringtable
   resources, or the change the Menu and Accelerator table.

This method may sound not very nice but it's fast. I don't know of
languages with other fonts than the standard ANSI set. But if you have
the needed fonts, you can at least specify them for Dialog Boxes in the
dialog editor.

Kai Uwe Rommel

--
/* Kai Uwe Rommel
 * Munich
 * rommel@lan.informatik.tu-muenchen.dbp.de
 */