how to build a multilingual application?
-
i need to build an application and it needs to support some languages, how can i do it, how to change from one language to another?
-
i need to build an application and it needs to support some languages, how can i do it, how to change from one language to another?
http://www.codeproject.com/cpp/introtolocalization.asp[^] http://www.codeproject.com/tips/internationalization.asp[^] Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
-
i need to build an application and it needs to support some languages, how can i do it, how to change from one language to another?
Create some resource DLL's (dll that contains only resources without a code) for different languages. Type in CYourApp::InitInstance : hI=LoadLibrary(....) AfxSetResourceHandle(hI); unfortunately switching of language on the fly without application reboot is difficult task since you must recreate all objects (menus, toolbars, dialogs and so on)
-
http://www.codeproject.com/cpp/introtolocalization.asp[^] http://www.codeproject.com/tips/internationalization.asp[^] Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
thanks for the links.
-
Create some resource DLL's (dll that contains only resources without a code) for different languages. Type in CYourApp::InitInstance : hI=LoadLibrary(....) AfxSetResourceHandle(hI); unfortunately switching of language on the fly without application reboot is difficult task since you must recreate all objects (menus, toolbars, dialogs and so on)
thanks i`ll try that, and what can you suggest me to change them on the fly?
-
thanks i`ll try that, and what can you suggest me to change them on the fly?
I can't offer anything more cleverly as something like that example:
//Destroy for(int i = 0; i < m_arrToolbars.GetSize(); i++) { pToolbar = (CToolBar*)m_arrToolbars[i]; pToolbar->DestroyWindow(); delete pToolbar; }: ... //Create //Let's suppose you have array with all pointers to CTollbars for(i = 0; i < m_arrToolbarIDs.GetSize(); i++) { UINT nID = (UINT)m_arrToolbarIDs[i]; // create new pToolbar = new CToolBar(); if (!pToolbar->CreateEx(m_pMainFrame, TBSTYLE_FLAT, WS_CHILD | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(1,1,1,1), AFX_IDW_TOOLBAR + nID) || !pToolbar->LoadToolBar(nID)) { TRACE(_T("Failed to create view's toolbar from Resource %d\n"), nID); delete pToolbar; continue; // fail to create this toolbar but try others } ASSERT(::IsWindow(pToolbar->GetSafeHwnd())); // set toolbar title CString csTitle; csTitle.LoadString(m_arrToolbarTitleIDs[i]); pToolbar->SetWindowText(csTitle); // cache the pointer tho the new created toolbar m_arrToolbars.Add(pToolbar); }
But it's a very little part of changing interface - only for toolbars. Similarly you should execute such operation for all objects including all dialogs. However why you should make the complications to yourself? It is easier to reboot application :)