On Fri, 13 Jul 2007 10:34:33 +0200
Luk Vandelaer <[EMAIL PROTECTED]> wrote:

> On Thursday 12 July 2007 23:40, A.J. Venter wrote:
> > Moreover this is clearly not an ideal setup for them since the
> > grammer would require the username to be elsewhere in the sentence
> > sometimes (how do I handle that), and there is the even more
> > complex part where I need to set a number of captions for a
> > different form out of this unit later on:
> >
> > TrayIcon1.Hint := IntToStr(Units)+' Units remaining';
> >   Popup1.Caption := IntToStr(Units)+' Units remaining';
> >   Popup1.Panel1.Color := RGBToColor(227,108,42);
> >   Writeln(Units);
> >   Popup1.TextY.Caption := 'Welcome user '+LoggedInUser+LineEnding;
> >   Popup1.TextY.Caption := Popup1.TextY.Caption+'You have
> > '+IntToStr(Units)+' time units left'+LineEnding;
> >
> > All of that should obviously ALSO be translated.
> >
> > How do I do that part please ?
> 
> By using the Format function. For example:
> 
> resourcestring
>   rsWelcomeMsg = 
>     'Welcome user %s'+LineEnding+'You have %d time units left';
> ...
>  Popup1.TextY.Caption :=  format(rsWelcomeMsg, [LoggedInUser, Units]);
> 
> A translation in Dutch could then be 
> 'Welkom, je hebt nog %1:d tijd eenheden over, %0:s.'
> which has the order of the parameters switched.

To create such resourcestrings easily you can use Tools > Make
Resource String'. For example

Popup1.TextY.Caption := 'Welcome user '+LoggedInUser+LineEnding;

Place the cursor on the string 'Welcome' and execute the tool.

See 
http://wiki.lazarus.freepascal.org/index.php/IDE_Window:_Make_ResourceString


Mattias

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to