CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 1999
    Posts
    27

    Two String Tables

    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.



  2. #2
    Join Date
    Apr 1999
    Posts
    383

    Re: Two String Tables

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured