Is there a way to force the Delphi command line compiler to output English text?

993 Views Asked by At

Delphi comes localized in various languages (English, Japanese, German, French I think). The command line compiler (dcc32) also has been localized so the German version writes "Fehler" rather than "Error" and "Warnung" rather than "Warning" to the console.

I have written a program that parses this output and (as one of its features) counts Errors and Warnings. This fails with the localized strings.

I could adapt the program to also detect the localized text but that feels wrong. I'd rather force the compiler to use English for its output. Is there a command line switch or any other option to do that?

I'd like to support all Delphi versions that use msbuild, that is >=2007.

EDIT:

As for reading the error code rather than the message, consider the following error:

C:\[...]\Borland.Delphi.Targets(113,3): error : blub.pas(56) Error: E2029 ',' expected but identifier 'bla' found

The error code is E2029 but it is rather difficult for a program to detect it. Detecting the text "Error: " is much simpler and less error prone.

2

There are 2 best solutions below

2
David Schwartz On

I'd use a regular expression to parse these statements and grab the various pieces -- the error number in this case. (I realize a lot of folks hate regular expressions, but when you've got one or two format statements used to create all of the output following the exact same template, regex is perfect.)

7
Uwe Raabe On

As with most Delphi applications the used locale is set in the registry under HKEY_CURRENT_USER\Software\Embarcadero\Locales. Older versions may use HKEY_CURRENT_USER\Software\Borland\Locales.