Skip to content

Commit

Permalink
Update Translation e AWSS3
Browse files Browse the repository at this point in the history
  • Loading branch information
bittencourtthulio committed Mar 28, 2021
1 parent 30d5bf9 commit 6d80664
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 56 deletions.
2 changes: 1 addition & 1 deletion Bind4Delphi.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
<DCC_CBuilderOutput>All</DCC_CBuilderOutput>
<SanitizedProjectName>Bind4Delphi</SanitizedProjectName>
<DCC_UnitSearchPath>modules\.dcp;modules\.dcu;modules;modules\aws4d\src;modules\dataset-serialize\src;modules\localcache4d\samples\LocalCache4D;modules\localcache4d\src;modules\restrequest4delphi\src;modules\translator4d\samples\GoogleTranslator;modules\translator4d\src;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
<DCC_UnitSearchPath>$(DCC_UnitSearchPath);modules\.dcp;modules\.dcu;modules;modules\aws4d\src;modules\dataset-serialize\src;modules\localcache4d\samples\LocalCache4D;modules\localcache4d\src;modules\restrequest4delphi\src;modules\translator4d\modules;modules\translator4d\modules\localcache4d\Win32\Debug;modules\translator4d\samples\GoogleTranslator;modules\translator4d\src</DCC_UnitSearchPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
Expand Down
12 changes: 6 additions & 6 deletions boss-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@
},
"https://github.com/bittencourtthulio/aws4d": {
"name": "aws4d",
"version": "1.0.0",
"hash": "873d84831be282886a613a8d4a6abd61",
"version": "1.0.1",
"hash": "5c3492b832d44eef567d6f9c6f6c15d0",
"artifacts": {},
"failed": false,
"changed": false
},
"https://github.com/bittencourtthulio/localcache4d": {
"name": "localcache4d",
"version": "1.0.1",
"hash": "aa0209716a9240a685b2700a6fe11582",
"version": "1.0.3",
"hash": "a7158204540e4b8518fa0e53c2b9024b",
"artifacts": {},
"failed": false,
"changed": false
},
"https://github.com/bittencourtthulio/translator4d": {
"name": "translator4d",
"version": "1.0.1",
"hash": "e5495e637775d7e64c5376189bf2ebf8",
"version": "1.0.3",
"hash": "b9f27579217e70834a98dd445a818a5f",
"artifacts": {},
"failed": false,
"changed": false
Expand Down
6 changes: 3 additions & 3 deletions boss.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"mainsrc": "./",
"projects": [],
"dependencies": {
"https://github.com/bittencourtthulio/aws4d": "^1.0.0",
"https://github.com/bittencourtthulio/localcache4d": "^1.0.1",
"https://github.com/bittencourtthulio/translator4d": "^1.0.1",
"https://github.com/bittencourtthulio/aws4d": "^1.0.1",
"https://github.com/bittencourtthulio/localcache4d": "^1.0.3",
"https://github.com/bittencourtthulio/translator4d": "^1.0.3",
"https://github.com/viniciussanchez/restrequest4delphi": "^v3.0.5"
}
}
33 changes: 3 additions & 30 deletions src/Bind4D.Attributes.pas
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,11 @@ S3Storage = class(TCustomAttribute)

Translation = class(TCustomAttribute)
private
FKey: String;
FSource: String;
FQuery: String;
FTarget: String;
procedure SetKey(const Value: String);
FQuery: String;
procedure SetQuery(const Value: String);
procedure SetSource(const Value: String);
procedure SetTarget(const Value: String);
public
constructor Create( aQuery : String; aSource : String; aTarget : String; aKey : String);
constructor Create(aQuery : String);
property Query : String read FQuery write SetQuery;
property Source : String read FSource write SetSource;
property Target : String read FTarget write SetTarget;
property Key : String read FKey write SetKey;
end;
{$endregion}

Expand Down Expand Up @@ -246,34 +237,16 @@ procedure FormRest.SetSort(const Value: String);

{ Translation }

constructor Translation.Create(aQuery, aSource, aTarget, aKey: String);
constructor Translation.Create(aQuery : String);
begin
FQuery := aQuery;
FSource := aSource;
FTarget := aTarget;
FKey := aKey;
end;

procedure Translation.SetKey(const Value: String);
begin
FKey := Value;
end;

procedure Translation.SetQuery(const Value: String);
begin
FQuery := Value;
end;

procedure Translation.SetSource(const Value: String);
begin
FSource := Value;
end;

procedure Translation.SetTarget(const Value: String);
begin
FTarget := Value;
end;

{ S3Storage }

constructor S3Storage.Create(aFileExtension, aContentType, aBucket, aAccounKey,
Expand Down
26 changes: 10 additions & 16 deletions src/Bind4D.pas
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ TBind4D = class(TInterfacedObject, iBind4D)
function Translator : iTranslator4D;
end;

var
vBind4D : iBind4D;

implementation

uses
Expand All @@ -75,13 +78,8 @@ procedure TBind4D.__BindCaptionToComponent(aComponent: TComponent;
TTranslator4D
.New
.Google
.Credential
.Key(pRtti.GetAttribute<Translation>.Key)
.&End
.Params
.Query(pRtti.GetAttribute<Translation>.Query)
.Source(pRtti.GetAttribute<Translation>.Source)
.Target(pRtti.GetAttribute<Translation>.Target)
.&End
.Execute;

Expand All @@ -91,13 +89,8 @@ procedure TBind4D.__BindCaptionToComponent(aComponent: TComponent;
TTranslator4D
.New
.Google
.Credential
.Key(pRtti.GetAttribute<Translation>.Key)
.&End
.Params
.Query(pRtti.GetAttribute<Translation>.Query)
.Source(pRtti.GetAttribute<Translation>.Source)
.Target(pRtti.GetAttribute<Translation>.Target)
.&End
.Execute;
end;
Expand Down Expand Up @@ -308,13 +301,8 @@ function TBind4D.BindFormatListDataSet(aDataSet : TDataSet; aDBGrid : TDBGrid) :
TTranslator4D
.New
.Google
.Credential
.Key(prpRtti.GetAttribute<Translation>.Key)
.&End
.Params
.Query(prpRtti.GetAttribute<Translation>.Query)
.Source(prpRtti.GetAttribute<Translation>.Source)
.Target(prpRtti.GetAttribute<Translation>.Target)
.&End
.Execute
else
Expand Down Expand Up @@ -604,7 +592,10 @@ function TBind4D.__GetComponentToValue(aComponent: TComponent; pRtti : TRttiFiel

class function TBind4D.New: iBind4D;
begin
Result := Self.Create;
if not Assigned(vBind4D) then
vBind4D := Self.Create;

Result := vBind4D;
end;

function TBind4D.SetStyleComponents: iBind4D;
Expand Down Expand Up @@ -797,4 +788,7 @@ procedure TBind4D.AdjustTimeDataSet(prpRtti: TRttiField; aDataSet: TDataSet);
aDataSet.EnableControls;
end;

initialization
vBind4D := TBind4D.New;

end.

0 comments on commit 6d80664

Please sign in to comment.