class StringTable

Inherits: Resource

Used for string localization.

Stores strings and their translations in various languages.

Public

Constructors

StringTable

StringTable()

Methods

Contains

bool Contains(const String &identifier)

Checks does the string table contain the provided identifier.

identifier
Identifier to look for.

Returns: True if the identifier exists in the table, false otherwise.

GetNumStrings

u32 GetNumStrings() const

Returns a total number of strings in the table.

GetIdentifiers

Vector<String> GetIdentifiers() const

Returns all identifiers that the string table contains localized strings for.

SetString

void SetString(const String &identifier, Language language, const String &value)

Adds or modifies string translation for the specified language.

GetString

String GetString(const String &identifier, Language language)

Returns a string translation for the specified language.

Returns the identifier itself if one doesn't exist.

RemoveString

void RemoveString(const String &identifier)

Removes the string described by identifier, from all languages.

GetStringData

SPtr<LocalizedStringData> GetStringData(const String &identifier, bool insertIfNonExisting = true)

Gets a string data for the specified string identifier and currently active language.

identifier
Unique string identifier.
insertIfNonExisting
If true, a new string data for the specified identifier and language will be added to the table if data doesn't already exist. The data will use the identifier as the translation string.

Returns: The string data. Don't store reference to this data as it may get deleted.

GetStringData

SPtr<LocalizedStringData> GetStringData(const String &identifier, Language language, bool insertIfNonExisting = true)

Gets a string data for the specified string identifier and language.

identifier
Unique string identifier.
language
Language.
insertIfNonExisting
If true, a new string data for the specified identifier and language will be added to the table if data doesn't already exist. The data will use the identifier as the translation string.

Returns: The string data. Don't store reference to this data as it may get deleted.

staticCreate

static HStringTable Create()

Creates a new empty string table resource.

staticGetRttiStatic

static RTTIType *GetRttiStatic()

GetRtti

RTTIType *GetRtti() const override

Returns an interface you can use to access class' Run Time Type Information.

Internal

Methods

staticCreateShared

static SPtr<StringTable> CreateShared()

Creates a new empty string table resource.

Private

Methods

GetActiveLanguage

Language GetActiveLanguage() const

Gets the currently active language.

SetActiveLanguage

void SetActiveLanguage(Language language)

Changes the currently active language.

Any newly created strings will use this value.

Fields

mActiveLanguage

Language mActiveLanguage

mActiveLanguageData

LanguageData * mActiveLanguageData

mDefaultLanguageData

LanguageData * mDefaultLanguageData

mAllLanguages

TArray<LanguageData> mAllLanguages

mIdentifiers

UnorderedSet<String> mIdentifiers