hammerspoon2-docs
    Preparing search index...

    Class HSTranslationSession

    JavaScript-visible API for a translation session bound to a specific language pair.

    Index

    Constructors

    Properties

    sourceLanguage: string

    BCP-47 identifier of the source language (e.g. "en").

    targetLanguage: string

    BCP-47 identifier of the target language (e.g. "fr").

    typeName: string

    The Swift type name, for JavaScript introspection.

    Methods

    • Translate a string from the session's source language to its target language.

      Parameters

      • text: string

        The text to translate.

      Returns Promise<string>

      A Promise resolving to the translated string,