mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 00:29:28 +02:00
lcl: lcltranslator: fixed translating only TTranslateString properties
git-svn-id: trunk@56119 -
This commit is contained in:
parent
8300e744e7
commit
feb16f7063
@ -38,8 +38,11 @@ uses
|
|||||||
// RTL + FCL
|
// RTL + FCL
|
||||||
Classes, SysUtils, typinfo, GetText,
|
Classes, SysUtils, typinfo, GetText,
|
||||||
// LCL
|
// LCL
|
||||||
LResources, Forms,
|
LResources, Forms, LCLType,
|
||||||
// LazUtils
|
// LazUtils
|
||||||
|
{$IFDEF VerbosePOTranslator}
|
||||||
|
LazLoggerBase,
|
||||||
|
{$ENDIF}
|
||||||
Translations, LazFileUtils, LazUTF8;
|
Translations, LazFileUtils, LazUTF8;
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -334,48 +337,54 @@ begin
|
|||||||
case APropInfo^.PropType^.Kind of
|
case APropInfo^.PropType^.Kind of
|
||||||
tkSString,
|
tkSString,
|
||||||
tkLString,
|
tkLString,
|
||||||
tkAString: begin
|
tkAString:
|
||||||
TmpStr := '';
|
if APropInfo^.PropType=TypeInfo(TTranslateString) then
|
||||||
LRSTranslator.TranslateStringProperty(self,aninstance,APropInfo,TmpStr);
|
begin
|
||||||
if TmpStr <>'' then
|
TmpStr := '';
|
||||||
SetStrProp(AnInstance, APropInfo, TmpStr);
|
{$IFDEF VerbosePOTranslator}
|
||||||
end;
|
debugln(['TUpdateTranslator.IntUpdateTranslation ',GetStrProp(AnInstance,APropInfo)]);
|
||||||
tkclass: begin
|
{$ENDIF}
|
||||||
APersistentProp := TPersistent(GetObjectProp(AnInstance, APropInfo, TPersistent));
|
LRSTranslator.TranslateStringProperty(Self,AnInstance,APropInfo,TmpStr);
|
||||||
if Assigned(APersistentProp) then
|
if TmpStr <>'' then
|
||||||
begin
|
SetStrProp(AnInstance, APropInfo, TmpStr);
|
||||||
if APersistentProp is TCollection then
|
end;
|
||||||
begin
|
tkClass:
|
||||||
for j := 0 to TCollection(APersistentProp).Count-1 do
|
begin
|
||||||
begin
|
APersistentProp := TPersistent(GetObjectProp(AnInstance, APropInfo, TPersistent));
|
||||||
StoreStackPath:=FStackPath;
|
if Assigned(APersistentProp) then
|
||||||
FStackPath:=FStackPath+'.'+APropInfo^.Name+'['+inttostr(j)+']';
|
begin
|
||||||
IntUpdateTranslation(TCollection(APersistentProp).Items[j]);
|
if APersistentProp is TCollection then
|
||||||
FStackPath:=StoreStackPath;
|
begin
|
||||||
end;
|
for j := 0 to TCollection(APersistentProp).Count-1 do
|
||||||
end
|
begin
|
||||||
else
|
StoreStackPath:=FStackPath;
|
||||||
begin
|
FStackPath:=FStackPath+'.'+APropInfo^.Name+'['+IntToStr(j)+']';
|
||||||
if APersistentProp is TComponent then
|
IntUpdateTranslation(TCollection(APersistentProp).Items[j]);
|
||||||
begin
|
FStackPath:=StoreStackPath;
|
||||||
if (csSubComponent in TComponent(APersistentProp).ComponentStyle) then
|
end;
|
||||||
begin
|
end
|
||||||
StoreStackPath:=FStackPath;
|
else
|
||||||
FStackPath:=FStackPath+'.'+TComponent(APersistentProp).Name;
|
begin
|
||||||
IntUpdateTranslation(APersistentProp);
|
if APersistentProp is TComponent then
|
||||||
FStackPath:=StoreStackPath;
|
begin
|
||||||
end
|
if (csSubComponent in TComponent(APersistentProp).ComponentStyle) then
|
||||||
end
|
begin
|
||||||
else
|
StoreStackPath:=FStackPath;
|
||||||
begin
|
FStackPath:=FStackPath+'.'+TComponent(APersistentProp).Name;
|
||||||
StoreStackPath:=FStackPath;
|
IntUpdateTranslation(APersistentProp);
|
||||||
FStackPath:=FStackPath+'.'+APropInfo^.Name;
|
FStackPath:=StoreStackPath;
|
||||||
IntUpdateTranslation(APersistentProp);
|
end
|
||||||
FStackPath:=StoreStackPath;
|
end
|
||||||
end;
|
else
|
||||||
end;
|
begin
|
||||||
end;
|
StoreStackPath:=FStackPath;
|
||||||
end;
|
FStackPath:=FStackPath+'.'+APropInfo^.Name;
|
||||||
|
IntUpdateTranslation(APersistentProp);
|
||||||
|
FStackPath:=StoreStackPath;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
@ -470,6 +479,9 @@ begin
|
|||||||
if Assigned(FPOFile) then
|
if Assigned(FPOFile) then
|
||||||
begin
|
begin
|
||||||
s := GetIdentifierPath(Sender, Instance, PropInfo);
|
s := GetIdentifierPath(Sender, Instance, PropInfo);
|
||||||
|
{$IFDEF VerbosePOTranslator}
|
||||||
|
debugln(['TPOTranslator.TranslateStringProperty Content="',Content,'" s="',s,'" Instance=',Instance.ClassName,' PropInfo.Name=',PropInfo^.Name]);
|
||||||
|
{$ENDIF}
|
||||||
if s <> '' then
|
if s <> '' then
|
||||||
begin
|
begin
|
||||||
s := FPOFile.Translate(s, Content);
|
s := FPOFile.Translate(s, Content);
|
||||||
@ -517,7 +529,7 @@ begin
|
|||||||
|
|
||||||
if lcfn='' then
|
if lcfn='' then
|
||||||
begin
|
begin
|
||||||
// try now with MO traslation resources
|
// try now with MO translation resources
|
||||||
try
|
try
|
||||||
lcfn := FindLocaleFileName('.mo', Lang, Dir);
|
lcfn := FindLocaleFileName('.mo', Lang, Dir);
|
||||||
if lcfn <> '' then
|
if lcfn <> '' then
|
||||||
|
Loading…
Reference in New Issue
Block a user