c# - System.Collections.Generic.List`1[System.String] instead of data - Stack Overflow got same result while trying to fill smart string with multiple values (tried strings and enum values).
String:
Excellent. We are moving, but too slow. This is good for maneuvers, but to get anywhere faster, you need to accelerate. Press {0} to increase speed. You can also decrease speed with {0} and switch speeds with the mouse
Code to display text:
where keycodes is List of KeyCode objects. But with list of string I got same result. With smart library list formatting Create new page · axuno/SmartFormat Wiki · GitHub all works fine, but what can I do if I want to insert array elements into different parts of string?
The walkaround is to pass array elements individual, but not whole array as argument:
Text: Excellent. We are moving, but too slow. This is good for maneuvers, but to get anywhere faster, you need to accelerate. Pressing will increase {0}, {1} will decrease the speed. You can also switch speeds with the mouse
Maybe, this is not related to localization, but for Smart library itself. Maybe, I just using it wrongly, and there are proper way for use array elements in multiple places on the string exists
Oh I see. You want the individual elements from the array. Doing {0} etc will treat it like a normal String.Format argument.
I’ll have a closer look on Monday to see if it’s possible. You can always create a custom source if it’s not.
Edit: I just noticed you are using Smart. How are you fetching the strings? Have you tried passing the arguments in when you get the values instead of directly using Smart?
LocalizationSettings.StringDatabase.GetLocalizedStringAsync("General Test Data", "Test", new object[] { KeyCode.A, KeyCode.LeftShift });