Search Results for

    Show / Hide Table of Contents

    Class TrRealtimeTask

    Builder class for configuring and executing realtime translation tasks.

    Inheritance
    object
    TrRealtimeTask
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Glitch9.AIDevKit.Sheets.Realtime
    Assembly: Glitch9.AIDevKit.Sheets.dll
    Syntax
    public class TrRealtimeTask

    Constructors

    | Edit this page View Source

    TrRealtimeTask(string)

    Initializes a new realtime translation task with the text to translate.

    Declaration
    public TrRealtimeTask(string textToTranslate)
    Parameters
    Type Name Description
    string textToTranslate

    The text to translate

    Methods

    | Edit this page View Source

    SetCallback(Action<string>)

    Sets the callback to be invoked when translation is completed.

    Declaration
    public TrRealtimeTask SetCallback(Action<string> onTranslated)
    Parameters
    Type Name Description
    Action<string> onTranslated

    The callback function that receives the translated text

    Returns
    Type Description
    TrRealtimeTask

    The current instance for method chaining

    | Edit this page View Source

    SetModel(Model)

    Sets the AI model to use. If not provided, the default model will be used.

    Declaration
    public TrRealtimeTask SetModel(Model model)
    Parameters
    Type Name Description
    Model model

    The AI model

    Returns
    Type Description
    TrRealtimeTask

    The current instance for method chaining

    | Edit this page View Source

    SetService(TrService)

    Sets the translation service to use.

    Declaration
    public TrRealtimeTask SetService(TrService service)
    Parameters
    Type Name Description
    TrService service

    The translation service

    Returns
    Type Description
    TrRealtimeTask

    The current instance for method chaining

    | Edit this page View Source

    SetSourceLocale(Locale)

    Sets the source language. If not provided, the source language will be detected automatically.

    Declaration
    public TrRealtimeTask SetSourceLocale(Locale sourceLocale)
    Parameters
    Type Name Description
    Locale sourceLocale

    The source language

    Returns
    Type Description
    TrRealtimeTask

    The current instance for method chaining

    | Edit this page View Source

    SetTargetLocale(Locale)

    Sets the target language. If not provided, the target language will be set to the default locale.

    Declaration
    public TrRealtimeTask SetTargetLocale(Locale targetLocale)
    Parameters
    Type Name Description
    Locale targetLocale

    The target language

    Returns
    Type Description
    TrRealtimeTask

    The current instance for method chaining

    | Edit this page View Source

    TrAsync()

    Executes the translation asynchronously with the configured settings.

    Declaration
    public UniTask<string> TrAsync()
    Returns
    Type Description
    UniTask<string>

    The translated text

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown when realtime translation is disabled

    Extension Methods

    ArrayExtensions.ToArrayOrEmpty<T>(T)
    ArrayExtensions.ToArrayOrNull<T>(T)
    EventExtensions.ToDelta<T>(T, string, int, string, bool)
    EventExtensions.ToDone<T>(T, string, int, string)
    EventExtensions.ToEvent<T>(T)
    EventExtensions.UpcastDelta<T1, T2>(T1, string, int, string, bool)
    FallbackExtensions.IsOr<TParent, TChild>(TParent, TChild)
    ResponseCastingExtensions.GetResult<T>(T)
    SystemExtensions.GetName(object)
    • Edit this page
    • View Source
    In this article
    Back to top AI DevKit Documentation