On Thu, Jul 22, 2021 at 11:02 PM Maxim Ganetsky via lazarus
<lazarus@lists.lazarus-ide.org> wrote:


> Put them to RES or LRS file, link this file to your program, then
> extract them at runtime to some directory and load it from there.

Can't you use them from the resource like you can with po-files?

From one of my units that does thi using old style .lrs resource:

===========

type
  TTransalateFromLazarusResourceResult = (trSuccess,
trResourceNotFound, trTranslationError);

function TryTranslateFromLazarusResource: TTransalateFromLazarusResourceResult;
var
  LRes: TLResource;
  PO: TPOFile;
  SS: TStringStream;
  B: Boolean;
begin
  Result := trResourceNotFound;
  LRes := LazarusResources.Find('lclstrconsts.nl','PO');
  if LRes <> nil then
    begin
    SS := nil;
    PO := nil;
    try
      SS := TStringStream.Create(LRes.Value);
      //don't use TPoFile.Create(SS,True): it will crash on
TranslateUnitResourceStrings if you do
      PO := TPoFile.Create(SS, False);
      try
        B := TranslateUnitResourceStrings('lclstrconsts',PO);
        if B then Result := trSuccess else Result := trTranslationError;
      except
        Result := trTranslationError;
        DebugLn('Exception while translating LclStrConsts unit form
internal resources.');
      end;
    finally
      if Assigned(SS) then SS.Free;
      if Assigned(PO) then PO.Free;
    end;
  end;
end;
===============

-- 
Bart
-- 
_______________________________________________
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to