View unanswered posts | View active topics It is currently Thu Feb 21, 2019 9:06 pm

Reply to topic  [ 1 post ] 
 Strings from translated string table not working 
Author Message

Joined: Fri Feb 15, 2013 10:06 am
Posts: 7
Reply with quote
Post Strings from translated string table not working
I have an Arabic translated resource dll created by Lingobit Localizer that I dynamically load. When I switch from English to Arabic all of the translations work except for the strings read using the _LS macro provided in ResString.h. Note, I used Lingobit Extractor to create the extra string table. Everything appears to load correctly when I call MultiLangInitLocalization (I've stepped through the code in the debugger and also added trace statements). I added a trace statement in MultiLangLoadLocalization that prints the name of the module being loaded and it is the correct dll (I also see all of my translated controls). This is the code I use to print the module name:

hInstance = AfxLoadLibrary ( szLangDLL );
#ifdef _DEBUG
char szPath[ MAX_PATH ];
DWORD result = ::GetModuleFileName( hInstance, szPath, MAX_PATH );
if( result )
ATLTRACE( "Setting resource handle to %s\n", szPath );
AfxSetResourceHandle ( hInstance );
return TRUE;

In ResString.h I added trace statements as well to LoadAnsiString_Global. When a string is loaded via this function it loads it from the English string table embedded in the .exe Here is the full function with my debugging outputs.

static inline char* LoadAnsiString_Global( UINT id, UINT& len )
static UINT const MAX_STR_LEN = 4097;
static char GlobalStrBuffer[ MAX_STR_LEN ];
HINSTANCE hinstance = ::GetModuleHandle ( NULL );
if( hinstance == NULL )
// Retrieve the system error message for the last-error code

LPVOID lpMsgBuf;
DWORD dw = GetLastError();

(LPTSTR) &lpMsgBuf,

std::string errMsg( (LPCTSTR)lpMsgBuf );
ATLTRACE( "GetModuleHandle failed with error %d: %s\n", dw, errMsg.c_str() );

LocalFree( lpMsgBuf );

#ifdef _DEBUG
char tempBuff[ 1024 ];
DWORD result = ::GetModuleFileNameA ( hinstance, tempBuff, 1024 );
if( result )
ATLTRACE( "LoadAnsiString_Global using resources from %s\n", tempBuff );

len = ::LoadStringA ( hinstance, id, GlobalStrBuffer, sizeof( GlobalStrBuffer ) );
return GlobalStrBuffer;

When the app starts up and multilang initializes I see this string printed to trace:
Setting resource handle to C:\WorkSpaces\WorkSpace_CFFT_II_i18n\CFFT_i18n_MBCS\CFFT\Instructor\Debug\WinGFApp.ARH

However, when a string is pulled from the string table, via the _LS macro, I see this string printed to trace:
LoadAnsiString_Global using resources from C:\WorkSpaces\WorkSpace_CFFT_II_i18n\CFFT_i18n_MBCS\CFFT\Instructor\.\Debug\WinGFApp.exe

I opened the dll created by Lingobit Localizer in Visual Studio and verified that all my strings are present.

Any idea what is going wrong here? Is there something that I am dong wrong?

Thu Mar 21, 2013 1:43 pm
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Software Localization Tool - Lingobit Localizer