El 2/12/20 a les 11:49, Michael Van Canneyt via fpc-pascal ha escrit:


On Tue, 1 Dec 2020, Luca Olivetti via fpc-pascal wrote:

Since I want to treat a specific exception that cannot be distinguished by the class alone but only by the class and message, I need to find the current translation of the resource string used to create the exception.

The documentation at

https://www.freepascal.org/docs-html/current/prog/progse40.html

mentions ResourceStringTableCount, ResourceStringCount, GetResourceStringCurrentValue but I can't find them anywhere in my copy of fpc 3.2.0 (they are in fpc 2.6.4 and 3.0.4).

I already did corrections on the documentation for this.

But the 'current translation' is simply the value of the resourcestring, so
you should not need to look it up ?

How?

I'm trying to detect this specific exception

      raise EInvalidOperation.Create(sCannotFocus);

(where sCannotFocus is defined in LCLStrConsts).

I tried

  if E is EInvalidOperation then
     if E.message=sCannotFocus

but it doesn't work (sCannotFocus holds the original, not the translated, string).

Bye
--
Luc<
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to