Class LocalizedStringDatabase
Handles loading strings and their tables for the selected locale.
Inherited Members
Namespace: UnityEngine.Localization.Settings
Syntax
[Serializable]
public class LocalizedStringDatabase : LocalizedDatabase<StringTable, StringTableEntry>, IPreloadRequired, IReset
Properties
MissingTranslationState
Controls how Unity will handle missing translation values.
Declaration
public MissingTranslationBehavior MissingTranslationState { get; set; }
Property Value
Type | Description |
---|---|
MissingTranslationBehavior |
NoTranslationFoundMessage
The message to display when a string can not be localized. This is a Smart String which has access to the following named placeholders:
Placeholder | Description |
---|---|
{key} | The name of the key. |
{keyId} | The numeric Id of the key. |
{table} | The table object, this can be further queried, for example {table.TableCollectionName}. |
{locale} | The locale asset, this can be further queried, for example {locale.name}. |
Declaration
public string NoTranslationFoundMessage { get; set; }
Property Value
Type | Description |
---|---|
String |
SmartFormatter
The SmartFormatter that will be used for all smart string operations.
Declaration
public SmartFormatter SmartFormatter { get; set; }
Property Value
Type | Description |
---|---|
SmartFormatter |
Methods
GenerateLocalizedString(StringTable, StringTableEntry, TableReference, TableEntryReference, Locale, IList<Object>)
Declaration
protected virtual string GenerateLocalizedString(StringTable table, StringTableEntry entry, TableReference tableReference, TableEntryReference tableEntryReference, Locale locale, IList<object> arguments)
Parameters
Type | Name | Description |
---|---|---|
StringTable | table | |
StringTableEntry | entry | |
TableReference | tableReference | |
TableEntryReference | tableEntryReference | |
Locale | locale | |
IList<Object> | arguments |
Returns
Type | Description |
---|---|
String |
GetLocalizedString(TableEntryReference, IList<Object>, Locale, FallbackBehavior)
Attempts to retrieve a string from the requested table. Uses WaitForCompletion to force the loading to complete synchronously. Please note that WaitForCompletion is not supported on WebGL.
Declaration
public string GetLocalizedString(TableEntryReference tableEntryReference, IList<object> arguments, Locale locale = null, FallbackBehavior fallbackBehavior = FallbackBehavior.UseProjectSettings)
Parameters
Type | Name | Description |
---|---|---|
TableEntryReference | tableEntryReference | A reference to the entry in the StringTable |
IList<Object> | arguments | Arguments passed to SmartFormat or String.Format. |
Locale | locale | The Locale to use instead of the default SelectedLocale |
FallbackBehavior | fallbackBehavior | A Enum which determines if a Fallback should be used when no value could be found for the Locale. |
Returns
Type | Description |
---|---|
String |
GetLocalizedString(TableEntryReference, Locale, FallbackBehavior, Object[])
Attempts to retrieve a string from the requested table. Uses WaitForCompletion to force the loading to complete synchronously. Please note that WaitForCompletion is not supported on WebGL.
Declaration
public string GetLocalizedString(TableEntryReference tableEntryReference, Locale locale = null, FallbackBehavior fallbackBehavior = FallbackBehavior.UseProjectSettings, params object[] arguments)
Parameters
Type | Name | Description |
---|---|---|
TableEntryReference | tableEntryReference | A reference to the entry in the StringTable |
Locale | locale | The Locale to use instead of the default SelectedLocale |
FallbackBehavior | fallbackBehavior | A Enum which determines if a Fallback should be used when no value could be found for the Locale. |
Object[] | arguments | Arguments passed to SmartFormat or String.Format. |
Returns
Type | Description |
---|---|
String |
GetLocalizedString(TableReference, TableEntryReference, IList<Object>, Locale, FallbackBehavior)
Attempts to retrieve a string from the requested table. The string will first be formatted with UnityEngine.Localization.SmartFormat if IsSmart is enabled otherwise it will use String.Format. Uses WaitForCompletion to force the loading to complete synchronously. Please note that WaitForCompletion is not supported on WebGL.
Declaration
public virtual string GetLocalizedString(TableReference tableReference, TableEntryReference tableEntryReference, IList<object> arguments, Locale locale = null, FallbackBehavior fallbackBehavior = FallbackBehavior.UseProjectSettings)
Parameters
Type | Name | Description |
---|---|---|
TableReference | tableReference | A reference to the table to check for the string. |
TableEntryReference | tableEntryReference | A reference to the entry in the StringTable |
IList<Object> | arguments | Arguments passed to SmartFormat or String.Format. |
Locale | locale | The Locale to use instead of the default SelectedLocale |
FallbackBehavior | fallbackBehavior | A Enum which determines if a Fallback should be used when no value could be found for the Locale. |
Returns
Type | Description |
---|---|
String |
GetLocalizedString(TableReference, TableEntryReference, Locale, FallbackBehavior, Object[])
Attempts to retrieve a string from the requested table. The string will first be formatted with UnityEngine.Localization.SmartFormat if IsSmart is enabled otherwise it will use String.Format. Uses WaitForCompletion to force the loading to complete synchronously. Please note that WaitForCompletion is not supported on WebGL.
Declaration
public virtual string GetLocalizedString(TableReference tableReference, TableEntryReference tableEntryReference, Locale locale = null, FallbackBehavior fallbackBehavior = FallbackBehavior.UseProjectSettings, params object[] arguments)
Parameters
Type | Name | Description |
---|---|---|
TableReference | tableReference | A reference to the table to check for the string. |
TableEntryReference | tableEntryReference | A reference to the entry in the StringTable |
Locale | locale | The Locale to use instead of the default SelectedLocale |
FallbackBehavior | fallbackBehavior | A Enum which determines if a Fallback should be used when no value could be found for the Locale. |
Object[] | arguments | Arguments passed to SmartFormat or String.Format. |
Returns
Type | Description |
---|---|
String |
GetLocalizedStringAsync(TableEntryReference, IList<Object>, Locale, FallbackBehavior)
Attempts to retrieve a string from the requested table. This method is asynchronous and may not have an immediate result. Check IsDone to see if the data is available, if it is false then you can use the Completed event to get a callback when it is finished, yield on the operation or call WaitForCompletion to force the operation to complete.
Declaration
public AsyncOperationHandle<string> GetLocalizedStringAsync(TableEntryReference tableEntryReference, IList<object> arguments, Locale locale = null, FallbackBehavior fallbackBehavior = FallbackBehavior.UseProjectSettings)
Parameters
Type | Name | Description |
---|---|---|
TableEntryReference | tableEntryReference | A reference to the entry in the StringTable |
IList<Object> | arguments | Arguments passed to SmartFormat or String.Format. |
Locale | locale | The Locale to use instead of the default SelectedLocale |
FallbackBehavior | fallbackBehavior | A Enum which determines if a Fallback should be used when no value could be found for the Locale. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<String> |
GetLocalizedStringAsync(TableEntryReference, Locale, FallbackBehavior, Object[])
Attempts to retrieve a string from the requested table. This method is asynchronous and may not have an immediate result. Check IsDone to see if the data is available, if it is false then you can use the Completed event to get a callback when it is finished, yield on the operation or call WaitForCompletion to force the operation to complete.
Declaration
public AsyncOperationHandle<string> GetLocalizedStringAsync(TableEntryReference tableEntryReference, Locale locale = null, FallbackBehavior fallbackBehavior = FallbackBehavior.UseProjectSettings, params object[] arguments)
Parameters
Type | Name | Description |
---|---|---|
TableEntryReference | tableEntryReference | A reference to the entry in the StringTable |
Locale | locale | The Locale to use instead of the default SelectedLocale |
FallbackBehavior | fallbackBehavior | A Enum which determines if a Fallback should be used when no value could be found for the Locale. |
Object[] | arguments | Arguments passed to SmartFormat or String.Format. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<String> |
GetLocalizedStringAsync(TableReference, TableEntryReference, IList<Object>, Locale, FallbackBehavior, IVariableGroup)
Attempts to retrieve a string from the requested table. The string will first be formatted with UnityEngine.Localization.SmartFormat if IsSmart is enabled otherwise it will use String.Format. This method is asynchronous and may not have an immediate result. Check IsDone to see if the data is available, if it is false then you can use the Completed event to get a callback when it is finished, yield on the operation or call WaitForCompletion to force the operation to complete.
Declaration
public virtual AsyncOperationHandle<string> GetLocalizedStringAsync(TableReference tableReference, TableEntryReference tableEntryReference, IList<object> arguments, Locale locale = null, FallbackBehavior fallbackBehavior = FallbackBehavior.UseProjectSettings, IVariableGroup localVariables = null)
Parameters
Type | Name | Description |
---|---|---|
TableReference | tableReference | A reference to the table to check for the string. |
TableEntryReference | tableEntryReference | A reference to the entry in the StringTable |
IList<Object> | arguments | Arguments passed to SmartFormat or String.Format. |
Locale | locale | The Locale to use instead of the default SelectedLocale |
FallbackBehavior | fallbackBehavior | A Enum which determines if a Fallback should be used when no value could be found for the Locale. |
IVariableGroup | localVariables | Optional IVariableGroup which can be used to add additional named variables. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<String> |
GetLocalizedStringAsync(TableReference, TableEntryReference, Locale, FallbackBehavior, Object[])
Attempts to retrieve a string from the requested table. The string will first be formatted with UnityEngine.Localization.SmartFormat if IsSmart is enabled otherwise it will use String.Format. This method is asynchronous and may not have an immediate result. Check IsDone to see if the data is available, if it is false then you can use the Completed event to get a callback when it is finished, yield on the operation or call WaitForCompletion to force the operation to complete.
Declaration
public virtual AsyncOperationHandle<string> GetLocalizedStringAsync(TableReference tableReference, TableEntryReference tableEntryReference, Locale locale = null, FallbackBehavior fallbackBehavior = FallbackBehavior.UseProjectSettings, params object[] arguments)
Parameters
Type | Name | Description |
---|---|---|
TableReference | tableReference | A reference to the table to check for the string. |
TableEntryReference | tableEntryReference | A reference to the entry in the StringTable |
Locale | locale | The Locale to use instead of the default SelectedLocale |
FallbackBehavior | fallbackBehavior | A Enum which determines if a Fallback should be used when no value could be found for the Locale. |
Object[] | arguments | Arguments passed to SmartFormat or String.Format. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<String> |