Apparently you have to put the LOCTEXT_NAMESPACE macro inside the #if WITH_EDITOR…
#if WITH_EDITOR
#define LOCTEXT_NAMESPACE "UMG"
const FText UStyledButton::GetPaletteCategory()
{
return LOCTEXT("Custom", "Custom");
//return FInternationalization::ForUseOnlyByLocMacroAndGraphNodeTextLiterals_CreateText(TEXT("Custom"), TEXT("UMG"), TEXT("Custom"));
}
#undef LOCTEXT_NAMESPACE
#endif