Add FastReport: Localization


You have now learned how to build simple reports. Supposedly, you created a wonderful application with printing. How could you make it comprehensible for the whole world? Let’s consider the localization possibility of FastReport.
FastReport supports a significant number of languages.
FastReport has several language sets: English, German, French, Danish, Portuguese-brazil, Spanish, Dutch, Swedish, Turkish, Italian, Polish, Czech, Hungarian, Slovene, Catalon, Slovak, Russian, Chinese, Ukrainian. Resources are located in ..\FR\RES folder. By default, FastReport library setups with English resources. To use German resources, copy the files with RES-extensions from ..\FR\RES\GERMAN folder to ..\FR\SOURCE folder.

That way, you can make your application fully German, French etc.

However, it is more interesting to change FastReport’s language during the application run-time without reloading.

There exist two paths for it:

a) use resources in a DLL. Compile the required resource in DLL (run mkdll.bat file from the FR\RES\your_resource folder) and in your program write:

frLocale.LoadDll('FR_ENGL.DLL');

If you want to use default resources, write:

frLocale.UnloadDll;

b) use resources in text file or ini file or in any other form. Use the event frLocale.OnLocalize. It sets the StringID and gets the ResultString. For example:

frLocale.OnLocalize := MyClass.OnLocalize;

procedure TMyClass.OnLocalize(StringID: Integer; var ResultString: String);
begin
if StringID = 53000 then
ResultString := 'Search';
end;

Attention! Localization “on-the-fly”, while the program is running, is only accessible in the FastReport VCL for Delphi and C++Builder. You can’t yet use it in the FastReport CLX.
Related Discussions
Latest News
Submit News Form Past News
Latest Forum Entries