Search code examples
delphifiremonkey

I want to know how to "fill" the TStings defined in CollectLangString?


What is the "engine" under TLang...

TLang is ok in my small project but with larger project It is difficult to manage. I try to figure how it works. I've fund many proc and functions in FMX.Types. I've focus on: CollectLangStart, CollectLangFinish and CollectLangStrings. Calling those function can be compiled but I don't know where and when this TStrings is filled, the TStrings stay empty. The documentation talk about "scene" but it is very limited.


Solution

  • TStyleManager.UpdateScenes must be called between CollectLangStart and copying CollectLangStrings

    var
      Str: TStrings;
    begin
      CollectLangStart;
      TStyleManager.UpdateScenes;
      Str := TStringList.Create;
      try
        Str.Assign(CollectLangStrings); 
        Str.SaveToFile(ExtractFilePath(ParamStr(0)) + 'lang.lng');
      finally   
        Str.Free;
        CollectLangFinish;
      end;
    end;