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

Joost van der Sluis joost at cnoc.nl
Mon Jul 16 15:04:26 CEST 2012


On Mon, 2012-07-16 at 14:16 +0200, Mattias Gaertner wrote:
> On Mon, 16 Jul 2012 13:58:57 +0200
> Joost van der Sluis <joost at cnoc.nl> wrote:
> 
> > On Fri, 2012-07-13 at 15:51 +0200, zeljko wrote:
> > > On Friday 13 of July 2012 15:49:37 Joost van der Sluis wrote:
> > > > 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.
> > 
> > > I need that too atm :)
> > 
> > Try the attached patch for DefaultTranslator. With SetDefaultLang('nl')
> > it will switch the language on-the-fly (to Dutch in this case). 
> > 
> > It will loop through all forms in screens and will change all properties
> > that are present in the .po-file.
> > 
> > Maybe it is an idea to apply this patch so that others can also use
> > this? Or should users write their own 'DefaultTranslator' unit? (Then
> > this one could be added to the Wiki as an example)
> 
> Yes.
> Why is FStackPath a private variable instead of a parameter?

Because GetIdentifierPath (which needs FStackPath) is called from within
TranslateStringProperty, from which the parameters are defined in the
classes-unit?

-- 
Met vriendelijke groeten,

  Joost van der Sluis
  CNOC Informatiesystemen en Netwerken
  http://www.cnoc.nl





More information about the Lazarus mailing list