> ## Documentation Index
> Fetch the complete documentation index at: https://cloudinary.com/documentation/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Translation


[Cloudinary](https://cloudinary.com) is a cloud-based service that provides an end-to-end image and video management solution including uploads, storage, transformations, optimizations and delivery. Cloudinary offers a rich set of transformation and analysis capabilities and allows you to assign multiple tags to resources for listing and managing your media assets.

To enhance these capabilities, Cloudinary offers several add-ons that enable you to take advantage of sophisticated analysis algorithms or deep learning engines to automatically tag your image and video assets. 

By default, these add-ons generate English-language tags. You can use the Google Translation add-on to translate your automatically generated tags into any [supported language](https://cloud.google.com/translate/docs/languages) or into multiple languages, using the [Google Cloud](https://cloud.google.com/translate/) state-of-the-art Neural Machine Translation.

> **TIP**: The Google Translation add-on can also be used to translate auto generated [video transcripts](video_transcription#requesting_translation).
#### Getting started

Before you can use the Google Translation add-on:

* You must have a Cloudinary account. If you don't already have one, you can [sign up](https://cloudinary.com/users/register_free) for a free account. 

* Register for the add-on: make sure you're logged in to your account and then go to the [Add-ons](https://console.cloudinary.com/app/settings/addons) page. For more information about add-on registrations, see [Registering for add-ons](cloudinary_add_ons#registering_for_add_ons).

* Keep in mind that many of the examples on this page use our SDKs. For SDK installation and configuration details, see the relevant [SDK](cloudinary_sdks) guide.
  
* If you're new to Cloudinary, you may want to take a look at the [Developer Kickstart](dev_kickstart) for a hands-on, step-by-step introduction to a variety of features.

## How it works

To use the translation add-on with a tagging add-on, make sure you are registered for the automatic image or video tagging add-on you want to use as well as the translation add-on. 

You can use the Google Translation add-on with the following auto-tagging add-ons:

* [Google Auto Tagging](google_auto_tagging_addon) 
* [Amazon Rekognition Auto Tagging](aws_rekognition_auto_tagging_addon)
* [Imagga Auto Tagging](imagga_auto_tagging_addon) 
* [Google Automatic Video Tagging](google_automatic_video_tagging_addon)

You can also use the translation add-on together with the [Amazon Rekognition Celebrity Detection](aws_rekognition_celebrity_and_face_detection_addon) add-on, which supports auto-tagging the celebrities it detects. While celebrity names will generally be identical in all latin-based languages, translating the tags for detected celebrities can be useful for non-latin languages.

Once you are registered for both the translation and relevant tagging add-on, then when you specify the tagging add-on to use as part of your `categorization` or `detection` parameter in your [upload](image_upload_api_reference#upload) or [update](admin_api#update_details_of_an_existing_resource) method call, you append the language codes for any language you want for your tags.

For example, the following statement uploads the `windmill_day` image, requests the Google Auto Tagging add-on to automatically add tags to the image for any categories it detects with greater than 60% confidence, and requests that the tags be translated into English, French, and Spanish.

```multi
|ruby
Cloudinary::Uploader.upload("windmill_day.jpg", 
  categorization: "google_tagging:en:fr:es", 
  auto_tagging: 0.6)

|php_2
$cloudinary->uploadApi()->upload("windmill_day.jpg", [
    "categorization" => "google_tagging:en:fr:es", 
    "auto_tagging" => 0.6]);

|python
cloudinary.uploader.upload("windmill_day.jpg",
  categorization = "google_tagging:en:fr:es", 
  auto_tagging = 0.6)

|nodejs
cloudinary.v2.uploader
.upload("windmill_day.jpg", 
  { categorization: "google_tagging:en:fr:es", 
    auto_tagging: 0.6 })
.then(result=>console.log(result)); 

|java
cloudinary.uploader().upload("windmill_day.jpg", 
  ObjectUtils.asMap(
    "categorization", "google_tagging:en:fr:es", 
    "auto_tagging", "0.6"));

|csharp
var uploadParams = new ImageUploadParams(){
  File = new FileDescription(@"windmill_day.jpg"),
  Categorization = "google_tagging:en:fr:es",
  AutoTagging = 0.6 };
var uploadResult = cloudinary.Upload(uploadParams);  

|go
resp, err := cld.Upload.Upload(ctx, "windmill_day.jpg", uploader.UploadParams{
		Categorization: "google_tagging:en:fr:es",
		AutoTagging:    0.6})

|android
MediaManager.get().upload("windmill_day.jpg")
  .option("categorization", "google_tagging:en:fr:es")
  .option("auto_tagging", "0.6").dispatch();

|swift
let params = CLDUploadRequestParams()
  .setCategorization("google_tagging:en:fr:es")
  .setAutoTagging(0.6)
var mySig = MyFunction(params)  // your own function that returns a signature generated on your backend
params.setSignature(CLDSignature(signature: mySig.signature, timestamp: mySig.timestamp))
let request = cloudinary.createUploader().signedUpload(
  url: "windmill_day.jpg", params: params) 

|curl
curl https://api.cloudinary.com/v1_1/demo/image/upload -X POST -F 'file=@/path/to/windmill_day.jpg' -F 'categorization=google_tagging:en:fr:es' -F 'auto_tagging=0.6' -F 'timestamp=173719931' -F 'api_key=436464676' -F 'signature=a781d61f86a6f818af'

|cli
cld uploader upload "windmill_day.jpg" categorization="google_tagging:en:fr:es" auto_tagging=0.6
```

If you want to run the translation add-on for an existing asset, you can use the `update` method. For example: 

The following code sample uses Cloudinary's `update` method to apply Google's automatic image tagging and categorization to the `puppy` uploaded image, translate all the detected categories to Russian, and then automatically add resource tags in Russian based on the categories detected with over a 90% confidence level.

```multi
|ruby
Cloudinary::Api.update("puppy", 
  categorization: "google_tagging:ru", 
  auto_tagging: 0.9)

|php_2
$api->update("puppy", [
    "categorization" => "google_tagging:ru", 
    "auto_tagging" => 0.9]);

|python
cloudinary.api.update("puppy",
  categorization = "google_tagging:ru", 
  auto_tagging = 0.9)

|nodejs
cloudinary.v2.api
.update("puppy", 
  { categorization: "google_tagging:ru", 
    auto_tagging: 0.9 })
.then(result=>console.log(result));

|java
cloudinary.api().update("puppy", ObjectUtils.asMap(
  "categorization", "google_tagging:ru", 
  "auto_tagging", 0.9));

|csharp
var updateParams = new UpdateParams("puppy") 
{
  Categorization = "google_tagging:ru",
  AutoTagging = 0.9
};
var updateResult = cloudinary.UpdateResource(updateParams); 

|go
resp, err := cld.Admin.UpdateAsset(ctx, admin.UpdateAssetParams{
		PublicID:       "puppy",
		Categorization: "google_tagging:ru",
		AutoTagging:    0.9})

|cli
cld admin update "puppy" categorization="google_tagging:ru" auto_tagging=0.9
```

> **NOTE**: When using the Imagga Auto Tagging add-on, if you specify languages, it will use the built-in Imagga translation engine offered with that add-on. If you want to use the Google Translation Add-on instead, you must explicitly specify `google` before the requested languages. For example: `imagga_tagging:google:fr:es`.

### Add-on quota usage

* When you call a tagging add-on and request one or more non-English languages, quota is used from the relevant tagging add-on to generate the base English tags and from the translation add-on for each translated tag (counted in input characters). If you request multiple non-English languages, the translation add-on quota is charged for each language you request. If you lack sufficient quota in either of the add-ons, an error is returned. 
* If you call a tagging add-on without any languages specified, the automatically added tags will always be in English only. However, if you specify languages, then only tags for the languages you specify are added. If you want English tags in addition to other languages, make sure to specify it. 
* Regardless of whether you choose to include English as a requested tag language, the tagging add-on you use is always charged for generating the original English categories, while English is never charged to your Translation Add-on quota.

## Response with translations

The method response shows the complete list of tags that were added to your asset in all languages (those that exceeded the required confidence level), and additionally shows the translations for each identified category at all levels of confidence. For example, the response for the Google Tagging upload response (using the upload example above):

```json
{
  "public_id": "windmill",
  "version": 1544977046,
  "signature": "cc5cb6d1b14e44cd0bfab89a96904de4db4316cc",
   ...
  "tags": [ "windmill", "moulin à vent", "molino", "waterway", "voie navigable", 
    "camino acuático", "grassland", "prairie", "pradera", "sky", "ciel", "cielo",  ... ],
  "bytes": 139200,
   ...
  "info": {
    "categorization": {
      "google_tagging": {
        "status": "complete",
        "data": [
          { "tag": {
              "en": "windmill",
              "fr": "moulin à vent",
              "es": "molino" },
            "confidence": 0.9753 },
          { "tag": {
              "en": "waterway",
              "fr": "voie navigable",
              "es": "camino acuático" },
            "confidence": 0.9287 },
          { "tag": {
              "en": "grassland",
              "fr": "prairie",
              "es": "pradera" },
            "confidence": 0.9145 },
          ...
        ],
      },
    },
  "original_filename": "windmill_day"
} 
```         

### Response with vs. without a language request

If you don't specify any language when you call a tagging add-on, the `data` section of the response will have a simpler structure. For example:

```json
"data": [
  { "tag": "windmill", 
    "confidence": 0.9753 },
  { "tag": "waterway",
    "confidence": 0.9287 },
 ...
```         
However, if you explicitly specify only `en` (for example, `google_tagging:en`), then even though the English language request will not impact your translation add-on quota and the tags assigned to your asset will be the same, the response will have the structure for translated tags, with the detected category value listed next to an `"en:"` sub-entry. For example:  

```json
"data": [
  { "tag": { "en": "windmill" },
    "confidence": 0.9753 },
  { "tag": { "en": "waterway" },
    "confidence": 0.9287 },
  ...
```

Keep this in mind if your code parses the response.

