How to work with translation workbench programmatically?

How to work with translation workbench programmatically?

In the case of translations, we will have a file per language. The only way to work with Translation Workbench programmatically is by using the Metadata API. In these examples, I will use workbench for simplicity, but you can automate the usage of Metadata API with the ant migration tool, or even in Apex, using this great wrapper.

How to programmatically translate your app or website?

Go to the shell prompt on your Mac OS X, Linux, or Windows (Powershell) system and set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the path of your JSON service account key using the following commands. This variable only applies to the current shell session.

How can I translate text on my Web site?

Write code that reads the content of your Web site and makes a REST call to the Cloud Translation API (including a parameter pointing to your model and then producing a translated version of that text). Create a new page in your content management system to contain and then display the translated text.

How much does it cost to use the Translate API?

The fee for the Translate API is $20 per million characters processed. The Media Translation API will run you $0.068 to $0.084 per minute. AutoML costs $45 per hour for training a language pair, to a max of $300/pair.

How does the translation workbench work in Salesforce?

Translation Workbench is a tool that allows you to translate Salesforce texts to different languages. In this post I want to dig into how translations are implemented in the system, and how to work with them through the metadata API. Translations are stored through different metadata types.

How is metadata stored in the translation workbench?

Bear in mind there are some gaps between the Metadata API and the Translation Workbench (eg: custom app description), but most of the translatable texts are supported by the Metadata API. These top-level metadata types will be stored as folders in your source code.

How to add or edit translated languages in Salesforce?

To add or edit translated languages and translators: 1. From Setup, click Translation Workbench -> Translation Settings. 2. Click Add to activate a new language or Edit to change an existing supported language. 3. If adding a new language, choose a language. 4. To make the entered translations available to your users – select Active.