Yeah, that’s mostly what I was talking about. I may not have thought it all the way through. But that just gets the text from the localization data, it’s not going to cause it to be included in the loc data so that the strings are actually localized.
I’d have an actual TMap in data somewhere that’s something like FName => FText that this function uses to look it up. That way the FText’s will be found by the localization process and end up in the .po file.
The way localization works (apologies if you already know this) is that there’s a process that goes digging through assets for FText and goes digging through code for the NSLOCTEXT and LOCTEXT macros to generate the table of namespaces/keys/english text. So if you try to do something outside that paradigm (like trying to call this localize utility) it may not work the way you expect. When Localize is used in blueprint that might be hooked into this process too, or it’s ignored and it’s assumed it’s referenced someplace else. Localization needs to know compile time values which is why the macros only work on literal, so that the tools works to pull all the data back out.