How to use smart localization?

Hi there
I have simple player inventory model with list of items, like List<InventoryItem> _items;
And I have UI Text (TMP) with Localize String Event & assigned string reference on it (text like “Items: {items}”)
When player pressing button (for example Tab) the Text show up, so my question is: how to pass param {items} to this text which means _items.Count considering that the number of items in the inventory may change?

I’ve tried to use

text.Arguments = new object[]
{
    _items.Count
};
text.RefreshString();

and

text.Add("items", new IntVariable { Value = _items.Count });

but getting error FormattingException: Error parsing format string: Could not evaluate the selector "items" at 11


@karljj1 I saw you are providing answers about localization, could you provide one for my question please?

Smart format wont know what “items” is here. It will only have an integer at index 0.
So you would acces the value with items: {0}

If you want to access it with “items” you would need to pass something in that has a field called “items”.
For example:

text.Arguments = new object[]
{
    _items.Count
};

However this would need items: {_items}

You could also use an anonymous type to set the name:

text.Arguments = new object[]
{
    new { items = _items.Count }
};

I realized my mistake
I’ve tried to set items argument value for LocalizedString.Arguments, but it was needed for LocalizeStringEvent.StringReference.Arguments