How to update source string in string table programatically

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?

I don’t have the editor in front of me at the moment to check but this smells of an asset registry issue. Have you added the string table/path to your asset manager?

Here’s an old post on the subject. It’s not exactly your problem as it’s in BP but it might give you some leads.

String Tables not loaded at start - Programming & Scripting / Blueprint - Epic Developer Community Forums (unrealengine.com)

Hey, thank you!
I already read that topic, but I don’t run the game, this is a plugin that we use to do the localization, so even if I add a blueprint it won’t apply, because the game is not running when I work in the localization dashboard.