Стартовый пул
This commit is contained in:
36
POTranslator/data/potranslate.pas
Normal file
36
POTranslator/data/potranslate.pas
Normal file
@@ -0,0 +1,36 @@
|
||||
unit PoTranslate;
|
||||
{$mode objfpc}{$H+}
|
||||
interface
|
||||
uses Classes, SysUtils, LResources, typinfo, Translations;
|
||||
type
|
||||
{ TPoTranslator }
|
||||
TPoTranslator=class(TAbstractTranslator)
|
||||
private
|
||||
FPOFile:TPOFile;
|
||||
public
|
||||
constructor Create(POFileName:string);
|
||||
destructor Destroy;override;
|
||||
procedure TranslateStringProperty(Sender:TObject; const Instance: TPersistent; PropInfo: PPropInfo; var Content: String); OVERRIDE;
|
||||
end;
|
||||
implementation
|
||||
{ TPoTranslator }
|
||||
constructor TPoTranslator.Create(POFileName: string);
|
||||
begin
|
||||
inherited Create;
|
||||
FPOFile:=TPOFile.Create(POFileName);
|
||||
end;
|
||||
destructor TPoTranslator.Destroy;
|
||||
begin
|
||||
FPOFile.Free;
|
||||
inherited Destroy;
|
||||
end;
|
||||
procedure TPoTranslator.TranslateStringProperty(Sender: TObject; const Instance: TPersistent; PropInfo: PPropInfo; var Content: string);
|
||||
var s: String;
|
||||
begin
|
||||
if not Assigned(FPOFile) then Exit;
|
||||
if not Assigned(PropInfo) then Exit;
|
||||
if (AnsiUpperCase(PropInfo^.PropType^.Name)<>'TTRANSLATESTRING') then Exit;
|
||||
s:=FPOFile.Translate(Content, Content);
|
||||
if s<>'' then Content:=s;
|
||||
end;
|
||||
end.
|
Reference in New Issue
Block a user