Search code examples
delphilocalizationdelphi-10.4-sydney

Delphi 10.4 localization issues


I'm trying Delphi 10.4. Localizing Windows applications was working like a charm in the past, but now when I dynamically load the RC DLL file, it only changes RCDATA, and not the "String Table" any more.

I was using this code (as quick resume)

NewInst := LoadLibraryEx(FileName, 0, LOAD_LIBRARY_AS_DATAFILE); 
....
CurModule.ResInstance := NewInstance;

FileName is the DLL file that has the resources (RCDATA and "String Table") that I could edit with "Resource Hacker" software, and can see that it contains "String table" Inside as expected.

It works fine for RCDATA (all forms are getting translated) but not "String table" anymore that is contained into Resourcestring section of any .pas file, and all string remains in the original language.

It was working fine in previous Delphi version (like 10.2) and I do not know why it fails with this version.


Solution

  • There is another solution. Disable the new caching by assigning LoadResStringFunc to nil. A good place to do that is in the beginning of the program.

    begin
    >>> ADD THIS to disable the caching
      LoadResStringFunc := nil;
    >>>
      Application.Initialize;
      Application.MainFormOnTaskbar := True;
      Application.CreateForm(TForm1, Form1);
      Application.Run;
    end.