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 IAsyncOperation PreloadOperation { get; }
Property Value
Type | Description |
---|---|
IAsyncOperation |
Implements
Methods
GetLocalizedString(String)
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 IAsyncOperation<string> GetLocalizedString(string original)
Parameters
Type | Name | Description |
---|---|---|
System.String | original | The original text or key that should be used to find the translated text. |
Returns
Type | Description |
---|---|
IAsyncOperation<System.String> |
GetLocalizedString(String, 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 IAsyncOperation<string> GetLocalizedString(string original, int n)
Parameters
Type | Name | Description |
---|---|---|
System.String | original | Original string or key to find the localized string. |
System.Int32 | n | Plural value |
Returns
Type | Description |
---|---|
IAsyncOperation<System.String> |
GetLocalizedString(String, String)
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 IAsyncOperation<string> GetLocalizedString(string tableName, string original)
Parameters
Type | Name | Description |
---|---|---|
System.String | tableName | The name of the string table to look for the translated text in. |
System.String | original | The original text or key that should be used to find the translated text. |
Returns
Type | Description |
---|---|
IAsyncOperation<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 IAsyncOperation<string> GetLocalizedString(string tableName, string original, int n)
Parameters
Type | Name | Description |
---|---|---|
System.String | tableName | Table to search for the original string. |
System.String | original | Original string or key to find the localized string. |
System.Int32 | n | Plural value |
Returns
Type | Description |
---|---|
IAsyncOperation<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 IAsyncOperation<StringTableBase> GetTable(string tableName)
Parameters
Type | Name | Description |
---|---|---|
System.String | tableName |
Returns
Type | Description |
---|---|
IAsyncOperation<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 |