Page 1 of 1

How to translate FastReport labels?

Posted: Thu May 29, 2014 9:42 pm
by LeighM
Does anyone know how to translate FastReport?

I placed a FastReport (TfrxReport) component on a form; there is a TsiLanLinked on the form. I would like to translate the labels (TfrxMemoView fields) on the report, but can’t figure out how.

I noted that in the Extended Translations the Report is shown but no TfrxMemoView fields under Report. Any suggestions would be appreciated!

Posted: Fri May 30, 2014 1:31 pm
by Malcolm
Here is how I do it.

1. I create a var for each string as follows:

VAR
// translatable report strings
...
_total : STRING = ''; (* Total *)
...

2. write a procedure to update the strings when the language changes.

PROCEDURE TReportForm.UpdateStrings;
BEGIN
...
_total := SiLangRTReport.GetTextOrDefault('str_total'); // str_total is the StringID
...
END;

3. Now I can assign my strings to report variables as follows.

FrxReport1.Script.Variables['thetotal'] := _total;

It is a long time since I did this, but I think TsiLang Expert can help. Something to do with Consts section, I think.

But the above only translates the static text such as report captions. If you need to translate the report data you will have to translate it before passing it to the FrxReport.

I hope this points you in the right direction.

Posted: Fri May 30, 2014 2:04 pm
by LeighM
Thanks Malcolm

isiticov mentioned "just place TsiLang component on report and you will be able to translate it." (see link below). So I was hoping that it can translate static text on report just as it does for TChart component; in that the caption/text on the report can be translated in Extended Translations.

http://www.sicomponents.com/forum/viewt ... fastreport

Posted: Fri May 30, 2014 2:29 pm
by isiticov
Since 2003 FastReport dramatically changed the structure and design of their report components and they don't provide any more access to their fields as usual VCL. So I would recommend Malcolm's suggestion too.