Long story short, I’m growing tired of how verbose LOCTEXT is. I want to make a macro that doesn’t take a key, only the string to be translated plus the wrapping namespace, so that my code looks like:
.Text(TR("This is a translated string"))
Instead of
.Text(LOCTEXT("IsTranslatedString", "This is a translated string"))
Problems:
- This isn’t detected by Gather Text in the Localization Dashboard.
- I tried a macro such as
#define TR(Value) LOCTEXT(Value, Value)
, but translation doesn’t expand macros. This would just use the string as the key as well. - I found no docs for how to make a custom gather script. The AI went off the rails.
- I read that FText::FromString(“This is a translated string”) would get gathered, but it doesn’t seem to happen.
Rather than getting stuck on my particular idea for a solution, the underlying goal is just that I want to provide only a namespace for the file and then the literal English-language string. I don’t want to make keys anymore. They end up unmaintained, or duplicated during copy/paste.
I’m happy to just let the key be the same as the string itself.
Thanks!