SimpleT Detect Language
SimpleT Detect Language provides automatic language detection services that you can use in Salesforce Flow and Apex code to identify what language text is written in. This AI-powered tool helps you automatically route content, trigger appropriate workflows, and make intelligent decisions based on the language of your text content.
SimpleT Language Detection Options:
- Flow-Based Language Detection: Enables users to set up language detection through straightforward, declarative tools, making automation simple and code-free for automated workflows.
- Apex-Based Language Detection: Provides developers with full programmatic control for detecting the language of text in custom applications and advanced integrations.
Setup
What You Can Do
Language Detection Capabilities
- Automatic Language Identification: Determine what language any text is written in
- Confidence Scoring: Get reliability scores for detection accuracy
- Multiple Language Results: See ranked list of possible languages
- Batch Text Analysis: Analyze multiple pieces of text efficiently
- Smart Content Routing: Route content based on detected language
- Real-Time Results: Get language identification immediately within your Flow or Apex code
When to Use Language Detection
- Customer Support: Route tickets based on customer's language
- Content Management: Automatically categorize documents by language
- Survey Analysis: Group feedback by language for targeted analysis
- Email Processing: Identify language of incoming emails for appropriate responses
- Social Media Monitoring: Analyze posts and comments by language
- Translation Preparation: Identify source language before translation
Detection Parameters Explained
Required Fields
Detection Engine
- What it is: Which language detection service to use
- Available Options (configured by admin):
- "ST Google Translate Default" - Google Cloud Translation (high accuracy)
- "ST DeepL Default" - DeepL language detection (high accuracy for European languages)
- "ST AWS Default" - Amazon Comprehend (cost-effective)
- "ST AI Default" - AI-powered detection (context-aware)
- Custom engines as configured by your administrator
- How to Choose: Ask your administrator which engines are available and recommended for your use case
List of Source Texts
- What it is: The text content you want to analyze for language
- Format: List of text strings
- Examples:
- Single text: ["Hello, how are you today?"]
- Multiple texts: [{!email1Text}, {!email2Text}, {!email3Text}]
- From records: [{!$Record.Description}, {!$Record.Comments__c}]
- Character Limits: Varies by detection engine (typically 1000-10000 characters per text)
Understanding Detection Results
Result Structure
The detection returns detailed information about each text you submitted:
detectionResults[0].detected_lan[0].Languages[0].Score - Confidence score
detectionResults[0].detected_lan[0].TextIndex - Which text this result belongs to
Multiple Language Results
Detection often returns several possible languages ranked by confidence:
Secondary: {!detectionResults[0].detected_lan[0].Languages[1]}
Tertiary: {!detectionResults[0].detected_lan[0].Languages[2]}
APEX-Based Language Detection
To use the ST_DetectLanguageInvocable class and its st_getSourceLanguage method, create a list of ST_DetectLanguageWrapper 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:
// Create a list of strings in which we will add the texts we would like to detect the language of.
List<String> texts = new List<String>();
// Add texts to the list.
texts.add('Hello');
texts.add('Help');
// Create the ST_DetectLanguageWrapper object, which will contain all the required data for the language detection callout.
simpleT.ST_DetectLanguageWrapper stDetectLanguageWrapper = new simpleT.ST_DetectLanguageWrapper();
// Add the prepared list of texts to the wrapper object.
stDetectLanguageWrapper.texts = texts;
// Select engine for language detection.
stDetectLanguageWrapper.engine = 'ST Google Translate Default';
// Create a list of ST_DetectLanguageWrapper objects because invocable methods must have parameters set up as a list.
List<simpleT.ST_DetectLanguageWrapper> detectLanguageWrappers = new List<simpleT.ST_DetectLanguageWrapper>();
// Add previously created wrapper to the list.
detectLanguageWrappers.add(stDetectLanguageWrapper);
// Call the ST_DetectLanguageInvocable.stDetectLanguages method and send the created list of detectLanguageWrappers.
List<ST_DetectLanguageResponseWrapper> resultWrappers = ST_DetectLanguageInvocable.stDetectLanguages(detectLanguageWrappers);

FLOW-Based Language Detection
- Navigate to "Salesforce Flows" to enable language detection.
- Create a new flow or modify an existing one.
- For record-triggered flows, select "Optimize the Flow for Actions and Related Records."
- Set the flow to run asynchronously.
- Use the language detection functionality in Flow Actions.
- In the Flow Action search bar, type "Simple Translate Source Language detection".
- "Simple Translate Source Language Detection" detects the language of the given text.
- The method takes a List<ST_DetectLanguageWrapper> parameter. See the "ST_DetectLanguageWrapper Class" section below for more details.

ST_DetectLanguageWrapper Class
- Encapsulates detected_lan, engine, and texts.
- Required: engine and texts.
- Available engines: ST AWS Default, ST Google Translate Default, ST DeepL Default.
- Check supported language ISO codes per engine in the Simple Translate app.
- detected_lan is a list of ST_DetectLanguageResponseWrapper.Detected_lan objects. Each object contains a languageCode and a score indicating detection confidence.

Practical Examples
Example 1: Customer Support Ticket Routing
Scenario: Automatically route support tickets based on customer language
Trigger: When Case is Created
Variables:
- ticketText: {!$Record.Description}
Language Detection:
- Detection Engine: "ST Google Translate Default"
- List of Source Texts: ["{!ticketText}"]
Decision Logic:
High Confidence (Score > 0.8):
- English: Route to General Support Queue
- Spanish: Route to Spanish Support Queue
- French: Route to French Support Queue
- Other: Route to Multilingual Queue
Medium/Low Confidence (Score ≤ 0.8):
- Route to Multilingual Queue for manual language verification
Update Records:
- Case.Detected_Language__c: {!detectionResults[0].detected_lan[0].Languages[0].LanguageCode}
- Case.Detection_Confidence__c: {!detectionResults[0].detected_lan[0].Languages[0].Score}
Example 2: Survey Response Language Analysis
Scenario: Group survey responses by language for targeted analysis
Trigger: Survey Response Submitted
Variables:
- responseText: {!$Record.Comments__c}
Language Detection:
- Detection Engine: "ST AWS Default"
- List of Source Texts: ["{!responseText}"]
Actions Based on Language:
- English: Trigger English sentiment analysis
- Spanish: Trigger Spanish sentiment analysis
- French: Trigger French sentiment analysis
- Other Languages: Add to manual review queue
Update Records:
- Survey_Response__c.Language__c: {!detectedLanguage}
- Survey_Response__c.Analysis_Status__c: "Queued for Analysis"
Example 3: Email Language Identification
Scenario: Identify language of incoming emails for appropriate auto-responses
Trigger: Email-to-Case Process
Variables:
- emailBody: {!$Record.Description}
- emailSubject: {!$Record.Subject}
Language Detection:
- Detection Engine: "ST AI Default"
- List of Source Texts: ["{!emailBody}"]
Confidence-Based Actions:
High Confidence (> 0.9):
- Set Case language preference
- Send auto-response in detected language
- Route to language-specific agent
Medium Confidence (0.7-0.9):
- Set tentative language preference
- Send multilingual auto-response
- Flag for language confirmation
Low Confidence (< 0.7):
- Send generic multilingual response
- Route to general multilingual support
- Request language preference from customer
Example 4: Document Classification
Scenario: Automatically classify uploaded documents by language
Trigger: Document Uploaded
Variables:
- documentContent: {!$Record.Content_Text__c}
- documentTitle: {!$Record.Title}
Language Detection:
- Detection Engine: "ST Google Translate Default"
- List of Source Texts: ["{!documentContent}"]
Classification Logic:
Based on Detected Language:
- English: Add to English document library
- Spanish: Add to Spanish document library
- French: Add to French document library
- German: Add to German document library
- Multi-language (low confidence): Add to review queue
Update Records:
- Document.Primary_Language__c: {!detectedLanguage}
- Document.Detection_Confidence__c: {!confidenceScore}
- Document.Classification_Status__c: "Auto-Classified"
Working with Detection Results
Understanding the Output Structure
detectionResults[0].detected_lan[0].Languages[0].Score - Confidence score
detectionResults[0].detected_lan[0].TextIndex - Which text this result belongs to
Using Results in Different Flow Elements
- Update Records: Store detected language in custom fields
- Decision Elements: Route based on detected language or confidence
- Create Records: Generate language-specific records
- Send Email: Use detected language for appropriate responses
Best Practices
Writing Better Text for Detection
- Use Complete Sentences: Full sentences provide more context for accurate language detection
- Include Context: Add relevant context words that are language-specific
- Avoid Mixed Languages: Keep text in one language per detection for best results
- Minimum Text Length: Use at least 10-20 words for reliable detection
Troubleshooting Guide
Poor Detection Accuracy
- Increase Text Length: Longer text generally improves accuracy
- Clean Text Content: Remove formatting, special characters
- Try Different Engine: Some engines perform better for specific languages
- Check Text Quality: Ensure text is complete sentences, not fragments
Getting Help
- Flow Debug: Use Flow Builder's debug feature to trace detection
- Error Messages: Save detailed error information for administrator review
- Administrator: Contact Salesforce administrator for configuration issues
This guide provides everything you need to effectively use language detection in your Salesforce automation workflows. Start with simple detection scenarios and gradually build more sophisticated multilingual processes as you become comfortable with the confidence scoring and result handling capabilities.