Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Translation.Translations

Translates several texts.

Component Version macOS Windows Linux Server iOS SDK
Translation 16.0 ✅ Yes ❌ No ❌ No ❌ No ✅ Yes
MBS( "Translation.Translations"; SessionID; Requests )   More

Parameters

Parameter Description Example
SessionID The translation session. $session
Requests Pass a JSON array with entries for each request.
Each request must have a sourceText value.
Optional it can contain a clientIdentifier value, that is copied into the response.

Result

Returns JSON or error.

Description

Translates several texts.
Translates multiple strings of text of the same language, returning the results all at once when complete.

This function translates multiple strings as a batch and might display different UI depending on the state of the translation. The languages the framework requires for the translation don't have to be installed before calling this method.

Pass in the strings of text you want to translate as an array of the Request type. This method takes longer to return than translateBatch, but it has the advantage of not having to map translation requests to responses. The responses return in the same order the requests are sent.

If the required languages for translation have already downloaded and the source language is clear, this function returns results without showing any further prompts to the person.

If the source or target language aren't installed, the framework asks the person for permission to download the languages. During download a progress indicator displays. After the download completes, the framework performs the translation.

If the sourceLanguage is empty and the framework can't detect the source language from the content, the framework prompts the person to choose the source language.

The framework only supports string translations of the same language. The strings must either match the sourceLanguage you set in the configuration, or if the sourceLanguage is empty, be of the same language.

This function throws an error if:
  • The person doesn't agree to downloading the languages
  • The person dismisses the progress view during language downloads
  • TranslationSession fails system validation
  • The session doesn't allow requesting downloads and languages aren't installed
  • You already cancelled the session
  • Something goes wrong during translation
If a person dismisses the progress view while the languages download, the system throws a user cancelled error, and the languages continue to download in the background.

Note: Calls to this function can take several minutes while languages download.

Examples

Try translations:

Let([
    session = MBS( "Translation.StartSession"; "de"; "en");
    json = "[]";
    json = JSONSetElement ( json ; "[+].sourceText" ; "Hallo Leute" ; JSONString );
    json = JSONSetElement ( json ; "[+].sourceText" ; "Man sieht sich bei der Konferenz!" ; JSONString );
    text = MBS( "Translation.Translations"; session; json);
    r = MBS("Translation.Release"; session)
]; text)

Example result:
[ { "targetText" : "Hello people", "sourceLanguage" : "de", "targetLanguage" : "en", "sourceText" : "Hallo Leute" }, { "sourceText" : "Man sieht sich bei der Konferenz!", "sourceLanguage" : "de", "targetText" : "See you at the conference!", "targetLanguage" : "en" } ]

Same but with client identifier to pass through:

Let([
    session = MBS( "Translation.StartSession"; "de"; "en");
    json = "[]";
    json = JSONSetElement ( json ; "[+].sourceText" ; "Hallo Leute" ; JSONString );
    json = JSONSetElement ( json ; "[:].clientIdentifier" ; "1" ; JSONString );
    json = JSONSetElement ( json ; "[+].sourceText" ; "Man sieht sich bei der Konferenz!" ; JSONString );
    json = JSONSetElement ( json ; "[:].clientIdentifier" ; "2" ; JSONString );
    text = MBS( "Translation.Translations"; session; json);
    r = MBS("Translation.Release"; session)
]; text)

Example result:
[ { "targetLanguage" : "en", "targetText" : "Hello people", "clientIdentifier" : "1", "sourceText" : "Hallo Leute", "sourceLanguage" : "de" }, { "targetText" : "See you at the conference!", "clientIdentifier" : "2", "sourceLanguage" : "de", "targetLanguage" : "en", "sourceText" : "Man sieht sich bei der Konferenz!" } ]

See also

Blog Entries

This function checks for a license.

Created 24th November 2025, last changed 14th December 2025


Translation.TranslateString - Twain.Acquire


MarkDown version: TranslationTranslations.md