[fpc-pascal] Resourcestring questions

Adriaan van Os fpc at microbizz.nl
Thu Sep 13 15:32:47 CEST 2007

FPCs resourcestring feature is a great way to localize applications, yet I have the following 

1. The tutorial at 
<http://wiki.lazarus.freepascal.org/Translations_/_i18n_/_localizations_for_programs> gives the 
following example

    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)

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 ?


Adriaan van Os

More information about the fpc-pascal mailing list