How do I get the localized text from enumerations? Currently, I have the following:
.h
UENUM(BlueprintType)
enum class ControllerSetup : uint8
{
Conventional UMETA(DisplayName = "Conventional"),
Southpaw UMETA(DisplayName = "Southpaw")
};
.cpp
FText UMyGameInstance::GetControllerSetupText(ControllerSetup controllerSetup)
{
const UEnum* EnumPtr = FindObject<UEnum>(ANY_PACKAGE, TEXT("ControllerSetup"), true);
if (!EnumPtr)
return FText::GetEmpty();
return EnumPtr->GetEnumText((int32)controllerSetup);
//return EnumPtr->GetDisplayNameText((int32)controllerSetup);
}
I see the enumeration in the localization files, and it is translated. However, I can’t get the proper text for the selected locale.
Thank you.