LCL: defaulttranslator: using property path, bug #12964, thanks to Klaus Reimer

git-svn-id: trunk@21242 -
This commit is contained in:
mattias 2009-08-16 09:57:14 +00:00
parent 8792aaa7cd
commit 8cb3925298

View File

@ -183,15 +183,26 @@ procedure TDefaultTranslator.TranslateStringProperty(Sender: TObject;
const Instance: TPersistent; PropInfo: PPropInfo; var Content: string);
var
s: String;
Section: String;
Component: TComponent;
begin
if not Assigned(FMOFile) then exit;
if not Assigned(PropInfo) then exit;
{DO we really need this?}
// do not translate at design time
if Instance is TComponent then
if csDesigning in (Instance as TComponent).ComponentState then exit;
{End DO :)}
if (AnsiUpperCase(PropInfo^.PropType^.Name)<>'TTRANSLATESTRING') then exit;
if csDesigning in (Instance as TComponent).ComponentState then exit;
if (UpperCase(PropInfo^.PropType^.Name)<>'TTRANSLATESTRING') then exit;
s:=FMOFile.Translate(Content);
if s = '' then
begin
Component := Instance as TComponent;
if Component.Owner<>nil then
Section := UpperCase(Component.Owner.Name) + '.';
Section := 'T' + Section + UpperCase(Component.Name) + '.' +
UpperCase(PropInfo^.Name);
s := FMoFile.Translate(Section + #4 + Content);
end;
if s<>'' then Content:=s;
end;