Click to See Complete Forum and Search --> : Two String Tables


Frederic Naudeau
April 16th, 1999, 08:10 AM
Hi,

I would like to make my application multilingual, and for this I have done 2 string tables, one in French and one in English ( By "Insert copy").
In the OnInitialUpdate() method I'm doing something like :

::LoadString(AfxGetApp()->m_hInstance, IDS_BUTTON_TEXT, text, 512);
GetDlgItem(IDC_BUTTON)->SetWindowText(text);




But my problem is that I have always the same text. How can I change the String Table ?
How can I do something like :

LoadStringTable("string table [english (U.K.)]");
::LoadString(AfxGetApp()->m_hInstance, IDS_BUTTON_TEXT, text, 512);
GetDlgItem(IDC_BUTTON)->SetWindowText(text);




Thanks in advance.

Dave Lorde
April 16th, 1999, 09:13 AM
If you want to keep both string tables built into the app, you could number the IDs for the the two sets of string resources so that there is a constant offset between the IDs for each language:

// English
#define IDS_STRING1 100
#define IDS_STRING2 101
#define IDS_STRING3 102
#define IDS_STRING4 103

// German
#define IDS_GER_STRING1 500
#define IDS_GER_STRING2 501
#define IDS_GER_STRING3 502
#define IDS_GER_STRING4 503
//----------------------------
int Offset = GetLocalLanguageOffset();

::LoadString(AfxGetApp()->m_hInstance, IDS_STRING1 + Offset, text, 512);

Alternatively, put each set of language resources into a separate resource DLL, load the appropriate DLL at run-time, and use AfxSetResourceHandle to point to it.

Dave