How to localize win32 dialogs?
I am working on Win32 dialogs with various controls like Static Text , Checkbox etc and all the strings need to be localized for different languages. I have designed the dialogs for US intl . But when I put localized strings those, not fitting properly and I have to change layout for each i开发者_如何学Gontl.
Is there a better way to do this?
Can I create one dialogs with one layout that should work with all Intsl???
I remember reading somewhere that, during initial layout of GUI resources at MS, they create the dialogs initially in German, and then double check the layouts at least in English and Japanese.
Once a dialog layout accommodates those three languages, it typically did not require further layout changes.
You could consider using ShowHTMLDialog. If you can work out the black magic of getting data into and out of the dialog HTML does have the advantage of controls that automatically scale to accommodate their text bounds.
In the past I implemented the following derived class from CDialog
called CLanguageDialog
. Then I called loadLanguage()
in the OnInitdialog()
. Then all my dialogs in my application would derive from CLanguageDialog
instead of CDialog
.
void CLanguageDialog::loadLanguage()
{
CWnd *pChild = this->FindWindowEx(this->m_hWnd, NULL, NULL, NULL);
while(pChild)
{
theApp.languageLoader.loadStringForWnd(pChild);
pChild = pChild->GetNextWindow();
}
}
精彩评论