# Azure Translator (Legacy)

## Overview

The **Azure Translate** Book integrates with Azure Translate, allowing you to automate language translation in your processes.

## Prerequisites

### 1. Learning the Translator Book

To work with these operations, you must first **learn** the Translator Book in Kognitos. To do so:

1. In the left sidebar, click on **Books → All Books.**
2. Search for **Translator** and click on the book.
3. Click on **Install**.

### 2. Azure Setup

These are prerequisite steps for configuration within Azure.

#### Create an Azure Storage Account

1. Open the **Azure Portal** and go to **Storage accounts** from the menu.
2. Click **Create**.
3. Provide the necessary details, including:
   1. **Subscription**
   2. **Resource Group**
   3. **Storage Account Name**
   4. **Region**
4. Under **Performance**, select **Standard**.
5. For **Redundancy**, choose **LRS (Locally Redundant Storage)**.
6. In the **Advanced** tab, enable:
   1. **Secure transfer**
   2. **Anonymous access to individual containers**
   3. **Storage account key access**
7. Review your settings, then click **Review + Create** to finalize.

#### Create a Container in Azure

1. Navigate to your new storage account in the **Azure Portal**.
2. In the left menu of the storage account, scroll to the **Data storage** section and select **Containers**.
3. Click on **+ Container**.
4. Provide a name for your container.
5. Set the level of anonymous access for the containers and blobs.

#### Create a Translator in Azure

1. Open the portal menu and go to **All Services**.
2. Search for **"Translators"**. Select **Translator** under Azure AI services.
3. Click on **Create Translator**.
4. Fill in the **Project Details** and **Instance Details** for your translator.
5. Click on **Review + create**.
6. After your translator has been created, you will need to retrieve your translator key from **Keys and Endpoint.**

### 3. Connecting to the Translator in Kognitos

After the Book is learned and the translator infrastructure is set up in Azure, you’ll need to connect to the translator within the Kognitos platform. Add the following lines to your Playground or Processes to establish the connection.

```
the department's translation engine is "azure"
connect to translator with
    the translator name is "{translator name}"
    the translator key is "translator key}"
    the storage account name is "{storage account name}"
    the storage account key is "{storage account key}"
    the container name is "{container name}"
```

#### Parameters

1. `translator name`: The name of the Azure translator.
2. `translator key`: The key for the Azure translator.
3. `storage account name`: The name of the Azure storage account.
4. `storage account key`: The key for the Azure storage account.
5. `container name`: The name of the Azure container.

Kognitos will attempt to connect to the translation service using the provided credentials. If the connection is successful, you can proceed with translation operations. Otherwise, please verify your credentials and try again.

## Translating a Document

### Syntax

Two syntaxes are supported:

```
translate the document with
    the target language is "{target language code}"
    the target container is "{target container}"
    the processing time limit is "limit}"
```

```
translate the document to "{target language name}"
```

### Input Parameters

1. `target language code`
   * The ISO 639-1 code of the target language.
   * Examples: `fr`, `en`, `ja`
   * For supported codes, see [Translator Language Support](https://learn.microsoft.com/en-us/azure/ai-services/translator/language-support#translation).
2. `target language name`
   * The name of the target language.
   * Examples: `hindi`, `japanese`, `english`
   * For supported languages, see [Translator Language Support](https://learn.microsoft.com/en-us/azure/ai-services/translator/language-support#translation).
3. `target container` *(optional)*
   * The container where the translated document will be stored.
4. `processing time limit` *(optional)*
   * The maximum time limit for processing the translation in hrs/mins/seconds.

## Examples

### **Basic Translation**

```
translate the document with
    the target language is "fr"
```

```
translate the document to "hindi"
```

### **Translation with Optional Parameters**

```
translate the document with
    the target language is "id"
    the target container is "documentation"
    the processing time limit is "10 mins"
```
