<aside>

Description

SimpleT Detect Language provides automatic language identification for Salesforce Flows and Apex code. It returns confidence scores and ranked language results to support content routing, workflow triggering, and multilingual processing.

</aside>

SimpleT Language Detection Options

Setup

Use these guides to prepare your org before using SimpleT Detect Language:

What You Can Do

Language detection capabilities

When to use language detection

Detection Parameters Explained

Required fields

Detection Engine

List of Source Texts

Understanding Detection Results

Result structure

Each detection result includes details for each submitted text:

detectionResults[0].detected_lan[0].Languages[0].LanguageCode  // primary language
 detectionResults[0].detected_lan[0].Languages[0].Score         // confidence score
 detectionResults[0].detected_lan[0].TextIndex                  // which input text

Multiple language results

Detection often returns several possible languages ranked by confidence:

Primary (highest confidence):   {!detectionResults[0].detected_lan[0].Languages[0]}
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 method, create a list of ST_DetectLanguageWrapper items with the required data.

For details on ST_DetectLanguageWrapper, see the class section below.

// Create a list of text values whose language you want to detect.
List<String> texts = new List<String>();

// Add texts to the list.
texts.add('Hello');
texts.add('Help');

// Create the wrapper that holds all data for the language detection callout.
simpleT.ST_DetectLanguageWrapper stDetectLanguageWrapper =
	new simpleT.ST_DetectLanguageWrapper();

// Add the prepared list of texts to the wrapper.
stDetectLanguageWrapper.texts = texts;

// Select the engine for language detection.
stDetectLanguageWrapper.engine = 'ST Google Translate Default';

// Invocable methods require a list of wrappers.
List<simpleT.ST_DetectLanguageWrapper> detectLanguageWrappers =
	new List<simpleT.ST_DetectLanguageWrapper>();

detectLanguageWrappers.add(stDetectLanguageWrapper);

// Call the invocable method and pass the list of wrappers.
List<ST_DetectLanguageResponseWrapper> resultWrappers =
	ST_DetectLanguageInvocable.stDetectLanguages(detectLanguageWrappers);

invocableDetectLanguageClass.png

Flow-based language detection

  1. Go to Salesforce Flows.
  2. Create a new Flow or modify an existing one.
  3. For record-triggered Flows, select Optimize the Flow for Actions and Related Records.
  4. Set the Flow to run asynchronously.
  5. Add a Flow Action for language detection.
  6. In the Action search bar, type Simple Translate Source Language detection.
  7. Use Simple Translate Source Language Detection to detect the language of the input text.
  8. The action accepts a List<ST_DetectLanguageWrapper> parameter (see the wrapper section below).

langDetectionFlow.png

ST_DetectLanguageWrapper class

detectionLangWrapper.png

Practical examples

Example 1: Customer support ticket routing

Scenario: Automatically route support tickets based on the customer's language.

Flow setup

Example 2: Survey response language analysis

Scenario: Group survey responses by language.

Example 3: Email language identification

Scenario: Identify the language of incoming emails for appropriate auto-responses.

Example 4: Document classification

Scenario: Automatically classify uploaded documents by language.