Class LocalizedStringDatabase
Handles loading strings and their tables for the selected locale.
Inherited Members
Namespace: UnityEngine.Localization
Syntax
public class LocalizedStringDatabase : LocalizedDatabase, IPreloadRequired
Fields
StringTableLabel
Declaration
public const string StringTableLabel = "StringTable"
Field Value
Type | Description |
---|---|
System.String |
Properties
NoTranslationFoundFormat
The message to display when a string can not be localized. The final string will be created using String.Format where format item 0 contains the original string.
Declaration
public string NoTranslationFoundFormat { get; set; }
Property Value
Type | Description |
---|---|
System.String |
PreloadOperation
Declaration
public AsyncOperationHandle PreloadOperation { get; }
Property Value
Type | Description |
---|---|
AsyncOperationHandle |
Implements
Methods
GetLocalizedString(String, String)
Declaration
public virtual AsyncOperationHandle<string> GetLocalizedString(string tableName, string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | tableName | |
System.String | key |
Returns
Type | Description |
---|---|
AsyncOperationHandle<System.String> |
GetLocalizedString(String, String, Int32)
Attempts to retrieve a plural string from the table. This function is asynchronous and may not have an immediate result. Check IsDone to see if the data is available, if it is false then use the Completed event or yield on the operation.
Declaration
public virtual AsyncOperationHandle<string> GetLocalizedString(string tableName, string key, int n)
Parameters
Type | Name | Description |
---|---|---|
System.String | tableName | Table to search for the original string. |
System.String | key | The string key taken from the KeyDatabase, that should be used to find the translated text. |
System.Int32 | n | Plural value |
Returns
Type | Description |
---|---|
AsyncOperationHandle<System.String> |
GetLocalizedString(String, UInt32)
Attempts to retrieve a string from a StringTable. This function is asynchronous and may not have an immediate result. Check IsDone to see if the data is available, if it is false then use the Completed event or yield on the operation.
Declaration
public virtual AsyncOperationHandle<string> GetLocalizedString(string tableName, uint keyId)
Parameters
Type | Name | Description |
---|---|---|
System.String | tableName | The name of the string table to look for the translated text in. |
System.UInt32 | keyId | The Id of the key, taken from the KeyDatabase, that should be used to find the translated text. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<System.String> |
GetLocalizedString(String, UInt32, Int32)
Attempts to retrieve a plural string from the table. This function is asynchronous and may not have an immediate result. Check IsDone to see if the data is available, if it is false then use the Completed event or yield on the operation.
Declaration
public virtual AsyncOperationHandle<string> GetLocalizedString(string tableName, uint keyId, int n)
Parameters
Type | Name | Description |
---|---|---|
System.String | tableName | Table to search for the original string. |
System.UInt32 | keyId | The Id of the key, taken from the KeyDatabase, that should be used to find the translated text. |
System.Int32 | n | Plural value |
Returns
Type | Description |
---|---|
AsyncOperationHandle<System.String> |
GetLocalizedString(UInt32)
Attempts to retrieve a string from the default StringTable. This function is asynchronous and may not have an immediate result. Check IsDone to see if the data is available, if it is false then use the Completed event or yield on the operation.
Declaration
public virtual AsyncOperationHandle<string> GetLocalizedString(uint keyId)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | keyId | The Id of the key, taken from the KeyDatabase, that should be used to find the translated text. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<System.String> |
GetLocalizedString(UInt32, Int32)
Attempts to retrieve a plural string from the default StringTable. This function is asynchronous and may not have an immediate result. Check IsDone to see if the data is available, if it is false then use the Completed event or yield on the operation.
Declaration
public virtual AsyncOperationHandle<string> GetLocalizedString(uint keyId, int n)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | keyId | The Id of the key, taken from the KeyDatabase, that should be used to find the translated text. |
System.Int32 | n | Plural value |
Returns
Type | Description |
---|---|
AsyncOperationHandle<System.String> |
GetTable(String)
Returns the named table. This function is asynchronous and may not have an immediate result. Check IsDone to see if the data is available, if it is false then use the Completed event or yield on the operation.
Declaration
public virtual AsyncOperationHandle<StringTableBase> GetTable(string tableName)
Parameters
Type | Name | Description |
---|---|---|
System.String | tableName |
Returns
Type | Description |
---|---|
AsyncOperationHandle<StringTableBase> |
OnLocaleChanged(Locale)
Called before the LocaleChanged event is sent out in order to give the database a chance to prepare.
Declaration
public override void OnLocaleChanged(Locale locale)
Parameters
Type | Name | Description |
---|---|---|
Locale | locale |
Overrides
ProcessUntranslatedText(String)
Declaration
protected virtual string ProcessUntranslatedText(string original)
Parameters
Type | Name | Description |
---|---|---|
System.String | original |
Returns
Type | Description |
---|---|
System.String |