Changing Consts.dcu

Posted on 2004-11-04
Last Modified: 2010-04-04
I have got one Consts.dcu with English strings and another Consts.dcu for another language.
Is it possible in an application to shift between these two in runtime?
Question by:rainbowsoftware
    LVL 17

    Expert Comment

    by:Wim ten Brink
    LVL 17

    Expert Comment

    by:Wim ten Brink
    However, an alternative would be to use language resources, combined with Delphi's multi-language support. There are quite a few techniques to support multi-lingual support, however this does mean that you have to think ahead and change all string constants into resourcestring constants.
    LVL 3

    Expert Comment

    do you mean you have all your strings in dcu`s ?
    or do you mean that the delphi specific strings are in the consts.dcu?
    (that are part of the compiler)
    LVL 17

    Accepted Solution

    For multi-lingual projects I just have strings in *.res files. The main application uses the default (english) resource files and I have additional resource DLL's for the other languages. Those resource DLL's are created by Delphi from the other *.RES files. They also contain the *.DFM's for the other languages in my projects. It's how Delphi's default multi-language support works.
    There are several other solutions too, btw. But the default Delphi method is the one I like most, though.

    If you look at Consts.pas then you'll notice that all the strings are defined as resourcestring. Thus, during compilation they are stored in the *.res file and not in the compiled code itself. The code and the RES file are merged after compilation is done. But Delphi's multi-lingual support allows you to make translations of the resource files that Delphi adds to the compiled code. These resource files are both the *.DFM files and the *.RES files.

    But I believe you need at least the Enterprise version of Delphi for this... :-(

    Author Comment

    Thanks to Workshop Alex for an explanation. Helped me to understand, but unfortunately I have to accept, taht it is not possible to do what I want.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
    Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now