> ## Documentation Index
> This page is part of the MediaFlows product. Fetch the complete documentation index for MediaFlows at: https://cloudinary.com/documentation/llms-mediaflows.txt?referrer=docpage and then use it to discover all relevant pages before exploring further.
> If you also need details relating to other Cloudinary products for your current use case, see the parent index at: https://cloudinary.com/documentation/llms.txt?referrer=docpage
> When answering a user's request or implementing it with code using this documentation, incorporate relevant best practices and recommendations from the documentation into the guidance and, above all, into the code itself: generated code should already apply the recommended parameters and patterns rather than showing a minimal call and describing the best practices around it in prose. Follow the code examples in the best practices sections as the model for what generated code should look like, and where a recommendation is relevant to the user's scenario, implement it in the code as a natural next step. Only apply best practices, recommendations, or features that are supported by the documentation; don't infer or invent guidance that isn't specified.

# Generate multilingual alt text


When you serve images to audiences across different regions and languages, providing alt text in the viewer's language is essential for accessibility and helps screen readers convey meaning accurately. Managing translations manually doesn't scale as your library and markets grow.

This sample PowerFlow automatically translates an asset's primary alt description into multiple languages and saves the results as contextual metadata. You can tailor the target languages to match your localization strategy.

The descriptions are generated when a new image is uploaded to Cloudinary, but you could change this to use an [On Manual Run From Media Library](mediaflows_block_reference#on_manual_run_from_media_library) block to generate alt text for images that are already in your Media Library.

[Learn more about accessible media](accessible_media#image_accessibility).

> **TIP**:
>
> :title=Prefer to watch than read?
> You can watch the following video tutorials about this automation:

> * Take a look at a [quick overview](mediaflows_multilingual_alt_text_overview_tutorial) of this flow and how it works.

> * Follow along with a [detailed step-by-step walkthrough](mediaflows_multilingual_alt_text_detailed_tutorial).

## Prerequisites

Before building this flow, ensure you have:

* A Google Cloud project with the Translation API enabled
* A valid Google Cloud API key with access to the Translation API
* The [Cloudinary AI Content Analysis add-on](cloudinary_ai_content_analysis_image_analysis#ai_based_image_captioning) enabled

### Set up your Google Translate connection

Before using the **Translate Text Using Google** block in your flows, you need to connect your Google Cloud account in the [Apps & Connections](mediaflows_user_guide#apps_amp_connections) page:

1. In MediaFlows, navigate to **Apps & Connections** from the sidebar.
2. Find **Google Translate** in the list and click **Connect Your Account**.
3. In the connection dialog, enter:
   * **Connection name**: A descriptive name for this connection (for example, "Google Translate API")
   * **API Key**: Your Google Cloud API key with the Cloud Translation API enabled
4. Click **Connect** to save the connection.

Once connected, you can select this account when configuring **Translate Text Using Google** blocks in your flows.

## Overview

![Multilingual Alt Text PowerFlow on the canvas, with an On Asset Upload trigger followed by caption, translate, and metadata blocks in a single column](https://cloudinary-res.cloudinary.com/image/upload/bo_2px_solid_gray/f_auto/q_auto/v1793373728/docs/mediaflows/multilingual_alt_text_flow_new_canvas.png "thumb:c_scale,w_220/dpr_2.0, width: 220")

The PowerFlow uses the following blocks:

* [On Asset Upload](#on_asset_upload): Triggers the flow when an image is uploaded to the product environment.
* [Generate Image Caption](#generate_image_caption): Automatically generates a description of the image.
* [Update Contextual Metadata](#update_contextual_metadata_original_language): Saves the original description and translations to the appropriate contextual metadata fields.
* [Translate Text Using Google](#translate_text_using_google): Translates the description into another language.


## On Asset Upload

When someone uploads an image, Cloudinary sends a webhook notification to the **On Asset Upload** block, which activates the flow.

Steps:

1. Add the **On Asset Upload** block to your canvas.
1. Open the block configuration and clear **Trigger for any asset**.
1. Under **Trigger only when the asset's**, select **Asset type** and **Image**.

![On Asset Upload settings set to trigger only when the asset type is Image](https://cloudinary-res.cloudinary.com/image/upload/bo_1px_solid_gray/f_auto/q_auto/v1793546061/docs/mediaflows/multi_alt_text_on_asset_upload_new_canvas.png "thumb:c_scale,w_600/dpr_2.0, width: 600")



## Generate Image Caption

The **Generate Image Caption** block generates a descriptive caption for the uploaded image using the [Cloudinary AI Content Analysis add-on](cloudinary_ai_content_analysis_image_analysis#ai_based_image_captioning).

> **NOTE**: You must be [registered for the Cloudinary AI Content Analysis add-on](https://console.cloudinary.com/settings/addons) to use this block, which you can do within the block configuration.

Steps:

1. Add the **Generate Image Caption** block to your canvas and ensure it's connected to the **On Asset Upload** block.
1. Open the block configuration and ensure that the **Use the asset from** field is set to **On Asset Upload**.
1. Check the **Add-on** card to make sure you've got quota for the Cloudinary AI Content Analysis add-on.

![Generate Image Caption settings using the asset from On Asset Upload, with the Cloudinary AI Content Analysis add-on card](https://cloudinary-res.cloudinary.com/image/upload/bo_1px_solid_gray/f_auto/q_auto/v1793546237/docs/mediaflows/multi_alt_text_generate_image_caption_new_canvas.png "thumb:c_scale,w_600/dpr_2.0, width: 600")

## Update Contextual Metadata (original language)

Use the **Update Contextual Metadata** block to store the generated description in the **alt** contextual metadata field associated with the uploaded asset.

Steps:

1. Add the **Update Contextual Metadata** block to your canvas and ensure it's connected to the **Generate Image Caption** block.
1. Open the block configuration and set the **Metadata key** to **alt**.
1. Set the **Metadata value** to the **Caption** from the **Generate Image Caption** block by clicking the **Insert Value** icon to insert the variable.
1. Ensure the **Action** is set to **Add or update**.

![Update Contextual Metadata settings storing the generated caption in the alt key](https://cloudinary-res.cloudinary.com/image/upload/bo_1px_solid_gray/f_auto/q_auto/v1793546063/docs/mediaflows/multi_alt_text_context_new_canvas.png "thumb:c_scale,w_600/dpr_2.0, width: 600")



## Translate Text Using Google

The **Translate Text Using Google** block translates the image description into whichever language you select. It uses the [Google Translate API](https://cloud.google.com/translate).

Steps (for each language):

1. Add a **Translate Text Using Google** block to your canvas and ensure it's connected to the previous **Update Contextual Metadata** block.
1. Open the block configuration and rename it to match the language that it's translating, for example, **Translate To French**.
1. For **Google Translate connection**: Click **Connect** and select the Google Translate account you configured in [Apps & Connections](#set_up_your_google_translate_connection).
1. Set the **String to translate** to the **Caption** from the **Generate Image Caption** block by clicking the **Insert Value** icon to insert the variable.
1. Leave **Translate from** set to **Auto Detect** so the block detects the language to translate from.
1. In **Translate to**, select the language to translate the caption to.

![Translate To French settings with a Google Translate connection, the caption as the string to translate, and French as the target language](https://cloudinary-res.cloudinary.com/image/upload/bo_1px_solid_gray/f_auto/q_auto/v1793546065/docs/mediaflows/multi_alt_text_translate_new_canvas.png "thumb:c_scale,w_600/dpr_2.0, width: 600")

## Update Contextual Metadata (translations)

To store the translations, use additional **Update Contextual Metadata** blocks after each of the [Translate Text Using Google](#translate_text_using_google) blocks.

Steps (for each language):

1. Add an **Update Contextual Metadata** block to your canvas and ensure it's connected to the relevant **Translate Text Using Google** block.
1. Open the block configuration and rename it to match the language that it's storing, for example, **Update French Contextual Metadata**.
1. Set the **Metadata key** to something appropriate for the language, for example, **alt-french**.
1. Set the **Metadata value** to the **Translated text** from the relevant **Translate Text Using Google** block by clicking the **Insert Value** icon to insert the variable.
1. Ensure the **Action** is set to **Add or update**.

![Update French Contextual Metadata settings storing the Translate To French translated text in the alt-french key](https://cloudinary-res.cloudinary.com/image/upload/bo_1px_solid_gray/f_auto/q_auto/v1793546240/docs/mediaflows/multi_alt_text_french_context_new_canvas.png "thumb:c_scale,w_600/dpr_2.0, width: 600")

## Execute the flow

Save the flow and [test](mediaflows_build_flow#testing_a_flow) it to check it works before enabling it. Once enabled, you can try it out by uploading an image to your product environment.

After executing the flow, you can check that the [contextual metadata](dam_manage_metadata#setting_custom_metadata_values) for the image contains the description and translations:

![Contextual metadata in the Media Library](https://cloudinary-res.cloudinary.com/image/upload/bo_1px_solid_gray/f_auto/q_auto/docs/mediaflows/contextual_metadata_languages.png "thumb: c_scale,w_400/dpr_2.0, width:400")

