[fpc-pascal] How to get the current translation of a resource string?

Luca Olivetti luca at ventoso.org
Wed Dec 2 13:42:40 CET 2020


El 2/12/20 a les 13:30, Michael Van Canneyt via fpc-pascal ha escrit:
> 
> 
> On Wed, 2 Dec 2020, Luca Olivetti via fpc-pascal wrote:
> 
>>> 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).
> 
> Seems like Lazarus is not using the regular resourcestrings then, because
> the whole point of using resourcestrings is that their value is the
> translated value...


Never mind, I was fooled by the debugger tool-tip, which shows the 
original definition and not the current value of the resourcestring  :-(


Bye
-- 
Luca


More information about the fpc-pascal mailing list