// Lokalisierung von Properties aus Translate_xx.XML
Procedure SetTranslation(Lang:TDataset;TheForm:TForm);
var
TheComp:TComponent;
CN,CNP:
String;
PropInfo: PPropInfo;
V:PPTypeInfo;
cap,Prop:
String;
begin
Lang.Filter := '
FormClassName=' + QuotedStr(TheForm.ClassName) + '
AND not hidden';
Lang.Filtered := true;
While not Lang.Eof
do
begin
try
TheComp:=TheForm;
CN:=Lang.FieldByName('
ComponentName').asString;
if Length(CN)>0
then
begin
While (Pos('
.',CN)>0)
and Assigned(TheComp)
do
begin
CNP:=Copy(CN,1,pos('
.',CN)-1);
CN:=Copy(CN,pos('
.',CN)+1,Length(CN));
if Pos('
*',CNP)>0
then TheComp:=TheComp.Components[StrToInt(Copy(CNP,2,Length(CNP)))]
else TheComp:=TheComp.FindComponent(CNP);
end;
if Assigned(TheComp)
then
begin
if Pos('
*',CN)>0
then TheComp:=TheComp.Components[StrToInt(Copy(CN,2,Length(CN)))]
else TheComp:=TheComp.FindComponent(CN);
end;
end;
IF Assigned(TheComp)
then
begin
if Lang.FieldByName('
IsClassType').asBoolean
then
begin
PropInfo := GetPropInfo(TheComp,Lang.FieldbyName('
Property').Value);
if Assigned(PropInfo)
then
begin
try
if (
not (TheComp
is TMainMenu))
and (
not (TheComp
is TPopupMenu))
and (
not (TheComp
is TPageControl))
then //and ((not ((TheComp is TDBRadioGroup) or (TheComp is TRadioGroup)))) then
TStrings(GetOrdProp(TheComp,PropInfo)).Text:=Lang.FieldbyName('
Content').Value;
except
ON E:
Exception do MessageDLG( E.
Message+#13#10+TheComp.
Name + '
- ' + Lang.FieldbyName('
Property').Value,mtError,[mbok],0);
end;
end;
end
else
begin
cap:= Lang.FieldbyName('
Content').Value;
Prop:=Lang.FieldbyName('
Property').Value;
SetPropValue(TheComp,prop,cap);
end;
end;
except
ON E:
Exception do MessageDLG( E.
Message+#13#10+TheComp.
Name + '
- ' + Lang.FieldbyName('
Property').Value,mtError,[mbok],0);
end;
Lang.Next;
end;
end;