NEED HELP: Getting Keys from String Tables in CPP.

I’m trying to get the string table key for the options, but it keeps returning Missing String Table Entry, even though I set everything right. Namespace (String Table Name) matches. Keys are matching…

`FName StringTableName = TEXT(“UI_MenuOptions_STR”);
FString EntryKey = TEXT(“UI_Option_Item_P1C1_Lang_en”);

FText Dummy = FText::FromStringTable(StringTableName, EntryKey);

FString DebugMessage = FString::Printf(TEXT(
“[CND_DEBUG: Menu List Item - Results]\n”
“CND_DEBUG: Menu List Item - String Table Name: %s\n”
“CND_DEBUG: Menu List Item - Debug Text = %s\n”
),

* StringTableName.ToString(),
* Dummy.ToString()

);

UE_LOG(LogTemp, Log, TEXT(“%s”), *DebugMessage);`

Why is this happening?

How you fill translation data? For check string table is present you can call FStringTableRegistry::Get().FindStringTable

Used this, but same happens. I made sure the string table name matches.

FStringTableConstPtr TablePtr = FStringTableRegistry::Get().FindStringTable(StringTableName);

if (TablePtr.IsValid())

{

FFStringTableConstPtr TableRef = Table PTR.ToSharedRef();

}

LogStringData: Warning: Failed to find string table entry for ‘UI_MenuOptions_STR‘ ‘UI_Option_Item_P1C1_Lang_en’. Did you forget to add a string table redirector?

LogTemp: Error: CND_DEBUG: String Table ‘UI_MenuOptions_STR’ not found or not loaded.

if you using localization dashboard your localization strings can have another internal names.

You can try register your strings manually by LOCTABLE_NEW and LOCTABLE_SETSTRING macro. Example usage from engine tests:

if (!FStringTableRegistry::Get().FindStringTable("Core.Tests.TextFormatTest"))
	{
		LOCTABLE_NEW("Core.Tests.TextFormatTest", "Core.Tests.TextFormatTest");
		LOCTABLE_SETSTRING("Core.Tests.TextFormatTest", "TextStringificationTest_Lorem", "Lorem");
	}

Also you can call functions

UKismetStringTableLibrary::GetRegisteredStringTables, UKismetStringTableLibrary::GetKeysFromStringTable

and print all localization data to log.

How is that supposed to help me?

FSoftObjectPath TablePath = StringTables.Table[Key_STR_MenuOptions];
FName StringTableName = TEXT(“UI_MenuOptions_STR”);

UStringTable* LoadedTable = Cast(TablePath.TryLoad());

if (!LoadedTable)
{
UE_LOG(LogTemp, Error, TEXT(“CND_DEBUG - String Table: Failed to load string table asset.”));
return;
}

TArray RegisteredTables = UKismetStringTableLibrary::GetRegisteredStringTables();

for (const FName& TableName : RegisteredTables)
{
UE_LOG(LogTemp, Log, TEXT(“CND_DEBUG - String Table: Registered String Table: %s”), *TableName.ToString());
}

LogTemp: CND_DEBUG - String Table: Registered String Table: /Game/Cnd_Base/GameData/STR/EN/Menu/UI_MenuOptions_STR.UI_MenuOptions_STR
LogStringTable: Warning: Failed to find string table entry for ‘UI_MenuOptions_STR’ ‘UI_Option_Item_P1C1_Lang_en’. Did you forget to add a string table redirector?
LogTemp: Error: CND_DEBUG: String Table - ‘UI_MenuOptions_STR’ not found or not loaded

You need register your string table before usage.

FStringTableRegistry::Get().RegisterStringTable(LoadedTable->GetStringTableId(), LoadedTable->GetMutableStringTable());