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

2012-07-16 Thread Maxim Ganetsky
16.07.2012 15:58, Joost van der Sluis пишет: 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 w

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

2012-07-16 Thread Joost van der Sluis
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 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 t

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

2012-07-16 Thread Graeme Geldenhuys
On 16 July 2012 13:18, Mattias Gaertner wrote: > > Yes. This catches all special cases like memos, tree nodes, list views > and private variables as well. Correct, and I also couldn't rely on something like RTTI to iterate or query widgets on a form, because my widgets are declared private only (

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

2012-07-16 Thread Mattias Gaertner
On Mon, 16 Jul 2012 11:49:42 +0100 Graeme Geldenhuys wrote: > Hi, > > On 16 July 2012 11:27, Bart wrote: > > > > This would make maintanance (large menu's, active devolopment of forms > > in question) lots easier. > > > What I did is to encapsulate setting up captions to a single method, > Se

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

2012-07-16 Thread Mattias Gaertner
On Mon, 16 Jul 2012 13:58:57 +0200 Joost van der Sluis 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 a

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

2012-07-16 Thread Joost van der Sluis
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.

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

2012-07-16 Thread Graeme Geldenhuys
Hi, On 16 July 2012 11:27, Bart wrote: > > This would make maintanance (large menu's, active devolopment of forms > in question) lots easier. What I did is to encapsulate setting up captions to a single method, SetupCaptions, on each form. I use form inheritance, so each form simply needs to ov

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

2012-07-16 Thread Bart
On 7/16/12, Mattias Gaertner wrote: >> So I have to do MyLabel.Caption := SomeResourceString again after the >> translation. > > Yes. > In the ideal world I would set in OI that Caption uses a resourcestring, and the component has some method to re-read it's content, so one could do stuff like:

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

2012-07-15 Thread Mattias Gaertner
On Sun, 15 Jul 2012 23:58:32 +0200 Bart wrote: > On 7/15/12, Mattias Gaertner wrote: > > > The IDE forms set all captions when creating. See the FormCreate events. > > The maintenance work is near zero. > > Theoretically the code could be put into methods and triggered when the > > language cha

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

2012-07-15 Thread Bart
On 7/15/12, Mattias Gaertner wrote: > The IDE forms set all captions when creating. See the FormCreate events. > The maintenance work is near zero. > Theoretically the code could be put into methods and triggered when the > language changes. This works well if you create all forms on the fly I g

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

2012-07-15 Thread Maxim Ganetsky
15.07.2012 15:35, Sven Barth пишет: On 15.07.2012 12:24, Maxim Ganetsky wrote: 15.07.2012 13:53, Bart пишет: On 7/13/12, Maxim Ganetsky wrote: In order to translate your application dynamically you should manually load .po files at runtime using functions (e. g. TranslateUnitResourceStrings)

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

2012-07-15 Thread Sven Barth
On 15.07.2012 12:24, Maxim Ganetsky wrote: 15.07.2012 13:53, Bart пишет: On 7/13/12, Maxim Ganetsky wrote: 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 head

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

2012-07-15 Thread Maxim Ganetsky
15.07.2012 13:53, Bart пишет: On 7/13/12, Maxim Ganetsky wrote: 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. And you'll have to update

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

2012-07-15 Thread Mattias Gaertner
On Sun, 15 Jul 2012 11:53:24 +0200 Bart wrote: > On 7/13/12, Maxim Ganetsky wrote: > > > 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 > > e

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

2012-07-15 Thread Bart
On 7/13/12, Maxim Ganetsky wrote: > 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. And you'll have to update all captions of all contr

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

2012-07-13 Thread Maxim Ganetsky
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 simp

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

2012-07-13 Thread Corpsman
in short, no. in a bit longer : if you set within the application : Language.CurrentLanguage := 'what ever language you want'; The component tries to load that language file, if it exits your application is switched to the language, if not all translatable strings (captions, hints, .. and

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

2012-07-13 Thread Joost van der Sluis
On Fri, 2012-07-13 at 16:00 +0200, Corpsman wrote: > Try this one : > > http://corpsman.de/index.php?doc=komponenten/multilanguage Does it uses the .po and .mo files generated by Lazarus? Joost. -- ___ Lazarus mailing list Lazarus@lists.lazarus.free

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

2012-07-13 Thread Corpsman
Try this one : http://corpsman.de/index.php?doc=komponenten/multilanguage On 07/13/2012 03:51 PM, zeljko wrote: On Friday 13 of July 2012 15:49:37 Joost van der Sluis wrote: > Hi all, > > I'm using the DefaultTranslator unit to translate my application, but I > would also like to switch t

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

2012-07-13 Thread zeljko
On Friday 13 of July 2012 15:49:37 Joost van der Sluis wrote: > 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? I need t

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

2012-07-13 Thread 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? -- Met vriendelijke groeten, Joost van der Sluis CNOC Informatiesystemen en Ne