'const array of resourcestring' is not translated
Original Reporter info from Mantis: Craig Peterson @boramis
-
Reporter name: Craig Peterson
Original Reporter info from Mantis: Craig Peterson @boramis
- Reporter name: Craig Peterson
Description:
"const" references to resourcestrings use the original compile-time text rather than the value returned in the SetResourceStrings() callback. Using the same construct in Delphi with a localized resource dll will use the localized value in both cases because it fixes up the const references manually during initialization.
Steps to reproduce:
Compile and run the code below. In FreePascal the output will be:
dimanche
Sunday
In Delphi, remove the SetResourceStrings call and use localized DLLs/stringtables for the translation, and the code will correctly produce:
dimanche
dimanche
------------
program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils;
resourcestring
SSunday = 'Sunday';
const
SDays: array[0..0] of string = (SSunday);
function Translate(Name,Value : AnsiString; Hash : Longint; arg:pointer) : AnsiString;
begin
Result := 'dimanche';
end;
begin
SetResourceStrings(@Translate, nil);
WriteLn(SSunday);
WriteLn(SDays[0]);
ReadLn;
end.
Mantis conversion info:
- Mantis ID: 19651
- Version: 2.4.3
- Fixed in version: 3.0.0
- Fixed in revision: 18968 (#689d4b3e)
- Monitored by: » @martin_frb (Martin Friebe), » @boramis (Craig Peterson)