Translation results in ?????
Hy all,
i have an not Unicode MFC Application, programmed in Visual Studio 2010 with C++. For translating my software, i have extraced all the resources into a resource -dll. This dll is translated with a tool, visual localize, to russian language i.e.. .
I load the dll with
this->m_hLanguageDLL=LoadLibrary(csFullDllName);
...
AfxSetResourceHandle(m_hLanguageDLL);
..
Most parts work well, but some text is displayes as ???? only. I reduced the problem to text, that is loaded from the resource with
CString csTmp;
...
csTmp.Format( IDS_STRING246 );
this results in the wrong text.
Can anybody give me a clou, what is wrong with this concept or how to get the correct behavior. Opening the dll in Visual Studio, the text entries are translated correctly.
english with the same mechanism works fine.
Thanks for any kind of help.
Re: Translation results in ?????
What language is used "ta match the language version of the non-Unicode programs..."? (Control Panel -> Regional and Language Options ->Advanced)
Re: Translation results in ?????
Quote:
Originally Posted by
VictorN
What language is used "ta match the language version of the non-Unicode programs..."? (Control Panel -> Regional and Language Options ->Advanced)
After switching this to russian, the "????" in the dialogs are gone, but those in the text, with csTmp.Format(IDS_STRING246) still are there.
Re: Translation results in ?????
Quote:
Originally Posted by
gintonic42
After switching this to russian, the "????" in the dialogs are gone, but those in the text, with csTmp.Format(IDS_STRING246) still are there.
What exactly are you trying to achieve with this Format? How does the IDS_STRING246 string look like?
Re: Translation results in ?????
I try to put all strings in my app into the resources, so i can translate the resource-dll. If i use
csTmp.Format(_T("Hello World!"))
it works fine, but the "Hello World!" does not appear in the dll so my client cannot translate it.
Re: Translation results in ?????
Quote:
Originally Posted by
gintonic42
... the "Hello World!" does not appear in the dll so my client cannot translate it.
What do you mean by "does not appear in the dll"?
It cannot appear there automatically, it is you who has to put this text in the dll string table!
After you put ii in the string table you should use CString::LoadString to load it in the CString object.
Re: Translation results in ?????
Same result. Of course the string is in the resource file. It is found in the english, german, ... version. The russian recource-dll also contains the string.
...
IDS_STRING246 "Programmbeschreibung"
...
But if i load it
+ csTmp "???????? ?????????" ATL::CStringT<char,StrTraitMFC_DLL<char,ATL::ChTraitsCRT<char> > >
appears in the debugger and also in the application
Re: Translation results in ?????
Please, show your actual code that icludes loading the string and using it to be shown in UI!
And please, stop posting some pseudo code patterns, especially because they are different in your every new post.
1 Attachment(s)
Re: Translation results in ?????
Ok, very easy
HMODULE m_hLanguageDLL=LoadLibrary(csFullDllName);
AfxSetResourceHandle(m_hLanguageDLL);
CString csTmp;
csTmp.Format( IDS_STRING246 );
AfxMessageBox(csTmp);
and the result is a message box with only ???????????
If i use LoadString instead of Format the same result. The number of ? is the same as the letters in the text.
Attachment 30423
Sorry for my mixing up.
Re: Translation results in ?????
And your IDS_STRING246 string is "Programmbeschreibung"? :confused:
But it does not use any cyrillic characters!
Re: Translation results in ?????
No, in the dll loaded, the IDS_STRING is allready translated to russian. I found out something new. If i use this code:
wchar_t buf[256];
AfxLoadString(IDS_STRING663,buf,256);
csTmp=buf;
in buf the text is correct. Then converted to CString csTmp it results in the ????????
Re: Translation results in ?????
The default conversion from wide char to MBCS is done using WideCharToMultiByte API which first paramaeter (CodePage ) defines how to convert.
ATL CString uses _AtlGetConversionACP() function to obtain the CodePage and the return value seems to not correspond the page you need to the proper conversion. See details here
Re: Translation results in ?????
Thanks Victor,
i finally found out, it was not a coding problem, but a problem in the settings of Windows. With the correct settings and the russian language installed correctly, the dialogs are displayed correct and also the messages load correct. Either with Format or LoadString.
Thanks for your help.