|
|||
|
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) > Bugs and Quirks in Sisulizer > Translate a resource file with C code
|
| Moderated by: Renate.Reinartz, Markus.Kreisel, Jaakko.Salmenius, Ilkka.Salmenius | Page: 1 2 |
|
||||||||||||
| Translate a resource file with C code - Bugs and Quirks in Sisulizer - 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 ... | ||||||||||||||
| Author | Post | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||
|
Benjamin Member
|
I have got a multi project (Borland c++ builder 5.1) with DLL in C code, and I must translate strings, who are in rc file. I try to translate it with LoadString(...) without any changement on display. Can I use a C funstion than LoadStr() to translate RC resource??? Project Sisulizer : "Embedded resource DLL files" Sisulizer 1.0.181 Attachment: Sisulizer Traduction.zip (Downloaded 2 times) Last edited on Thu Sep 21st, 2006 12:42 pm by Benjamin |
|||||||||||||
| ||||||||||||||
| ||||||||||||||
|
Benjamin Member
|
I try to send you directly my request, but you e-mail address doesn't work!!!!!!!
|
|||||||||||||
| ||||||||||||||
|
||||||||||||||
|
Jaakko.Salmenius Administrator
|
LoadStr is a VCL function that reads the resource from the active resource. By default this is the resource data of EXE file that you are running. However if you have loaded resource DLL LoadStr will get the resource from there first and if fails then from EXE. If you have plain C code you do not use VCL and you can not use LoadStr but you have to use WIN32's LoadString functions. Best regards, Jaakko
____________________ http://www.sisulizer.com - Three simple steps to localize |
|||||||||||||
| ||||||||||||||
| ||||||||||||||
|
Benjamin Member
|
Show my project example. I do that but nothing. Last edited on Thu Sep 21st, 2006 12:59 pm by Benjamin |
|||||||||||||
| ||||||||||||||
|
||||||||||||||
|
Markus.Kreisel Administrator
|
Hi Benjamin, we get a lot of mails incl. spam on our mail accounts wihout problems. Can you please post me the error message you get, so I can check what happens to your mail? Best Markus Kreisel http://www.sisulizer.com
____________________ http://www.sisulizer.com - Three simple steps to localize |
|||||||||||||
| ||||||||||||||
| ||||||||||||||
|
Markus.Kreisel Administrator
|
Hi Benjamin, have you tried to use this tip from Jaakko posted earlier in the forum? ------------------------- If you have a localized resource DLL you have to do the following steps: 1) Load the resource DLL into memory using LoadLibrary. This function will return a resource hadle. handle = LoadLibrary("MyApp.DEU"); Loads German resource DLL 2) For each string you call LoadString and you pass the resource handle and the string id. The function returns the string. LoadString(handle, 100, buffer, bufferLen); Reads the resource string having id 100 from tge MyApp.DEU resource DLL. We do not have any plain C samples to use resource string but the procedure is very simple. Just follow the step I decribed above. ------------------------------------------ Best Markus
____________________ http://www.sisulizer.com - Three simple steps to localize |
|||||||||||||
| ||||||||||||||
|
||||||||||||||
|
Benjamin Member
|
Markus, LoadLibrary(..) is a function using for opening "executable module" and I have to open resource file. When you execute my small example, it works?
|
|||||||||||||
| ||||||||||||||
| ||||||||||||||
|
Markus.Kreisel Administrator
|
Hi, your resources have to be part of a DLL file - and this is an executable module which of course can be loaded by loadmodule. Best Markus http://www.sisulizer.com
____________________ http://www.sisulizer.com - Three simple steps to localize |
|||||||||||||
| ||||||||||||||
|
||||||||||||||
|
Benjamin Member
|
Can you execute my sample application below. Because I don't know what you want that I must do. char sTemp[400]; Label1->Caption = DI_Translate(DI_Label, sTemp, 400); Edit1->Text = DI_Translate(DI_Edit, sTemp, 400); Button1->Caption = DI_Translate(DI_Bouton, sTemp, 400); resource file #include "dico.h" #ifdef RC_INVOKED STRINGTABLE { DI_Label "RApplication" DI_Edit "CVIPC" DI_Bouton "Langue" } #endif dico.h file #ifndef DicoH #define DicoH #define DI_Label 1 #define DI_Edit 2 #define DI_Bouton 3 #endif and I use Sisulizer to change the RC String I think that my small project can be build in C++ builder 6 and 2006. Can you try? Attachment: Sisulizer Traduction.zip (Downloaded 0 times) Last edited on Thu Sep 21st, 2006 03:53 pm by Benjamin |
|||||||||||||
| ||||||||||||||
| ||||||||||||||
|
Jaakko.Salmenius Administrator
|
I can not run it because it requires VCL50.bpl that I do not have. I looked you source code and fidn that you use LoadString correctly. However the first parameter (resource intance) in NULL and it means that it always uses the resources of the EXE. C++Builder 6 and 2006 has LoadStr function that uses the currently active resource (either resource in the EXE or resource in the resource DLL if any). It might be that it would work on C++Builder 5 but because I have not managed to get that old version I can not check it. I still don't quite understand what it is that you try to get. It is this: - You want to have one single EXE that supports multiple language. This can not be arvived by making multilingual EXE because you do not have control what is the active language. You must use resource DLLs. here there are two choices: 1) Separate resource DLLs. One for each language. If you EXE is MySample.EXE the MySample.DE is German resource DLL and MySample.FR French one. 2) Embedd the resource DLLs (e.g MySample.DE and MySample.FR) to the EXE. Currently we do not have a C++Builder sample for this (only Delphi) but I will create it and send it to you. Jaakko
____________________ http://www.sisulizer.com - Three simple steps to localize |
|||||||||||||
| ||||||||||||||
|
||||||||||||||
|
Jaakko.Salmenius Administrator
|
One more. Sisulizer can be use to change resource string (and any other resource as well). Sisulizer will create (depending on the setting): 1) One localized EXE for each language 2) One localized resource DLL for each language 3) One multilingual EXE that contains resource is all language of your project. However you can not control what is the language when application start. 4) As #2 but the resource DLLs are embedded as custom resources to the EXE file. You have to call ExtractResourceFiles somewhere in your application initialization to extract the resource DLL from custom resources to external resource DLLs. Jaakko
____________________ http://www.sisulizer.com - Three simple steps to localize |
|||||||||||||
| ||||||||||||||
| ||||||||||||||
|
Benjamin Member
|
I understand what you say. I put this function to the constructor but I cannot find what is the TExtractOptions : ExtractResourceFiles(TExtractOptions, "dico.rc"); ??? enum TExtractOption { eoCheckDate, eoRemoveFiles }; typedef Set<TExtractOption, eoCheckDate, eoRemoveFiles> TExtractOptions; can you show me how call this function
|
|||||||||||||
| ||||||||||||||
|
||||||||||||||
|
Jaakko.Salmenius Administrator
|
I am writing a C++Builder sample. I will send it to you tomorrow. Jaakko
____________________ http://www.sisulizer.com - Three simple steps to localize |
|||||||||||||
| ||||||||||||||
| ||||||||||||||
|
Benjamin Member
|
Thanks a lot
|
|||||||||||||
| ||||||||||||||
|
||||||||||||||
|
Jaakko.Salmenius Administrator
|
Hi Benjamin, I uploaded 1.0.182. Download it and update your Sisulizer setup. There was a bug in Sisulizer that make Sisulizer to write the embedded resource DLL using a lower case resource name. This made extraction of the resource DLLs to fail. <sldir>\VCL\CBuilder\Embedded directory contains a C++Builder sample that uses embedded resource DLLs. <sldir>\VCL\*.pas contains the new VCL source code. Read the comments to get more informtion about functions, types and parameters. The C++ header (*.hpp) do not contains any commants because they are automatically generated from the Delphi sources (*.pas) I hope this will help you create a multilingual C++Builder application. Best regards, Jaakko
____________________ http://www.sisulizer.com - Three simple steps to localize |
|||||||||||||
| ||||||||||||||
| ||||||||||||||
|
Benjamin Member
|
I cannot exacute your example can you send me the 2 DLL : borlndmm.dll cc3270mt.dll Or modify this project Borland 2006 in Borland 6 Plz
|
|||||||||||||
| ||||||||||||||
|
||||||||||||||
|
Benjamin Member
|
No it s good. I have modif this project in borland 5 no problem But, what about resource file and LoadString?
|
|||||||||||||
| ||||||||||||||
| ||||||||||||||
|
Jaakko.Salmenius Administrator
|
Sorry. I had left runtime library as DLLs. This new sample is all statically linked. I also added resource strings so you can see how to use them. Jaakko Attachment: Embedded.zip (Downloaded 3 times)
____________________ http://www.sisulizer.com - Three simple steps to localize |
|||||||||||||
| ||||||||||||||
|
||||||||||||||
|
Benjamin Member
|
Can you send me all the argument of ExtractResourceFiles ExtractResourceFiles(...); plz ![]() Attachment: ExtractResourceFile.JPG (Downloaded 13 times)
|
|||||||||||||
| ||||||||||||||
| ||||||||||||||
|
Jaakko.Salmenius Administrator
|
Look <sldir>\VCL\LaResource.pas
____________________ http://www.sisulizer.com - Three simple steps to localize |
|||||||||||||
| ||||||||||||||
| Current time is 04:34 pm | Page: 1 2 |
| 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) > Bugs and Quirks in Sisulizer > Translate a resource file with C code | |
Sisulizer software localization tool - Three simple steps to localize