Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Multi-Language GUI

0 views
Skip to first unread message

Axel Dietz

unread,
Jul 13, 1997, 3:00:00 AM7/13/97
to Johannes Weidl

Hello Johannes,


If you are using 32 bit you can use loadstring and put the text in only
one resource file in more than one language. The OS looks what is the
primary language selected in the international settings and adapts
automatically the output to Loadstring.

For more info, let me know.


Axel

Johannes Weidl wrote:

> Hi,
>
> I want to create an application with a multilingual UI. Can I use
> stringtables
> for this purpose...? How does this work? I saw that the ghostscript
> viewer
> (gsview) can change the language (menus, dialogs) during run-time. How
>
> do they do this ...?
>
> It's a 16bit Windo*s application (BC++ 5.01).
>
> Regards,
>
> Joe.
>
> ----
> ------------------------------------------------------------------------
>
> Johannes Weidl
>
> Information Systems Institute phone: +43-1-58801-4466
> Distributed Systems Group fax: +43-1-5058453
> Technical University of Vienna email:
> J.W...@infosys.tuwien.ac.at
>
> Argentinierstr. 8 / 184-1 homepage:
> http://www.infosys.tuwien.ac.at/~weidl
> A-1040 Vienna, Austria fidonet: 2:313/1.98
> -------------------------------------------------
> ---------------------------


Axel Dietz

unread,
Jul 14, 1997, 3:00:00 AM7/14/97
to

Johannes Weidl wrote:

> Hi,
>
> I want to create an application with a multilingual UI. Can I use
> stringtables
> for this purpose...? How does this work? I saw that the ghostscript
> viewer
> (gsview) can change the language (menus, dialogs) during run-time. How
>
> do they do this ...?
>
> It's a 16bit Windo*s application (BC++ 5.01).
>
> Regards,
>
> Joe.
>
> ----
> ------------------------------------------------------------------------
>
> Johannes Weidl
>
> Information Systems Institute phone: +43-1-58801-4466
> Distributed Systems Group fax: +43-1-5058453
> Technical University of Vienna email:
> J.W...@infosys.tuwien.ac.at
>
> Argentinierstr. 8 / 184-1 homepage:
> http://www.infosys.tuwien.ac.at/~weidl
> A-1040 Vienna, Austria fidonet: 2:313/1.98
> -------------------------------------------------
> ---------------------------

Johannes Weidl wrote:

> Axel Dietz wrote:
>
> > Hello Johannes,
> >
> > If you are using 32 bit you can use loadstring and put the text in
> > only
> > one resource file in more than one language. The OS looks what is
> the
> > primary language selected in the international settings and adapts
> > automatically the output to Loadstring.
>

> The problem is that the program is 16bit... :-(
>
> The dumb solution is generating two exe files (one german, one
> english)
> and installing the user wanted version to the harddisk
>
> :-(
>
> Hannes.


Sorry I didnot read your message well.

The solution that I use in 16 bit is almost the same as the 32 bit
version and allows easy porting.

Use string tables and loadstring. Use also a global variable for the
language like:

#define ENGLISH 5000
#define DUTCH 10000
etc...


if (!lstrcmp(szLng,"UK"))
LngOffset = ENGLISH;
else if (!lstrcmp(szLng,"NL"))
LngOffset = DUTCH;
else if (!lstrcmp(szLng,"GER"))
LngOffset = GERMAN;
else if (!lstrcmp(szLng,"SWE"))
LngOffset = SWEDISH;
else
LngOffset = ENGLISH;


and instead of Loadstring use XLoadstring which I defined as


LPSTR TLanguage::XLoadString(HINSTANCE hInstance,int StringID)
{
static char String[255];

LoadString(hInstance,StringID+LngOffset,String,255);

return (LPSTR) String;
}


in your resource file it should look like

STRINGTABLE
{
ENGLISH + IDS_PASSWDWNDTEXT, "AIRMAIL PASSWORD"
ENGLISH + IDS_PASSWDSTAT, "Password"

ENGLISH + IDS_NO_PERMISSION, "You have no access to this
function,\nDo you want to login now?"
ENGLISH + IDS_LOGINWINDOWTEXT, "LOGIN"
ENGLISH + IDS_USERNAME, "Username:"
ENGLISH + IDS_PASSWORD, "Password:"


DUTCH + IDS_PASSWDWNDTEXT, "AIRMAIL PASWOORD"
DUTCH + IDS_PASSWDSTAT, "Paswoord"

DUTCH + IDS_NO_PERMISSION, "U heeft geen toegang tot deze
functie,\nWilt u onder een andere naam inloggen?"
DUTCH + IDS_LOGINWINDOWTEXT, "LOGIN"
DUTCH + IDS_USERNAME, "Gebruikersnaam:"
DUTCH + IDS_PASSWORD, "Password:"

GERMAN + IDS_PASSWDWNDTEXT, "AIRMAIL PASSWORD"
GERMAN + IDS_PASSWDSTAT, "Password"

GERMAN + IDS_NO_PERMISSION, "You have no access to this
function,\nDo you want to login now?"
GERMAN + IDS_LOGINWINDOWTEXT, "LOGIN"
GERMAN + IDS_USERNAME, "Username:"
GERMAN + IDS_PASSWORD, "Password:"

SWEDISH + IDS_PASSWDWNDTEXT, "AIRMAIL PASSWORD"
SWEDISH + IDS_PASSWDSTAT, "Password"

SWEDISH + IDS_NO_PERMISSION, "You have no access to this
function,\nDo you want to login now?"
SWEDISH + IDS_LOGINWINDOWTEXT, "LOGIN"
SWEDISH + IDS_USERNAME, "Username:"
SWEDISH + IDS_PASSWORD, "Password:"

}


Get the message? If you change the language offset it will just take the
strings of the selected language at runtime. For changing text in
dialogs etc show them in TDialog::SetupWindow().

Axel


0 new messages