-
October 4th, 2012, 10:17 AM
#1
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.
-
October 5th, 2012, 03:21 AM
#2
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)
Victor Nijegorodov
-
October 5th, 2012, 04:38 AM
#3
Re: Translation results in ?????
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.
-
October 5th, 2012, 04:51 AM
#4
Re: Translation results in ?????
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?
Victor Nijegorodov
-
October 5th, 2012, 06:11 AM
#5
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.
-
October 5th, 2012, 06:17 AM
#6
Re: Translation results in ?????
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.
Victor Nijegorodov
-
October 5th, 2012, 06:40 AM
#7
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
-
October 5th, 2012, 06:54 AM
#8
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.
Victor Nijegorodov
-
October 5th, 2012, 07:50 AM
#9
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.
Sorry for my mixing up.
-
October 5th, 2012, 07:59 AM
#10
Re: Translation results in ?????
And your IDS_STRING246 string is "Programmbeschreibung"?
But it does not use any cyrillic characters!
Victor Nijegorodov
-
October 5th, 2012, 08:18 AM
#11
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 ????????
-
October 5th, 2012, 09:37 AM
#12
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
Victor Nijegorodov
-
October 9th, 2012, 10:03 AM
#13
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|