A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
DlgLocalizationHelper.h
Go to the documentation of this file.
1// Copyright Csaba Molnar, Daniel Butum. All Rights Reserved.
2#pragma once
3
4#include "CoreMinimal.h"
5
6#if WITH_EDITOR && USE_STABLE_LOCALIZATION_KEYS
7#include "STextPropertyEditableTextBox.h"
8#endif// WITH_EDITOR && USE_STABLE_LOCALIZATION_KEYS
9
11
15class DLGSYSTEM_API FDlgLocalizationHelper
16{
18public:
19 static void UpdateTextFromRemapping(const UDlgSystemSettings& Settings, FText& OutText);
20
21#if WITH_EDITOR
22 // Updates the text namespace to match the settings options
23 // NOTE: only works in editor mode
24 static void UpdateTextNamespaceAndKey(const UObject* Object, const UDlgSystemSettings& Settings, FText& Text);
25#else
26 // NO OP
27 static void UpdateTextNamespaceAndKey(const UObject* Object, const UDlgSystemSettings& Settings, FText& Text) {}
28#endif
29
30 // Will we update the text namespace for the following texts
31 static bool WillTextNamespaceBeUpdated(const FText& Text);
32 static bool WillTextNamespaceBeUpdated(const FText& Text, const UDlgSystemSettings& Settings);
33
34#if WITH_EDITOR && USE_STABLE_LOCALIZATION_KEYS
35 // Copied From IEditableTextProperty
36
38 static void StaticStableTextId(const UObject* InObject, IEditableTextProperty::ETextPropertyEditAction InEditAction, const FString& InTextSource, const FString& InProposedNamespace, const FString& InProposedKey, FString& OutStableNamespace, FString& OutStableKey);
39
41 static void StaticStableTextId(const UPackage* InPackage, IEditableTextProperty::ETextPropertyEditAction InEditAction, const FString& InTextSource, const FString& InProposedNamespace, const FString& InProposedKey, FString& OutStableNamespace, FString& OutStableKey);
42
43protected:
44 // Returns true if we should do an update of the FText
45 // false otherwise
46 static bool GetNewNamespaceAndKey(
47 const UObject* Object,
48 const UDlgSystemSettings& Settings,
49 const FText& Text,
50 FString& OutNewNamespace,
51 FString& OutNewKey
52 );
53
54#endif // WITH_EDITOR && USE_STABLE_LOCALIZATION_KEYS
55
56};
FDlgLocalizationHelper Self
static void UpdateTextNamespaceAndKey(const UObject *Object, const UDlgSystemSettings &Settings, FText &Text)
UCLASS(Config = Engine, DefaultConfig, meta = (DisplayName = "Dialogue System Settings"))