Quoting Graeme Geldenhuys <[EMAIL PROTECTED]>:

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

TRASLATE THEM AT RUNTIME ?

Then what you need are variables, not constants.

Resources, (strings, images, or else), where intended
to be changed USING THE EXECUTABLE, WITHOUT ANY SOURCE CODE
and BEFORE the application runs.

I have used the "gettext" utilities and its "*.po" files a few times,
but, I do remember, that the developer could change
the "locale" or "culture" of the resources.

 cGenderGUI: array[TGender] of string =
     ( rsGenderMale, rsGenderFemale );

 cGenderDB: array[TGender] of string =
     ( 'M', 'F' );

Whenever I reference the cGenderGUI[xxx] I always get the original
resource string value instead of the translated one.  I'll double

You can use functions, instead of constants,
something similar to "properties":

---------------------------------------------

...

interface

type
  TGender = (gMale, gFemale);

  function GenderToStr(const Value: TGender): string;

implementation

function GenderToText(const Value: TGender): string;
begin
  // assign locale or language or culture to "gettext"
  // call the "getText" function for your strings
end;

...

---------------------------------------------

check tomorrow if I'm doing something stupid.

No, your code is right.

Just my 2 bee, I mean, 2 cents...

mramirez

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

Reply via email to