Article View: comp.windows.ms
Article #7528Re: Changing resource language dynamically
From: Kai-Uwe Rommel
Date: Tue, 11 Dec 1990 18:44
Date: Tue, 11 Dec 1990 18:44
45 lines
2558 bytes
2558 bytes
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
*/
Technical Details
Message-ID:
<6023@tuminfo1.lan.informatik.tu-muenchen.dbp.de>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!julius.cs.uiuc.edu!wuarchive!uunet!mcsun!unido!fauern!lan!rommelReferences:
<1169@shakti.ncst.ernet.in>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!julius.cs.uiuc.edu!wuarchive!uunet!mcsun!unido!fauern!lan!rommel From: rommel@lan.informatik.tu-muenchen.dbp.de (Kai-Uwe Rommel) Newsgroups: comp.windows.ms Subject: Re: Changing resource language dynamically Keywords: Resource languages Message-ID: <6023@tuminfo1.lan.informatik.tu-muenchen.dbp.de> Date: 11 Dec 90 18:44:56 GMT References: <1169@shakti.ncst.ernet.in> Sender: news@lan.informatik.tu-muenchen.dbp.de Reply-To: rommel@lan.informatik.tu-muenchen.dbp.de (Kai-Uwe Rommel) Organization: Inst. fuer Informatik, TU Muenchen, Germany Lines: 45