Generate RES (stringtable) file from a unit resourcestring

1

I am studying some sources on how to internationalize software, and in the example I have the software has a unit with constant strings (captions, etc), something like:

unit Resources;
interface
resourcestring
  CompanyName = '***';
implementation
end.

And another one with the 'IDs' for each string and then call via:

System.SysUtils{$ELSE}SysUtils{$ENDIF}.LoadStr(ID)

The project has a RES file, something like StrConsts.res, which it calls in the program's directive:

{$R StrConsts.res}

The res has only one StringTable, with all the IDs and referring strings, what I wanted to know is how to generate the res file from the resourcestring unit.

    
asked by anonymous 26.01.2016 / 08:36

2 answers

0

To create an .res file, follow the steps below:

1) Create and save a text file with extension ".rc" with the information you want. Example: test.rc

2) At the DOS command prompt, run the following command BRCC32 test.rc

Note: The BRCC32 file is available in the Delphi \ bin directory.

    
28.01.2016 / 18:50
0

The best way to do this I discovered was by looking at the FastReports components. Basically they use two units:

1) frxrcClass.pas = unit containing captions.

2) frxRes.pas = unit with subtitle switching functions.

In each form or unit you declare "uses frxClass, frxRes" and you can call the Get function to swap out each desired caption.

Take a look, if you are interested, you can rewrite the functions for your use. I hope I have helped !!!

    
28.01.2016 / 16:58