On 3/1/07, Michael Van Canneyt <[EMAIL PROTECTED]> wrote:

> Is it possible to use resource strings in constants and be able to
> translate them with 'gettext' unit at runtime?

No. Even in Delphi, this does not work :/


Anybody else got some idea how I could solve this problem?  I have
enumerated types and normally use constant arrays to show the text
string representation for a GUI or to be saved in the database.

Below is an example of how I populate a TComboBox with GUI friendly
text represeting the enumerated types.

We are in the process supporting multiple languages in our application
and need to find a way to translate the text represeting the
enumerated types.

-------------------------------
procedure TLearner_Gender_ComboBox_View.SetupGUIandObject;
var
 i: TGender;
begin
 EditControl.ReadOnly := True;

 { populate combo with enumerated types }
 EditControl.Items.BeginUpdate;
 try
   EditControl.Clear;
   for i := Low(TGender) to High(TGender) do
   begin
     EditControl.Items.Add(cGenderGUI[i]);
   end;
 finally
   EditControl.Items.EndUpdate;
 end;
end;
-------------------------------


Just for interest sake.  Why doesn't translated resource strings work
in constants?  Is it a compiler or language limitation or just a issue
of timing (when things get loaded)?


--
Graeme Geldenhuys

There's no place like S34° 03.168'  E018° 49.342'

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

Reply via email to