Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Languages and Resource Collapse All
Subject Author Date
Artur Shingirei Dec 15, 2004 - 4:20 AM

Hello,
I added string at resource of Your application "LanguageSwitcher"

ID_STRING_TEST
at both resource-Russian and English
and set for this ID different value at each "String Table"

So I add following code at Your application:

void CChildFormView::OnCustomLanguageSelected()
{
int nCurSel = m_comboLanguagePreference.GetCurSel();

    
    if( nCurSel >= 0 )
    {
        WORD nLangID = (WORD)
            m_comboLanguagePreference.GetItemData( nCurSel );
        g_ResourceManager->SetLangIdDesired( nLangID );
        HBITMAP hBitmap = GetLangBitmap( nLangID );
        m_staticActiveLanguage.SetBitmap( hBitmap );
        m_staticActiveLanguage.Invalidate();
    } // if( nCurSel >= 0 )
    ResetLocalizedResources();

    // Test
    CString str;
    str.LoadString(ID_STRING_TEST);
    
}

When I change current language from Russian to English and and vice versa the str always loaded value from Russian resourse.

Question:

How I can load string from resource depend on current language?

Technical Support Dec 15, 2004 - 7:35 AM

Please replace the following line in your code:

str.LoadString(ID_STRING_TEST);
with
g_ResourceManager->LoadString( str, ID_STRING_TEST );
If you need to load localized resources, use the methods of the resource manager. For the dialogs in your application, you need to use CExtResizableDialog or CExtResDlg as their base classes. And the last but not the least: Do not forget to recreate the dialog to see the changes.