MCPcopy Create free account
hub / github.com/NotYetGames/DlgSystem / GetTextFromObject

Function GetTextFromObject

Source/DlgSystem/Private/IO/DlgJsonParser.cpp:26–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24DEFINE_LOG_CATEGORY(LogDlgJsonParser);
25
26bool GetTextFromObject(const TSharedRef<FJsonObject>& Obj, FText& TextOut)
27{
28 // get the prioritized culture name list
29 const FCultureRef CurrentCulture = FInternationalization::Get().GetCurrentCulture();
30 const TArray<FString> CultureList = CurrentCulture->GetPrioritizedParentCultureNames();
31
32 // try to follow the fall back chain that the engine uses
33 FString TextString;
34 for (const FString& CultureCode : CultureList)
35 {
36 if (Obj->TryGetStringField(CultureCode, TextString))
37 {
38 TextOut = FText::FromString(TextString);
39 return true;
40 }
41 }
42
43 // no luck, is this possibly an unrelated json object?
44 return false;
45}
46
47FString GetStringForJsonType(const EJson Type)
48{

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected