Skip to content

Commit

Permalink
New string resources.
Browse files Browse the repository at this point in the history
  • Loading branch information
anderson-joyle committed Mar 8, 2024
1 parent 3249eb4 commit 90b12e2
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 25 deletions.
4 changes: 2 additions & 2 deletions src/libraries/Microsoft.PowerFx.Core/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -492,8 +492,8 @@ internal static class TexlStrings
public static StringGetter PatchChangeRecordsArg = (b) => StringResources.Get("PatchChangeRecordsArg", b);

public static StringGetter AboutCollect = (b) => StringResources.Get("AboutCollect", b);
public static StringGetter CollectDataSourceArg = (b) => StringResources.Get("CollectDataSourceArg", b);
public static StringGetter CollectRecordArg = (b) => StringResources.Get("CollectRecordArg", b);
public static StringGetter CollectArg1 = (b) => StringResources.Get("CollectArg1", b);
public static StringGetter CollectArg2 = (b) => StringResources.Get("CollectArg2", b);

public static StringGetter CollectItemArg = (b) => StringResources.Get("CollectItemArg", b);
public static StringGetter AboutCollect_data_source = (b) => StringResources.Get("AboutCollect_data_source", b);
Expand Down
18 changes: 4 additions & 14 deletions src/libraries/Microsoft.PowerFx.Core/Texl/Builtins/Collect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,16 @@ protected CollectFunction(string name, TexlStrings.StringGetter description)

public override IEnumerable<TexlStrings.StringGetter[]> GetSignatures()
{
// !!! TODO
//yield return new[] { CanvasStringResources.CollectArg1, CanvasStringResources.CollectArg2 };
//yield return new[] { CanvasStringResources.CollectArg1, CanvasStringResources.CollectArg2, CanvasStringResources.CollectArg2 };
//yield return new[] { CanvasStringResources.CollectArg1, CanvasStringResources.CollectArg2, CanvasStringResources.CollectArg2, CanvasStringResources.CollectArg2 };

yield return new[] { TexlStrings.CollectDataSourceArg, TexlStrings.CollectItemArg };
yield return new[] { TexlStrings.CollectArg1, TexlStrings.CollectArg2 };
yield return new[] { TexlStrings.CollectArg1, TexlStrings.CollectArg2, TexlStrings.CollectArg2 };
yield return new[] { TexlStrings.CollectArg1, TexlStrings.CollectArg2, TexlStrings.CollectArg2, TexlStrings.CollectArg2 };
}

public override IEnumerable<TexlStrings.StringGetter[]> GetSignatures(int arity)
{
if (arity > 2)
{
return GetGenericSignatures(arity, TexlStrings.CollectDataSourceArg, TexlStrings.CollectItemArg);
return GetGenericSignatures(arity, TexlStrings.CollectArg1, TexlStrings.CollectArg2);
}

return base.GetSignatures(arity);
Expand Down Expand Up @@ -190,12 +187,6 @@ private bool TryGetUnifiedCollectedTypeV1(TexlNode[] args, DType[] argTypes, IEr
{
DType argType = GetCollectedType(features, argTypes[i]);

// !!! How is it possible for an argtype to be a primitive and an aggregate at the same time?
//if (argType.DisplayNameProvider == null && argType.Kind == DKind.ObjNull)
//{
// argType.DisplayNameProvider = datasourceType.DisplayNameProvider;
//}

// The subsequent args should all be aggregates.
if (!argType.IsAggregate)
{
Expand Down Expand Up @@ -304,7 +295,6 @@ public override bool CheckTypes(CheckTypesContext context, TexlNode[] args, DTyp

public override void CheckSemantics(TexlBinding binding, TexlNode[] args, DType[] argTypes, IErrorContainer errors)
{
// !!! TODO
DType dataSourceType = argTypes[0];
bool isConnected = binding.EntityScope != null
&& binding.EntityScope.TryGetDataSource(args[0], out IExternalDataSource dataSourceInfo)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public CollectFunction()

public override IEnumerable<StringGetter[]> GetSignatures()
{
yield return new[] { TexlStrings.CollectDataSourceArg, TexlStrings.CollectRecordArg };
yield return new[] { TexlStrings.CollectArg1, TexlStrings.CollectArg2 };
}

public virtual DType GetCollectedType(DType argType)
Expand Down
22 changes: 14 additions & 8 deletions src/strings/PowerFxResources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3109,16 +3109,22 @@
<comment>Display text representing the Contrast value of TeamsTheme enum (TeamsTheme_Contrast_Name). The possible values for this enumeration are: Default, Dark, Contrast.</comment>
</data>
<data name="AboutCollect" xml:space="preserve">
<value>Adds records to a data source.</value>
<comment>Description of 'Clear' function.</comment>
<value>Adds one or more items to the specified 'collection'. The items can be from a different table or collection (e.g. Collect(collection, source_collection)), or one or more records Collect(collection, {key1: val1, key2: val2, ...}, ...).</value>
<comment>Description of 'Collect' function.</comment>
</data>
<data name="CollectDataSourceArg" xml:space="preserve">
<value>data_source</value>
<comment>function_parameter - First parameter for the Collect function. The data source that you want to add data to.</comment>
<data name="CollectArg1" xml:space="preserve">
<value>collection</value>
<comment>function_parameter - First parameter for the Collect function - the name of the collection that will be created / appended to.</comment>
</data>
<data name="CollectRecordArg" xml:space="preserve">
<value>record</value>
<comment>function_parameter - Second parameter for the Collect function. The record to be added.</comment>
<data name="CollectArg2" xml:space="preserve">
<value>item</value>
<comment>function_parameter - Second parameter for the Collect function - the item which will be added to the collection.</comment>
</data>
<data name="AboutCollect_collection" xml:space="preserve">
<value>A new or existing collection to augment.</value>
</data>
<data name="AboutCollect_item" xml:space="preserve">
<value>A record or table to collect. A record will be appended to the collection. A table will have its rows appended to the collection.</value>
</data>
<data name="AboutClear" xml:space="preserve">
<value>Deletes all the records of a collection. The columns of the collection will remain.</value>
Expand Down

0 comments on commit 90b12e2

Please sign in to comment.