# Translating Document Content

## What is Document Content Translation?

Document content translation in S-Docs lets you generate documents in multiple languages by translating picklist values, field labels, and related list content. This helps customers and stakeholders receive documents in their native language.

## How is Translation Used in S-Docs?

S-Docs provides two main patterns for translating document content:

* **`translate="true"`**: Use Salesforce translations for picklist values and field labels
* **`toLabel()`**: Return translated picklist labels in direct SOQL related lists

Use these patterns together to build translated documents that match your Salesforce language setup.

***

## Translate with Salesforce Translation Workbench

The Translation Workbench method leverages translations already defined in Salesforce, supporting field labels and picklist values.

**Supported translations:**

* All field labels (standard field labels are pre-translated; only custom field labels need translation)
* Picklist field values only (other field types are not supported by Translation Workbench)

**Note:** Translation Workbench does not translate arbitrary free-text field output.

### Step 1: Define translations in Salesforce

From Setup, type "Translation" in the Quick Find bar → click "Translate."

#### Translating Picklist Values

1. Set **Language** to your target language (e.g., German)
2. Set **Setup Component** to "Picklist Value"
3. Set **Object** to your object (e.g., Contact)
4. Scroll down and enter translations for your picklist values

#### Translating Field Labels

1. Set **Setup Component** to "Custom Field"
2. Set **Aspect** to "Field Label"
3. Enter your translations

Standard field labels already have translations in Salesforce, so you only need to translate custom field labels.

### Step 2: Enable translations at the template level

To use Translation Workbench translations in your documents:

1. From Setup → Object Manager → click "SDoc Template" object
2. Go to "Page Layouts" → click "Edit" for your layout
3. Drag the "Language" field into the "SDoc Template Detail" section → click "Save"
4. Go to "Fields & Relationships" → click "Language"
5. Scroll to "Values" → click "New"
6. Add the appropriate Salesforce language code → click "Save"

Now you can set the language directly on any template detail page by selecting the appropriate language code (e.g., 'DE' for German, 'FR' for French, 'ES' for Spanish).

### Step 3: Add the translate attribute to merge fields

Add the `translate="true"` attribute to merge fields and field labels you want translated.

**For picklist field data:**

html

```
{{!Contact.leadsource translate="true"}}
```

**For field labels:**

html

```
{{!Label.Contact.leadsource translate="true"}}
```

**Note:** Once you add the translate attribute to one instance of a merge field, all other instances of that same merge field in the document will also be translated, even without the attribute.

### Step 4: Add the `toLabel()` function to related lists

To translate picklist values in related lists, add the `toLabel()` function to the field in your SOQL query.

**Original related list:**

html

```
<!--{{!
<lineitemssoql>
<class>table873</class>
<soql>SELECT product2.name, color__c FROM opportunitylineitem WHERE opportunityid='{{!Opportunity.id}}'</soql>
<column>rownum</column>
<column>Product2.name</column>
<column>color__c</column>
</lineitemssoql>
}}-->
```

**With translation:**

html

```
<!--{{!
<lineitemssoql>
<class>table873</class>
<soql>SELECT product2.name, tolabel(color__c) FROM opportunitylineitem WHERE opportunityid='{{!Opportunity.id}}'</soql>
<column>rownum</column>
<column>Product2.name</column>
<column>color__c</column>
</lineitemssoql>
}}-->
```

The picklist column will now display translated values.

**For lookup fields or more complex translations**, use direct SOQL queries with the class set to "none":

html

```
<!--{{!
<LineItemsSOQL>
<class>none</class>
<soql>Select tolabel(color__c) From product2 where id='{!ObjectID15}' and toLabel(color__c) ='BLEU'</soql>
<column>color__c</column>
</LineItemsSOQL>
}}-->
```

This returns only the data without table formatting.

***

## Formatting International Characters

If your templates contain international characters (Japanese, Hebrew, Arabic, etc.), additional formatting may be required.

### Template Settings

1. Navigate to your template → go to "Document Options" tab
2. Check the box: **"Template contains international characters (Unicode fonts)"**
3. If characters still don't render correctly, set **Unicode Enforcement Level** to "Strict" to override font settings

### Right-to-Left Languages (RTL)

For languages like Arabic or Hebrew that read right-to-left:

#### Option 1: Use the rtl merge field attribute

html

```
{{!Account.Name rtl="true"}}
```

This transforms merge field data to right-to-left but does not affect static text.

#### Option 2: Use `<rtl>` tags in template source

html

```
<rtl>Your static text and {{!Account.Name}} here</rtl>
```

This transforms both merge field data and static text to right-to-left.

{% hint style="info" %}
For more information, feel free to reference the [RTF section of the Template Attribute Article](file:///8426358/template-authoring/template-attributes/getting-started-with-template-attributes-tutorial/template-attributes-complete-reference.md#rtl-right-to-left)
{% endhint %}

***

## Best Practices

* **Use the right pattern**: Use `translate="true"` for picklists and labels, and `toLabel()` for direct SOQL related lists
* **Test thoroughly**: Generate sample documents for each language to verify translations appear correctly
* **Consider the substitute attribute**: For complex related list translations, explore the substitute column attribute feature for additional flexibility
* **Set language at template level**: Configure the language setting on individual templates to ensure consistent translation behavior

### Related guides

* [Setup Translations](/sdocs/advanced-template-logic/translations.md)
* [How to Translate Merge Fields and Field Labels](/sdocs/advanced-template-logic/translations/translating-document-content-in-s-docs/how-to-translate-merge-fields-and-field-labels.md)
* [Document Content Translation Tutorial](broken://spaces/WKNnJmhJBQwhdk5WBFsi/pages/eDuxlkQ4qy9j6eR5s5js)

***

Translating document content in S-Docs ensures your global customers and stakeholders receive professional, localized documents that enhance their experience and build trust in your brand.

Related: <https://sdoc.atlassian.net/wiki/spaces/196609/pages/2717646849/?draftShareId=ab53618e-b56d-4344-be08-02aea512d35c>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.sdocs.com/sdocs/advanced-template-logic/translations/translating-document-content-in-s-docs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
