SimpleT Translate

SimpleT Translate provides automatic translation services that you can use in both Salesforce Flow and Apex code to translate text into multiple languages. This powerful tool enables you to create automated workflows and custom applications that handle multilingual content without manual intervention.

SimpleT Translation Options:

  • Flow-Based Translation: Enables easy, no-code translation setup using declarative tools for automated workflows.
  • Apex-Based Translation: Provides full programmatic control with custom logic and code for translations in custom applications.

What You Can Do

Translation Capabilities

  • Multi-Language Translation: Convert text into dozens of languages simultaneously
  • Automatic Language Detection: System can identify source language automatically
  • Bulk Processing: Translate multiple pieces of text in one operation
  • Engine Selection: Choose from different translation services for optimal quality
  • Real-Time Results: Get translations immediately within your Flow or Apex code

Translation Parameters Explained

Required Fields

Source Text

  • What it is: The text you want to translate
  • Examples:
    • "Hello, how can I help you today?"
    • Case description tifield: {!$Record.Description}
    • User input: {!textInput}
  • Character Limits: Varies by translation engine (typically 1000-5000 characters)

Target Languages

  • What it is: List of languages you want translations in
  • Format: ISO language codes (2-letter format)
  • Examples:
    • Single language: ["es"] (Spanish)
    • Multiple languages: ["es", "fr", "de", "it"] (Spanish, French, German, Italian)
    • Dynamic list: {!userLanguagesList} (from records or calculations)

Translation Engine

  • What it is: Which translation service to use
  • Available Options (configured by admin):
    • "ST Google Translate Default" - Google Translate (general purpose, good for most languages)
    • "ST DeepL Default" - DeepL (high accuracy for European languages)
    • "ST AI Default" - AI-powered translation (context-aware, maintains tone)
    • "ST AWS Default" - Amazon Translate (cost-effective, reliable)
    • Custom engines as configured by your administrator
  • How to Choose: Ask your administrator which engines are available and recommended for your use case

Optional Fields

Source Language

  • What it is: The language of your original text
  • When to Use:
    • Leave blank for automatic detection (recommended)
    • Specify when you're certain of the source language
    • Required for some specialized engines
  • Examples: "en" (English), "es" (Spanish), null (auto-detect)

APEX-Based Translation

To use st_translate method, create a List<ST_TranslationJobWrapper> with the required data.
For more information about the ST_DetectLanguageWrapper class, see the section below.

The code below provides an example of how to use the st_translate method:

//Created a new instance of the ST_TranslationJobWrapper object, which will hold translation job details.
simpleT.ST_TranslationWrapper wrapper = new simpleT.ST_TranslationWrapper();
//Created a list of target languages for translation.
List<String> targetLanguages = new List<String>();
//Added 'de' and 'hr' to the targetLanguages list as the target language for translation.
targetLanguages.add('de');
targetLanguages.add('hr');
//Assigned the list of target languages to the wrapper's targetLanguages attribute.
wrapper.targetLanguages = targetLanguages;
//Set the source language for translation.
wrapper.sourceLanguage = 'en_US';
//Set the translation engine to use for this translation job.
wrapper.engine = 'ST Google Translate Default';
//Set the Salesforce component flag to indicate the request originates from a Salesforce context
wrapper.salesforceComponent = true;
//Added the text that will be translated (including HTML content) to the wrapper.
wrapper.text = '<hello><div><br>Simple Translate helps to simplify translation</br></div></hello>';
//Created a list of ST_TranslationJobWrapper objects, which is necessary because invocable methods require a list as a parameter.
List<simpleT.ST_TranslationWrapper> translationWrappers = new List<simpleT.ST_TranslationWrapper>();
translationWrappers.add(wrapper);
//Called the st_translate method to start the translation using the provided list of translation wrappers.
//It will return the translated text for all selected target languages.
simpleT.ST_TranslateInvocable.stTranslate(translationWrappers);
The picture shows us the apex-based language detection class.

FLOW-Based Translation

  1. Navigate to "Salesforce Flows" to enable real-time data translation.
  2. Create or modify a flow.
  3. For record-triggered flows, select "Optimize the Flow for Actions and Related Records".
  4. Set the flow to run asynchronously.
  5. Use the data translation functionality in Flow Actions.
  6. In the Flow Action search bar, type "Simple Translate RealTime Data Translation".
  7. Use the "Simple Translate Real-Time Translation" method to translate text.
  8. The method takes a List<ST_TranslationWrapper> parameter.
The picture shows us the flow-based translation panel.

ST_TranslationWrapper Class

  • Encapsulates targetLanguages, sourceLanguage, engine, text, and translations.
  • Required: targetLanguages, engine, and text.
  • Available engines: ST AWS Default, ST Google Translate Default, ST DeepL Default.
  • Check supported language ISO codes per engine in the Simple Translate app.
  • translations is a list of ST_TranslationResponseWrapper objects with translated text and language details.
Illustration of the ST_TranslationWrapper class.

Practical Examples

Example 1: Customer Support Ticket Translation

Scenario: Automatically translate customer tickets to agent's language

Flow Setup:
Trigger: When Case is Created
Variables:
- agentLanguage: {!$Record.Owner.LanguageLocaleKey}
- ticketDescription: {!$Record.Description}

Translation Action:
- Source Text: {!ticketDescription}
- Target Languages: {!agentLanguage}
- Translation Engine: "ST Google Translate Default"
- Source Language: [Leave blank for auto-detection]

Update Records:
- Field: Translated_Description__c
- Value: {!translationResults[0].translations[0].text}

Example 2: Multi-Language Email Campaign

Scenario: Send campaign emails in customer's preferred language

Flow Setup:
Trigger: Scheduled Flow (Daily)
Get Records: Customers with upcoming renewals

Loop Through Customers:
Translation Action:
- Source Text: {!emailTemplate}
- Target Languages: {!$Record.Language_Preference__c}
- Translation Engine: "ST DeepL Default"
- Source Language: "en"

Send Email:
- Body: {!translationResults[0].translations[0].text}
- Recipient: {!$Record.Email}

Example 3: Knowledge Base Auto-Translation

Scenario: Automatically create translated versions of help articles

Flow Setup:
Trigger: When Knowledge Article Status = "Published"
Variables:
- supportedLanguages: ["es", "fr", "de", "it", "pt"]

Loop Through Languages:
Translation Action:
- Source Text: {!$Record.Body__c}
- Target Languages: {!currentLanguage}
- Translation Engine: "ST Google Translate Default"
- Source Language: "en"

Create Records:
- Object: Knowledge_Translation__c
- Article_Id__c: {!$Record.Id}
- Language__c: {!currentLanguage}
- Translated_Body__c: {!translationResults[0].translations[0].text}
- Status__c: "Auto-Generated"

Working with Translation Results

Understanding the Output Structure

translationResults[0].translations[0].text - First translation text
translationResults[0].translations[0].language - Target language code
translationResults[0].translations[1].text - Second translation (if multiple targets)

Handling Multiple Target Languages

Loop Through: {!translationResults[0].translations}
Current Item: {!currentTranslation}
Access:
- Text: {!currentTranslation.text}
- Language: {!currentTranslation.language}

Using Results in Different Flow Elements

  • Update Records: Store translations in custom fields
  • Send Email: Use translated text in email body
  • Create Records: Generate translation records for each language
  • Decision Elements: Route based on translation success/failure
  • Display Text: Show translations to users in Screen elements

Best Practices

Performance Optimization

  • Batch Requests: Translate multiple items together rather than one by one
  • Cache Results: Store frequently used translations to avoid repeated API calls
  • Async Processing: Use scheduled flows for large translation jobs
  • Character Limits: Keep text under 1000 characters for best performance

Quality Management

  • Engine Selection: Choose appropriate engine for content type and accuracy needs
  • Source Language: Specify source language when known for better accuracy
  • Review Process: Implement approval process for critical translations
  • Feedback Loop: Track translation quality and adjust engines as needed

Security Considerations

  • Sensitive Data: Be cautious with confidential information in translations
  • Data Retention: Understand how long translation services retain your data
  • Compliance: Ensure translation services meet your organization's compliance requirements
  • Audit Trail: Log translation activities for compliance and troubleshooting

Best Practices

Writing Better Source Text

  • Clear Context: Include relevant context in your source text for better translation accuracy
  • Complete Sentences: Use full sentences rather than fragments
  • Avoid Ambiguity: Be specific about meaning when words have multiple interpretations
  • Technical Terms: Define specialized terms or provide context for industry-specific language

Troubleshooting Guide

Poor Translation Quality

  1. Specify Source Language: Don't rely on auto-detection for critical content
  2. Try Different Engine: Some engines perform better for specific language pairs
  3. Break Up Long Text: Shorter segments often translate more accurately
  4. Review Context: Provide additional context for technical or specialized terms

Getting Help

  • Flow Debug: Use Flow Builder's debug feature to trace execution
  • Error Messages: Save detailed error information for administrator review
  • Administrator: Contact your Salesforce administrator for configuration issues
  • Documentation: Refer to this guide and Salesforce Flow documentation

This guide provides the foundation for using SimpleT Translate effectively in your Salesforce automation workflows. Start with simple examples and gradually build more complex multilingual processes as you become comfortable with the translation capabilities.