Can package with localization feature? |
27.6.05 |
I am trying to add multi-language support feature into my package but meet difficulties. In the package, some components are to send command to the host server and handle its responses code. Based on received code, the components return out the corresponding message. With localization feature, the components need able to return the translated messages based on workstation locale or application defined language. It seems to be not difficult task as many 3rd party localization toolkits are available like Localizer, TsiLang and etc.
In the program, Everything can be localized in the application but not in the components. When input "CODE1" in editbox Edit1, it always return "String 1" no matter which language I select. After consulting with Localizer support, it is normal as Localizer does not translate those not used in the application. And the resourcestrings in the TStrLibrary is loaded at the moment it being created and never after. Does it mean there is no way to do localization in my package?? [updated on Jun 28 for blog display] |
I'm Urano and I am living in Mexico City. I'm a reader for you blog.
Today I realized that the format in your blog has changed. I don't like the new format, What happened?
Best Regards...
Urano
I don't want to take this solution as the component users has to add a list of dummy strings into their programs.
Any unused strings are normally optimized out by the Delphi compiler. You can see this by telling the Delphi compiler to leave the .drc file (I think the command-line option is --gendrc) and opening it in a text editor. Any resource strings not used by your application will not show up in the .drc file.
As far as the loading of the resources, if you are using resourcestrings then this is automatically done when your program starts. BTW, you can try looking at the source for the LoadResourceModule function in System.pas to see how exactly the resource loading is done.
If you really want to be able to change resources on the fly, see the RichEdit demo (should be under \Demos\RichEdit), specifically the source file reinit.pas. That should give you some ideas on what would need to be done.
If you have any questions or clarifications, please do not hesitate to contact me. My email is lsaguisag (at) borland (dot) com.
Cheers.
-- Leo
<< Home