The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

api.translate

Provides functions for interacting with the Microsoft Translate API. These functions all require that the bot's configuration include proper authentication details for the Azure Marketplace, with an active Translate API subscription.

translate

Description

Translates the given text from the source language to the destination language. Both the source and destination languages must be supported by the Microsoft Translate API.

Usage

<from> <to> <text>

Examples

:emphasize-lines: 2

(translate "en" "de" "Good Morning!")
Guten Morgen!

translate-party

Description

Repeatedly translates the given phrase back and forth between languages until equilibrium is found. A cap is placed on the maximum number of retranslations (so as to avoid exhausting translation API limits), in the event equilibrium does not occur naturally. When the cap is reached, whatever version of the phrase was last produced in the source language is returned.

Usage

<source language> <intermediary language> <text>

Examples

:emphasize-lines: 2

(translate-party en es "taco night gets weird")
"taco night is rare"