multi-country-languages support in visual c++

how to make an application which support multi-country-languages in visual c++ ? i'd like to allow the user to change the language in runtime mode by checking an item in a menu and i'd like changes to occur immediately.

Comments

  • First of all, if you have resources, like menu, dialogs etc. create a copy with the same ID, but with another language (you find it in the properties).
    Then you can use something like this:
    [code]
    LCID lang;

    // language stores the user's language choice.
    // for example 0 = english, 1 = italian
    switch(language)
    {
    case 0:
    lang = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT);
    break;
    case 1:
    lang = MAKELCID(MAKELANGID(LANG_ITALIAN, SUBLANG_ITALIAN), SORT_DEFAULT);
    break;
    }

    SetThreadLocale(lang);
    [/code]
    Note that if you want to update menus at run-time, you'll have to reload them!
    So use something like this:
    [code]
    SetMenu(hWnd, LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU)));
    [/code]

    bye
    nICO

    [hr]
    [italic]How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.[/italic]
    JOHN KEATS


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion