#define LOCTEXT_NAMESPACE "Something"

My question may seem a bit nooby, but I was wondering what is the purpose of the following line?

#define LOCTEXT_NAMESPACE "AssetTypeActions"

I’ve been following some C++ tutorials and I’ve seen this a lot of time. Espacially here. I don’t see it being used in the code so I tried to remove this line in my asset action but it breaks everything. Do you know its prupose? Should I be putting something special inside it?

1 Like

Oh i see! Thanks for the clarification. By the way, is your video meant to teach how to modify the engine?

It part of localization system used in FText type and LOCTEXT, in UE4 localization strings are namespaced (to avoid name collisions with the rest of engine code) and to avoid typing it all the time over and over again in NSLOCTEXT you define LOCTEXT_NAMESPACE and use LOCTEXT instead without need of typing in namespace. Not that log ago i explained how localization and FText works on one of my tutorial streams:


No, it my C++ from core series where i explain core things in more detail, as localization is big part of FText i explained localization too.

Note that when you make C++ project only creating extra code module that will be added to engine, so effectively you extending the engine code. Code in C++ project, plugins and engine code works exactly the same and you can do exactly same things and you bound to exact same rules, it’s only different way of distributing and enabling code modules (i explain that in those series too). So you could say that those series help modifying the engine too.

Okay, thanks again for the reply :wink: have a nice day!