We have a plugin for UE where the user can send source and gather translations from our system, but a new requirement is that the users want to update the source outside of UE.
I wrote this code:
void FGridlyLocalizationServiceProvider::UpdateStringTable()
{
// Access the string table using FStringTableConstPtr
FName TableID = FName(TEXT("/Game/strings/source_strings.source_strings"));
FStringTableConstPtr StringTable = FStringTableRegistry::Get().FindStringTable(TableID);
if (StringTable.IsValid())
{
FString Key = TEXT("on");
FString NewSourceString = TEXT("Updated String Value");
// Find the entry in the string table using FindEntry
FStringTableEntryConstPtr Entry = StringTable->FindEntry(Key);
if (Entry.IsValid())
{
// Retrieve the source string from the entry
const FString& UpdatedValue = Entry->GetSourceString();
UE_LOG(LogTemp, Log, TEXT("Updated string: %s"), *UpdatedValue);
}
else
{
UE_LOG(LogTemp, Warning, TEXT("Entry with key %s not found"), *Key);
}
}
else
{
UE_LOG(LogTemp, Warning, TEXT("Could not find string table"));
}
}```
But it always says that it can't find the string table.
What am I doing wrong, even if this possible to update the source programatically?