Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
FTextLocalizationManager Class Reference

#include <TextLocalizationManager.h>

+ Collaboration diagram for FTextLocalizationManager:

Classes

struct  FDisplayStringEntry
 

Public Member Functions

void DumpMemoryInfo () const
 
void CompactDataStructures ()
 
FString GetRequestedLanguageName () const
 
FString GetRequestedLocaleName () const
 
FString GetNativeCultureName (const ELocalizedTextSourceCategory InCategory) const
 
TArray< FStringGetLocalizedCultureNames (const ELocalizationLoadFlags InLoadFlags) const
 
void RegisterTextSource (const TSharedRef< ILocalizedTextSource > &InLocalizedTextSource, const bool InRefreshResources=true)
 
void RegisterPolyglotTextData (const FPolyglotTextData &InPolyglotTextData, const bool InAddDisplayString=true)
 
void RegisterPolyglotTextData (TArrayView< const FPolyglotTextData > InPolyglotTextDataArray, const bool InAddDisplayStrings=true)
 
FTextConstDisplayStringPtr FindDisplayString (const FTextKey &Namespace, const FTextKey &Key, const FString *const SourceString=nullptr) const
 
FTextConstDisplayStringRef GetDisplayString (const FTextKey &Namespace, const FTextKey &Key, const FString *const SourceString)
 
bool FindNamespaceAndKeyFromDisplayString (const FTextConstDisplayStringPtr &InDisplayString, FString &OutNamespace, FString &OutKey) const
 
bool FindNamespaceAndKeyFromDisplayString (const FTextConstDisplayStringPtr &InDisplayString, FTextKey &OutNamespace, FTextKey &OutKey) const
 
bool AddDisplayString (const FTextDisplayStringRef &DisplayString, const FTextKey &Namespace, const FTextKey &Key)
 
void UpdateFromLocalizationResource (const FString &LocalizationResourceFilePath)
 
void UpdateFromLocalizationResource (const FTextLocalizationResource &TextLocalizationResource)
 
void RefreshResources ()
 
uint16 GetTextRevision () const
 
uint16 GetLocalRevisionForTextId (const FTextId &InTextId) const
 
void GetTextRevisions (const FTextId &InTextId, uint16 &OutGlobalTextRevision, uint16 &OutLocalTextRevision) const
 

Static Public Member Functions

static FTextLocalizationManagerGet ()
 
static void TearDown ()
 

Public Attributes

FTextRevisionChangedEvent OnTextRevisionChangedEvent
 

Private Types

typedef TMap< FTextId, FDisplayStringEntryFDisplayStringLookupTable
 

Private Member Functions

bool IsInitialized () const
 
bool IsInitializing () const
 
 FTextLocalizationManager ()
 
void OnPakFileMounted (const IPakFile &PakFile)
 
void OnCultureChanged ()
 
void LoadLocalizationResourcesForCulture (const FString &CultureName, const ELocalizationLoadFlags LocLoadFlags)
 
void LoadLocalizationResourcesForPrioritizedCultures (TArrayView< const FString > PrioritizedCultureNames, const ELocalizationLoadFlags LocLoadFlags)
 
void UpdateFromNative (FTextLocalizationResource &&TextLocalizationResource, const bool bDirtyTextRevision=true)
 
void UpdateFromLocalizations (FTextLocalizationResource &&TextLocalizationResource, const bool bDirtyTextRevision=true)
 
void DirtyLocalRevisionForTextId (const FTextId &InTextId)
 
void DirtyTextRevision ()
 

Private Attributes

std::atomic< ETextLocalizationManagerInitializedFlagsInitializedFlags { ETextLocalizationManagerInitializedFlags::None }
 
FCriticalSection DisplayStringLookupTableCS
 
FDisplayStringLookupTable DisplayStringLookupTable
 
FRWLock TextRevisionRW
 
TMap< FTextId, uint16LocalTextRevisions
 
uint16 TextRevisionCounter
 
TArray< TSharedPtr< ILocalizedTextSource > > LocalizedTextSources
 
TSharedPtr< class FLocalizationResourceTextSourceLocResTextSource
 
TSharedPtr< class FPolyglotTextSourcePolyglotTextSource
 

Friends

class FLazySingleton
 
void BeginPreInitTextLocalization ()
 
void BeginInitTextLocalization ()
 
void InitEngineTextLocalization ()
 
void BeginInitGameTextLocalization ()
 
void EndInitGameTextLocalization ()
 
void InitGameTextLocalization ()
 

Detailed Description

Singleton class that manages display strings for FText.

Definition at line 39 of file TextLocalizationManager.h.

Member Typedef Documentation

◆ FDisplayStringLookupTable

Manages the currently loaded or registered text localizations.

Definition at line 81 of file TextLocalizationManager.h.

Constructor & Destructor Documentation

◆ FTextLocalizationManager()

FTextLocalizationManager::FTextLocalizationManager ( )
private

Member Function Documentation

◆ AddDisplayString()

bool FTextLocalizationManager::AddDisplayString ( const FTextDisplayStringRef & DisplayString,
const FTextKey & Namespace,
const FTextKey & Key )

Attempts to register the specified display string, associating it with the specified namespace and key. Returns true if the display string has been or was already associated with the namespace and key. Returns false if the display string was already associated with another namespace and key or the namespace and key are already in use by another display string.

◆ CompactDataStructures()

void FTextLocalizationManager::CompactDataStructures ( )

◆ DirtyLocalRevisionForTextId()

void FTextLocalizationManager::DirtyLocalRevisionForTextId ( const FTextId & InTextId)
private

Dirties the local revision counter for the given text ID by incrementing it (or adding it)

◆ DirtyTextRevision()

void FTextLocalizationManager::DirtyTextRevision ( )
private

Dirties the text revision counter by incrementing it, causing a revision mismatch for any information cached before this happens.

◆ DumpMemoryInfo()

void FTextLocalizationManager::DumpMemoryInfo ( ) const

◆ FindDisplayString()

FTextConstDisplayStringPtr FTextLocalizationManager::FindDisplayString ( const FTextKey & Namespace,
const FTextKey & Key,
const FString *const SourceString = nullptr ) const

Finds and returns the display string with the given namespace and key, if it exists. Additionally, if a source string is specified and the found localized display string was not localized from that source string, null will be returned.

◆ FindNamespaceAndKeyFromDisplayString() [1/2]

bool FTextLocalizationManager::FindNamespaceAndKeyFromDisplayString ( const FTextConstDisplayStringPtr & InDisplayString,
FString & OutNamespace,
FString & OutKey ) const
inline

Definition at line 171 of file TextLocalizationManager.h.

◆ FindNamespaceAndKeyFromDisplayString() [2/2]

bool FTextLocalizationManager::FindNamespaceAndKeyFromDisplayString ( const FTextConstDisplayStringPtr & InDisplayString,
FTextKey & OutNamespace,
FTextKey & OutKey ) const
inline

Definition at line 174 of file TextLocalizationManager.h.

◆ Get()

static FTextLocalizationManager & FTextLocalizationManager::Get ( )
static

Singleton accessor

◆ GetDisplayString()

FTextConstDisplayStringRef FTextLocalizationManager::GetDisplayString ( const FTextKey & Namespace,
const FTextKey & Key,
const FString *const SourceString )

Returns a display string with the given namespace and key. If no display string exists, it will be created using the source string or an empty string if no source string is provided. If a display string exists ... ... but it was not localized from the specified source string, the display string will be set to the specified source and returned. ... and it was localized from the specified source string (or none was provided), the display string will be returned.

◆ GetLocalizedCultureNames()

TArray< FString > FTextLocalizationManager::GetLocalizedCultureNames ( const ELocalizationLoadFlags InLoadFlags) const

Get a list of culture names that we have localized resource data for (ELocalizationLoadFlags controls which resources should be checked).

◆ GetLocalRevisionForTextId()

uint16 FTextLocalizationManager::GetLocalRevisionForTextId ( const FTextId & InTextId) const

Attempts to find a local revision history for the given text ID. This will only be set if the display string has been changed since the localization manager version has been changed (eg, if it has been edited while keeping the same key).

Returns
The local revision, or 0 if there have been no changes since a global history change.

◆ GetNativeCultureName()

FString FTextLocalizationManager::GetNativeCultureName ( const ELocalizedTextSourceCategory InCategory) const

Given a localization category, get the native culture for the category (if known).

Returns
The native culture for the given localization category, or an empty string if the native culture is unknown.

◆ GetRequestedLanguageName()

FString FTextLocalizationManager::GetRequestedLanguageName ( ) const

Get the language that will be requested during localization initialization, based on the hierarchy of: command line -> configs -> OS default.

◆ GetRequestedLocaleName()

FString FTextLocalizationManager::GetRequestedLocaleName ( ) const

Get the locale that will be requested during localization initialization, based on the hierarchy of: command line -> configs -> OS default.

◆ GetTextRevision()

uint16 FTextLocalizationManager::GetTextRevision ( ) const

Returns the current text revision number. This value can be cached when caching information from the text localization manager. If the revision does not match, cached information may be invalid and should be recached.

◆ GetTextRevisions()

void FTextLocalizationManager::GetTextRevisions ( const FTextId & InTextId,
uint16 & OutGlobalTextRevision,
uint16 & OutLocalTextRevision ) const

Get both the global and local revision for the given text ID.

See also
GetTextRevision and GetLocalRevisionForTextId.

◆ IsInitialized()

bool FTextLocalizationManager::IsInitialized ( ) const
inlineprivate

Definition at line 86 of file TextLocalizationManager.h.

◆ IsInitializing()

bool FTextLocalizationManager::IsInitializing ( ) const
inlineprivate

Definition at line 91 of file TextLocalizationManager.h.

◆ LoadLocalizationResourcesForCulture()

void FTextLocalizationManager::LoadLocalizationResourcesForCulture ( const FString & CultureName,
const ELocalizationLoadFlags LocLoadFlags )
private

Loads localization resources for the specified culture, optionally loading localization resources that are editor-specific or game-specific.

◆ LoadLocalizationResourcesForPrioritizedCultures()

void FTextLocalizationManager::LoadLocalizationResourcesForPrioritizedCultures ( TArrayView< const FString > PrioritizedCultureNames,
const ELocalizationLoadFlags LocLoadFlags )
private

Loads localization resources for the specified prioritized cultures, optionally loading localization resources that are editor-specific or game-specific.

◆ OnCultureChanged()

void FTextLocalizationManager::OnCultureChanged ( )
private

Callback for changes in culture. Loads the new culture's localization resources.

◆ OnPakFileMounted()

void FTextLocalizationManager::OnPakFileMounted ( const IPakFile & PakFile)
private

Callback for when a PAK file is loaded. Loads any chunk specific localization resources.

◆ RefreshResources()

void FTextLocalizationManager::RefreshResources ( )

Reloads resources for the current culture.

◆ RegisterPolyglotTextData() [1/2]

void FTextLocalizationManager::RegisterPolyglotTextData ( const FPolyglotTextData & InPolyglotTextData,
const bool InAddDisplayString = true )

Register a polyglot text data with the text localization manager.

◆ RegisterPolyglotTextData() [2/2]

void FTextLocalizationManager::RegisterPolyglotTextData ( TArrayView< const FPolyglotTextData > InPolyglotTextDataArray,
const bool InAddDisplayStrings = true )

◆ RegisterTextSource()

void FTextLocalizationManager::RegisterTextSource ( const TSharedRef< ILocalizedTextSource > & InLocalizedTextSource,
const bool InRefreshResources = true )

Register a localized text source with the text localization manager.

◆ TearDown()

static void FTextLocalizationManager::TearDown ( )
static

◆ UpdateFromLocalizationResource() [1/2]

void FTextLocalizationManager::UpdateFromLocalizationResource ( const FString & LocalizationResourceFilePath)

Updates display string entries and adds new display string entries based on localizations found in a specified localization resource.

◆ UpdateFromLocalizationResource() [2/2]

void FTextLocalizationManager::UpdateFromLocalizationResource ( const FTextLocalizationResource & TextLocalizationResource)

◆ UpdateFromLocalizations()

void FTextLocalizationManager::UpdateFromLocalizations ( FTextLocalizationResource && TextLocalizationResource,
const bool bDirtyTextRevision = true )
private

Updates display string entries and adds new display string entries based on provided localizations.

◆ UpdateFromNative()

void FTextLocalizationManager::UpdateFromNative ( FTextLocalizationResource && TextLocalizationResource,
const bool bDirtyTextRevision = true )
private

Updates display string entries and adds new display string entries based on provided native text.

Friends And Related Symbol Documentation

◆ BeginInitGameTextLocalization

void BeginInitGameTextLocalization ( )
friend

◆ BeginInitTextLocalization

void BeginInitTextLocalization ( )
friend

◆ BeginPreInitTextLocalization

void BeginPreInitTextLocalization ( )
friend

◆ EndInitGameTextLocalization

void EndInitGameTextLocalization ( )
friend

◆ FLazySingleton

Definition at line 110 of file TextLocalizationManager.h.

◆ InitEngineTextLocalization

void InitEngineTextLocalization ( )
friend

◆ InitGameTextLocalization

void InitGameTextLocalization ( )
friend

Member Data Documentation

◆ DisplayStringLookupTable

FDisplayStringLookupTable FTextLocalizationManager::DisplayStringLookupTable
private

Definition at line 97 of file TextLocalizationManager.h.

◆ DisplayStringLookupTableCS

FCriticalSection FTextLocalizationManager::DisplayStringLookupTableCS
mutableprivate

Definition at line 96 of file TextLocalizationManager.h.

◆ InitializedFlags

std::atomic<ETextLocalizationManagerInitializedFlags> FTextLocalizationManager::InitializedFlags { ETextLocalizationManagerInitializedFlags::None }
private

Definition at line 84 of file TextLocalizationManager.h.

◆ LocalizedTextSources

TArray<TSharedPtr<ILocalizedTextSource> > FTextLocalizationManager::LocalizedTextSources
private

Array of registered localized text sources, sorted by priority (

See also
RegisterTextSource)

Definition at line 304 of file TextLocalizationManager.h.

◆ LocalTextRevisions

TMap<FTextId, uint16> FTextLocalizationManager::LocalTextRevisions
private

Definition at line 100 of file TextLocalizationManager.h.

◆ LocResTextSource

TSharedPtr<class FLocalizationResourceTextSource> FTextLocalizationManager::LocResTextSource
private

The LocRes text source (this is also added to LocalizedTextSources, but we keep a pointer to it directly so we can patch in chunked LocRes data at runtime)

Definition at line 307 of file TextLocalizationManager.h.

◆ OnTextRevisionChangedEvent

FTextRevisionChangedEvent FTextLocalizationManager::OnTextRevisionChangedEvent

Event type for immediately reacting to changes in display strings for text.

Definition at line 269 of file TextLocalizationManager.h.

◆ PolyglotTextSource

TSharedPtr<class FPolyglotTextSource> FTextLocalizationManager::PolyglotTextSource
private

The polyglot text source (this is also added to LocalizedTextSources, but we keep a pointer to it directly so we can add new polyglot data to it at runtime)

Definition at line 310 of file TextLocalizationManager.h.

◆ TextRevisionCounter

uint16 FTextLocalizationManager::TextRevisionCounter
private

Definition at line 101 of file TextLocalizationManager.h.

◆ TextRevisionRW

FRWLock FTextLocalizationManager::TextRevisionRW
mutableprivate

Definition at line 99 of file TextLocalizationManager.h.


The documentation for this class was generated from the following file: