On Thu, 13 Sep 2007, Adriaan van Os wrote:

> FPCs resourcestring feature is a great way to localize applications, yet I
> have the following questions.
> 
> 1. The tutorial at
> <http://wiki.lazarus.freepascal.org/Translations_/_i18n_/_localizations_for_programs>
> gives the following example
> 
>  resourcestring
>    Caption1 = 'Some text';
>    HelloWorld1 = 'Hello World';
> 
>  Label1.Caption := HelloWorld1;
> 
> Wouldn't it be simpler if resourcestrings could be defined and used directly
> by the form ? That would save a lot of code of the form Labelxx.Caption :=
> yyy. Of course, this implies a "reload form strings" method to reload form
> strings when the current language changes.
> 
> (my apologies if this is a Lazarus question, it seems related to the compiler
> also)

There is a hook for this, but the question is how to identify the string you
need.

> 
> 2. Previously, when using a "GetStringFromResource" routine, I could write
> something like
> 
>       for n:=1 to 100 do ComboAdd( GetStringFromResource( kComboItemOffs +
> n))
> 
> This doesn't seem to be possible with resourcestring lists, because they use
> string constants, rather then numbers. Unless, of course, we extend the
> compiler to optionally attach a number or a number-constant to resourcestring
> entries rather than a string constant. Plus a standard function that converts
> the number into a string. This facilitates converting current applications
> (that still use resource IDs) also. Any comments ?

No applications use resource ID's at the moment. 

Changing this is not so easy; Allocating a resource ID per string is not an
easy algorithm, since you don't know in advance which strings will be
included in your application, and which ones are not.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to