Programmable Media

Google Translation

Last updated: Apr-18-2024

Cloudinary 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 or into multiple languages, using the Google Cloud state-of-the-art Neural Machine 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 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 page. For more information about add-on registrations, see 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 guide.

  • If you are new to Cloudinary, you may want to take a look at How to integrate Cloudinary in your app for a walk through on the basics of creating and setting up your account, working with SDKs, and then uploading, transforming and delivering assets.

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:

You can also use the translation add-on together with the Amazon Rekognition Celebrity Detection 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 or update 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.

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.

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):

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:

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:

Keep this in mind if your code parses the response.

✔️ Feedback sent!

Rate this page: