Class LocalizedDatabase<TTable, TEntry>
Namespace: UnityEngine.Localization.Settings
Syntax
[Serializable]
public abstract class LocalizedDatabase<TTable, TEntry> : IPreloadRequired where TTable : DetailedLocalizationTable<TEntry> where TEntry : TableEntry
Type Parameters
Name | Description |
---|---|
TTable | |
TEntry |
Properties
DefaultTable
The default table to use when no table collection name is provided.
Declaration
public virtual TableReference DefaultTable { get; set; }
Property Value
Type | Description |
---|---|
TableReference |
PreloadOperation
Preload operation. Loads all tables and their contents(when applicable) marked with the preload label for the selected locale.
Declaration
public AsyncOperationHandle PreloadOperation { get; }
Property Value
Type | Description |
---|---|
AsyncOperationHandle |
Implements
UseFallback
Should the fallback Locale be used when a translation could not be found?.
Declaration
public bool UseFallback { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
GetDefaultTableAsync()
Returns the Default table. This function is asynchronous and may not have an immediate result available. 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 AsyncOperationHandle<TTable> GetDefaultTableAsync()
Returns
Type | Description |
---|---|
AsyncOperationHandle<TTable> |
GetTableAsync(TableReference, Locale)
Returns the named table. This function is asynchronous and may not have an immediate result available. 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<TTable> GetTableAsync(TableReference tableReference, Locale locale = null)
Parameters
Type | Name | Description |
---|---|---|
TableReference | tableReference | The table identifier. Can be either the name of the table or the table collection name Guid. |
Locale | locale | The Locale to load the table from, use null to default to cref="LocalizationSettings.SelectedLocale"/>. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<TTable> |
GetTableEntryAsync(TableReference, TableEntryReference, Locale, FallbackBehavior)
Returns the entry from the requested table. A table entry will contain the localized item and metadata.
This function is asynchronous and may not have an immediate result available.
Check IsDone to see if the data is available, if it is false then use the Completed event or yield on the operation.
Once the Completed event has been called, during the next update, the internal operation will be returned to a pool so that it can be reused.
If you do plan to keep hold of the handle after completion then you should call
Declaration
public virtual AsyncOperationHandle<LocalizedDatabase<TTable, TEntry>.TableEntryResult> GetTableEntryAsync(TableReference tableReference, TableEntryReference tableEntryReference, Locale locale = null, FallbackBehavior fallbackBehavior = FallbackBehavior.UseProjectSettings)
Parameters
Type | Name | Description |
---|---|---|
TableReference | tableReference | The table identifier. Can be either the name of the table or the table collection name Guid. |
TableEntryReference | tableEntryReference | A reference to the entry in the table. |
Locale | locale | The Locale to load the table from. Null will use 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<LocalizedDatabase.TableEntryResult<>> |
OnLocaleChanged(Locale)
Called before the LocaleChanged event is sent out in order to give the database a chance to prepare.
Declaration
public virtual void OnLocaleChanged(Locale locale)
Parameters
Type | Name | Description |
---|---|---|
Locale | locale |
PreLoadTables(IList<TableReference>, Locale)
Attempts to retrieve all the Tables at once 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 AsyncOperationHandle PreLoadTables(IList<TableReference> tableReferences, Locale locale = null)
Parameters
Type | Name | Description |
---|---|---|
IList<TableReference> | tableReferences | An IList of tableReferences to check for the string. |
Locale | locale | The Locale to use instead of the default SelectedLocale |
Returns
Type | Description |
---|---|
AsyncOperationHandle |
PreLoadTables(TableReference, Locale)
Declaration
public AsyncOperationHandle PreLoadTables(TableReference tableReference, Locale locale = null)
Parameters
Type | Name | Description |
---|---|---|
TableReference | tableReference | |
Locale | locale |
Returns
Type | Description |
---|---|
AsyncOperationHandle |