[Lazarus] Changing the translation of forms while the program is running

Maxim Ganetsky ganmax at narod.ru
Fri Jul 13 23:12:44 CEST 2012

13.07.2012 17:49, Joost van der Sluis пишет:
> Hi all,
> I'm using the DefaultTranslator unit to translate my application, but I
> would also like to switch to another language on-the-fly, thus without
> restarting the application.
> Are there any tricks to do that?

DefaultTranslator unit is quite simplistic and more meant to be an example.

In order to translate your application dynamically you should manually 
load .po files at runtime using functions (e. g. 
TranslateUnitResourceStrings) from Translations unit. See its header for 
examples. Also there is a number of program sources to look at bundled 
with Lazarus, e. g. lazarus\tools\lazdatadesktop (see TranslateStrs 
procedure at the end of frmmain.pp).

Best regards,
  Maxim Ganetsky                  mailto:ganmax at narod.ru

More information about the Lazarus mailing list