Then by simply using the LocalizedString variable as the value of the dictionary does not work, it seems to use the .ToString() of LocalizedString instead. Looks like this : “TableReference(f3c84191-d489-64d4-5b53-f8d09cdff06d - Item)/TableEntryReference(3405916397627 - MyItem/Name)”
amountTextLocalizeStringEvent.StringReference.Arguments = new object[]
{
new Dictionary<string, object>
{
["variable"] = itemNames,
}
};
I get that I could itemNames.GetLocalizedStringAsync() and then simply put in the resulting string instead of nesting, but it need some async routine to prepare instead of letting localization package resolve the async chain for me if I could nest it.
public LocalizedString withNestedTranslation = new LocalizedString("My String Table", "My Game Text")
{
{ "some-text", new StringVariable { Value = "Hello World" } },
{ "nested", new LocalizedString("My String Table", "My Nested Text")
{
{ "score", new IntVariable { Value = 100 } },
}}
};
It seems like the 2 approach (.Arguments or .Add) are slightly different and .Add has IVariable interface that make it understand nested LocalizedString. At first I was avoiding using .Add in script because it says it would be persistent instead of not serialized like .Arguments and I would not want script to make persistent change.
Oh yes. Arguments are more like the String.Format arguments. If you want to use names then they need to go in the persistent variables. Arguments can only be accessed using the index of the position they are at.