lcl: lcltranslator: fixed translating only TTranslateString properties

git-svn-id: branches/fixes_1_8@56125 -
This commit is contained in:
mattias 2017-10-18 12:02:09 +00:00
parent 0042fcd132
commit 07d4a9ea3c

View File

@ -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,13 +337,19 @@ begin
case APropInfo^.PropType^.Kind of case APropInfo^.PropType^.Kind of
tkSString, tkSString,
tkLString, tkLString,
tkAString: begin tkAString:
if APropInfo^.PropType=TypeInfo(TTranslateString) then
begin
TmpStr := ''; TmpStr := '';
LRSTranslator.TranslateStringProperty(self,aninstance,APropInfo,TmpStr); {$IFDEF VerbosePOTranslator}
debugln(['TUpdateTranslator.IntUpdateTranslation ',GetStrProp(AnInstance,APropInfo)]);
{$ENDIF}
LRSTranslator.TranslateStringProperty(Self,AnInstance,APropInfo,TmpStr);
if TmpStr <>'' then if TmpStr <>'' then
SetStrProp(AnInstance, APropInfo, TmpStr); SetStrProp(AnInstance, APropInfo, TmpStr);
end; end;
tkclass: begin tkClass:
begin
APersistentProp := TPersistent(GetObjectProp(AnInstance, APropInfo, TPersistent)); APersistentProp := TPersistent(GetObjectProp(AnInstance, APropInfo, TPersistent));
if Assigned(APersistentProp) then if Assigned(APersistentProp) then
begin begin
@ -349,7 +358,7 @@ begin
for j := 0 to TCollection(APersistentProp).Count-1 do for j := 0 to TCollection(APersistentProp).Count-1 do
begin begin
StoreStackPath:=FStackPath; StoreStackPath:=FStackPath;
FStackPath:=FStackPath+'.'+APropInfo^.Name+'['+inttostr(j)+']'; FStackPath:=FStackPath+'.'+APropInfo^.Name+'['+IntToStr(j)+']';
IntUpdateTranslation(TCollection(APersistentProp).Items[j]); IntUpdateTranslation(TCollection(APersistentProp).Items[j]);
FStackPath:=StoreStackPath; FStackPath:=StoreStackPath;
end; end;
@ -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