Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multi-language translation.

Status
Not open for further replies.

haibin

Technical User
Jul 16, 2003
4
BE
Hello,

I'm a new guy in C++. I'm now busy programming with a small dialog program (MFC) which requires multi-language interface support.
For example, English, Dutch, German... I have created the seperate DLL programs, Now I want to dynamically load one of those DLLs depends on the language selected by the operating system.
I hope you can give me some hints or code examples, that would be a great help for me !! Thank you in advance!!

hibin

 
I'm doing the same than you.
I'm using BCB6 and I think is easier using internationaliazing the project.
Just translate the dialogs and add it to your project



---LastCyborg---
 
Hi Hibin.

You could do what LastCyborg says, but it is better to use 'National Support' functions. To establish the system language, use the 'GetSystemDefaultLang' function. This will return a language identifier number (these should be given in your documentation). An example of a multinational program is given below. Hope that is helpful :)
Code:
#include <windows.h>

LANGID syslang;

int WINAPI WinMain (HINSTANCE hInst,
                    HINSTANCE hPrev,
                    LPSTR szCmd,
                    int nShow)
{
  char text[50];
  char capt[10];
  syslang = GetSystemDefaultLangID();

  switch (syslang)
  {
    case 0x040c:
      strcpy(capt,&quot;Francais&quot;);
      strcpy(text,&quot;Bonjour !&quot;);
      break;

    case 0x0407:
      strcpy(capt,&quot;Guten Tag&quot;);
      strcpy(text,&quot;Deutsch&quot;);
      break;

    default:
      strcpy(capt,&quot;English&quot;);
      strcpy(text,&quot;Hello !&quot;);
      break;
  }
  MessageBox(0,text,capt,MB_OK);
  return 0;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top