Class TrTaskExtensions
Inherited Members
Namespace: Glitch9.AIDevKit.Sheets
Assembly: Glitch9.AIDevKit.Sheets.dll
Syntax
public static class TrTaskExtensions
Methods
| Edit this page View SourceTr(DateTime, TimeFormat)
Localizes the specified DateTime based on the current locale.
Declaration
public static string Tr(this DateTime date, TimeFormat format = TimeFormat.DateTime)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | date | The DateTime to localize. |
| TimeFormat | format | The format to use. |
Returns
| Type | Description |
|---|---|
| string | A localized string representation of the DateTime. |
Tr(DateTime, Locale, TimeFormat)
Localizes the specified DateTime based on a given locale.
Declaration
public static string Tr(this DateTime date, Locale locale, TimeFormat format = TimeFormat.DateTime)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | date | The DateTime to localize. |
| Locale | locale | The locale to use for localization. |
| TimeFormat | format | The format to use. |
Returns
| Type | Description |
|---|---|
| string | A localized string representation of the DateTime. |
Tr(DayOfWeek)
Localizes the specified day of the week.
Declaration
public static string Tr(this DayOfWeek dayOfWeek)
Parameters
| Type | Name | Description |
|---|---|---|
| DayOfWeek | dayOfWeek | The day of the week to localize. |
Returns
| Type | Description |
|---|---|
| string | A localized string representation of the day of the week. |
Tr(string, string)
Get the localized string for the given key in the specified table. If the table name is not provided, the default table is used.
Declaration
public static TrStringTask Tr(this string key, string table = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | |
| string | table |
Returns
| Type | Description |
|---|---|
| TrStringTask |
Tr(TimeSpan)
Localizes the specified TimeSpan.
Declaration
public static string Tr(this TimeSpan timeSpan)
Parameters
| Type | Name | Description |
|---|---|---|
| TimeSpan | timeSpan |
Returns
| Type | Description |
|---|---|
| string |
TrAsset<T>(string, string)
Get the localized Unity asset (Texture2D, Sprite, AudioClip, etc.) for the given key in the specified table. If the table name is not provided, the default table is used.
Declaration
public static TrAssetTask<T> TrAsset<T>(this string key, string table = null) where T : Object
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The localization key. |
| string | table | The table name (optional). |
Returns
| Type | Description |
|---|---|
| TrAssetTask<T> | A TrAssetTask for loading the asset asynchronously. |
Type Parameters
| Name | Description |
|---|---|
| T | The Unity Object type to load. |
TrCallback(string, string, Action<TrStringTask>)
Calls the given callback with a TrTask when the localization system is ready. If not initialized, the callback is queued.
Declaration
public static void TrCallback(this string key, string table, Action<TrStringTask> callback)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | |
| string | table | |
| Action<TrStringTask> | callback |
TrDeferred(string, Action<TrStringTask>)
Calls the given callback with a TrTask when the localization system is ready. If not initialized, the callback is queued.
Declaration
public static void TrDeferred(this string key, Action<TrStringTask> callback)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | |
| Action<TrStringTask> | callback |
TrDeferred<TEnum>(TEnum, Action<TrStringTask>)
Calls the given callback with a TrTask when the localization system is ready. If not initialized, the callback is queued.
Declaration
public static void TrDeferred<TEnum>(this TEnum @enum, Action<TrStringTask> callback) where TEnum : struct, Enum
Parameters
| Type | Name | Description |
|---|---|---|
| TEnum | enum | |
| Action<TrStringTask> | callback |
Type Parameters
| Name | Description |
|---|---|
| TEnum |
TrRealtime(string)
Translate the given text in real-time using the AI model. This is a non-blocking call and will return a TrRealtimeTask object. To get the final result, you need to call the await TrRealtimeTask.TrAsync() method.
Declaration
public static TrRealtimeTask TrRealtime(this string text)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | The text to translate. |
Returns
| Type | Description |
|---|---|
| TrRealtimeTask |
Tr<TEnum>(TEnum)
Get the localized string for the given Enum value. The enum type must have LocalizedEnumAttribute attribute.
Declaration
public static TrStringTask Tr<TEnum>(this TEnum @enum) where TEnum : struct, Enum
Parameters
| Type | Name | Description |
|---|---|---|
| TEnum | enum |
Returns
| Type | Description |
|---|---|
| TrStringTask |
Type Parameters
| Name | Description |
|---|---|
| TEnum |