|
|||
| Moderated by: Renate.Reinartz, Markus.Kreisel, Jaakko.Salmenius, Ilkka.Salmenius |
|
||||||||||||||||
| How to localize bitmaps? - Usage - Three simple steps to localize - Technical Support (You need to be registered at the forum to write) - .NET, Delphi, ... - Sisulizer Localization Tool Support | |||||||||||||||||
| Author | Post | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|||||||||||||||||
|
heinze Member
|
Hello, with some resource editor tool I created a .res file that contains two bitmaps. One of these bitmaps contains the german text "Hauptmenü", the other one contains the english translation "Main Menu". In the .res file, I gave both bitmaps the same resource name "HAUPTMENUE" and assigned different languages to them (see attachment). I also included the .res file into my delphi project (using the $R directive) and brought the resource into my resource dll with Sisulizer. (As German is the default language, I only have a resource dll for English, not for German.) So when my application starts with german language, it should load the german bitmap resource, when it starts with english lanugage, it should load the english bitmap resource. I tried to use the code of the <SISU-DIR>\VCL\Images example project but I always get an exception saying that the bitmap image is not valid. Probably the stream returns no data. Here is the code that I use (NavBarVImage is a TImage): stream := TResourceStream.Create(GetResourceInstance, 'HAUPTMENUE', RT_BITMAP); //image := TBitmap.Create; try //image.LoadFromStream(stream); NavBarVImage.Picture.Bitmap.LoadFromStream(stream); finally //image.Free; stream.Free; end; Attachment: Hauptmenue_res_screenshot.jpg (Downloaded 14 times)
|
||||||||||||||||
| |||||||||||||||||
| |||||||||||||||||
|
Markus.Kreisel Administrator
|
Hi, Why don't you include bitmaps in your localization project? See Project - Edit Source - <your source> - Excluded Types. Make sure that Picture is not excluded. Now if you localize your DLL you can replace the image and Sisulizer creates you a localized resource. It works the same as with Strings. Since your image consists just of a rotated text it might be even easier to create the image at runtime from a string using the GDI. If you later have to localize to other languages you don't need to create more and more images. Hope this helps Markus
____________________ http://www.sisulizer.com - Three simple steps to localize |
||||||||||||||||
| |||||||||||||||||
|
|||||||||||||||||
|
Jaakko.Nieminen Administrator
|
If you have the same source in two different languages it is unsafe to use TResourceStream.Create because it may pick either of the image. The class can not make difference between different language version but uses the resource that is first on the resource tree. It may be German or English. I recommend you to add the image resource in one language only. If you original language is German add the German image. Then the translator translates the image into English. Because you get an error message I belives the resource DLL does not contain the image resource. Check that it is really there. Jaakko
|
||||||||||||||||
| |||||||||||||||||
| |||||||||||||||||
|
heinze Member
|
Markus.Kreisel wrote: Hi, Hi Markus, both of your tips were very useful! Thank you. For my rotated text I changed my code so that the text is now written at runtime. Now the text is less smooth but that doesn't matter for me. :-) Including bitmaps in the project is also a good idea because I have further bitmaps in my application that have to be localized. Heinze
|
||||||||||||||||
| |||||||||||||||||
| Current time is 08:27 am | |
| .NET, Delphi, ... - Sisulizer Localization Tool Support > Technical Support (You need to be registered at the forum to write) > Usage - Three simple steps to localize > How to localize bitmaps? | |
Sisulizer software localization tool - Three simple steps to localize