[fpc-pascal] resourcestring and const arrays
Krzysztof
dibo20 at wp.pl
Fri Jun 24 23:52:57 CEST 2011
Hi,
I had similar problem, I think that this is because consts are "filled" when
compiling and there is no way to change them at runtime. Try this trick with
pointers:
resourcestring
SSunday = "Sunday";
const
SWeek: array[0..0] of PString = (@SSunday);
begin
WriteLn(SWeek[0]^);
end;
Regards
2011/6/24 Marco van de Voort <marcov at stack.nl>
> In our previous episode, Craig Peterson said:
> > In Delphi I can use resource strings with const arrays and everything
> > works correctly. For example, if I have a resource DLL with translated
> > strings and this will work:
> >
> > resourcestring
> > SSunday = "Sunday";
> >
> > const
> > SWeek: array[0..0] of string = (SSunday);
> >
> > begin
> > WriteLn(SWeek[0]);
> > end;
> >
> > I've tried doing the same with FPC's GetText unit and
> > SetResourceStrings. SSunday gets translated correctly, but SWeek
> doesn't.
> >
> > Is that something that should work if I'm early enough in the
> > initialization order, an unimplemented feature, or something that's
> > unlikely to changed?
>
> No, this is a problem of gettext. If you use dxgettext on Delphi instead of
> Windows built in resourcesystem there is the same problem.
>
> For this to work you really need resource types that work based on
> replacing
> memory areas, or use _()
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20110624/73f01b45/attachment.html>
More information about the fpc-pascal
mailing list