[fpc-devel] the new resourcestring in const translation

Sergei Gorelkin sergei_gorelkin at mail.ru
Fri Sep 9 17:27:24 CEST 2011


09.09.2011 18:36, Martin пишет:
> fpc recently added the ability to translate
> const Foo: String = resourcestring;
>
> if resourcestring changes so does Foo
> Any way to work around this?
>
Probably only by duplicating the literal value which is used to initialize.

> because in C:\lazarus_latest\components\synedit\syneditstrconst.pp
> there are a lot of strings initialized that way with the intend of the old behaviour => keep an
> untranslated copy.
>
> Also: Is that intended for typed const?
> Foo in above could have been changed by user in the meantime.

Yes, trying to be Delphi-compatible. In Delphi, such consts are translated. Delphi translates them 
once during initialization, but in FPC this is impossible to do because translation typically 
happens later, so the only way is to hook into SetResourceStrings.

Personally I don't think this is a valuable feature, but the matter of fact is all Delphi features 
are implemented in FPC sooner or later - so why not to do it sooner...

Regards,
Sergei




More information about the fpc-devel mailing list