Support forum of the software localization tool Sisulizer


Localization Tool for VB, Delphi, .NET, C#, VB.NET, XML, Online Help, HTML ... Home

Get in contact with the makers of Sisulizer.
Our forum is open for all questions around Sisulizer from customers and prospects.
Don't hesitate to register and ask. The Sisulizer team will answer ASAP.

Search     Help Home Sisulizer Website Download
Search by username
Not logged in - Login | Register 

 Moderated by: Renate.Reinartz, Markus.Kreisel, Jaakko.Salmenius, Ilkka.Salmenius
New Topic Reply Printer Friendly
Delphi Resource DLL problem - Usage - Three simple steps to localize - Technical Support (You need to be registered at the forum to write) - Localization Tool for VB, Delphi, .NET, C#, VB.NET, XML, Online Help, HTML ...
AuthorPost
 Posted: Wed Jan 9th, 2008 02:38 am
PM Quote Reply
heaths
Member
 

Joined: Tue Jan 8th, 2008
Location:  
Posts: 2
Status: 
Offline
I am evalutaing Sisulizer v1.6.17, translating a test application written in Delphi 2006. The application has resourceStrings and a number of other resources linked in at compile time, bitmaps, wave files, rtf file.
I have translated the resources and generated the resource dlls however the results are not as expected. I know the resource dll is being loaded because the translated resourceStrings appear as expected, but any of the other resources I load at run time come from the original executable, not the localized resource dll. resHacker confirms the translated resources are in the generated DLL (*.DE for example), but they are not loaded when I try for example:
    image1.BitmapChecked.LoadFromResourceName(hInstance, 'myBmp');

How do I get my application to load the resources from the localized resource DLL instead of the default resources embedded in the app, the strings just work but none of my other resources are loaded from the generated DLL.

Just for interests sake I tried generating localized files and in this case it works as expected since the resources are replaced inside the executable, but how to make it work with resource dlls?

Kind Regards, Heath Stephens


Back To Top PM Quote Reply

 Posted: Wed Jan 9th, 2008 06:14 am
PM Quote Reply
Jaakko.Salmenius
Administrator


Joined: Sat Apr 8th, 2006
Location: Tokyo, Japan
Posts: 1641
Status: 
Offline
When you read data from resource you have to use LibModuleList.ResInstance instead of HInstance.  HInstance always points to the main EXE. LibModuleList.ResInstance points to the active resource DLL. VCL has a build in mechanism for form and string data but all other data types you have to change HInstance to LibModuleList.ResInstance.

procedure TForm1.Initialize;
resourcestring
  SMsg = 'Powder skiing';
var
  image: TJpegImage;
  stream: TResourceStream;
begin
  // You have to load the picture resource from active resource instance (if any)
  // instead of applications main instance (HInstance)
  if LibModuleList <> nil  then
    stream := TResourceStream.Create(LibModuleList.ResInstance, 'Sample', 'IMAGE')
  else
    stream := TResourceStream.Create(HInstance, 'Sample', 'IMAGE');


  image := TJpegImage.Create;

  try
    image.LoadFromStream(stream);
    Image1.Picture.Graphic := image;
  finally
    image.Free;
    stream.Free;
  end;


  Label1.Caption := SMsg;
end;


I have attached a Delphi sample that load JPEG data from resources. This sample will be in the next SL build as well.

Jaakko

Attachment: Image.zip (Downloaded 13 times)



____________________
http://www.sisulizer.com - Three simple steps to localize
Back To Top PM Quote Reply

 Posted: Wed Jan 9th, 2008 09:32 pm
PM Quote Reply
heaths
Member
 

Joined: Tue Jan 8th, 2008
Location:  
Posts: 2
Status: 
Offline
Jakko, your solution works perfectly, thank you very much for you prompt help.

Regards, Heath

Back To Top PM Quote Reply

Current time is 10:05 pm  
Localization Tool for VB, Delphi, .NET, C#, VB.NET, XML, Online Help, HTML ... > Technical Support (You need to be registered at the forum to write) > Usage - Three simple steps to localize > Delphi Resource DLL problem



WowUltra 1.11 Copyright © 2007 by Jim Hale - Based on WowBB Copyright © 2003-2006 Aycan Gulez

Sisulizer software localization tool - Three simple steps to localize