Salesforce中Conga报价单模板基于报价单语言字段的多语言翻译方案咨询
Great question—let’s break down your options for translating Conga quote templates based on a quote’s language field, especially since Salesforce’s standard Translation Workbench and Custom Labels are tied to the user’s context (which isn’t what you need here).
Option 1: Custom Metadata (Your Proposed Idea) – Highly Recommended
This is absolutely a viable, flexible, and maintainable approach. Here’s how to implement it:
- Create a Custom Metadata Type (e.g.,
Conga_Template_Translation__mdt) with these fields:Language_Code__c(Text, 5 chars): Store ISO language codes likeen-US,fr-FR, matching the values on your quote’s language field.Template_Key__c(Text): A unique identifier for each translatable element in your Conga template (e.g.,quote_header_subtitle,terms_and_conditions_body).Translated_Content__c(Long Text Area): The full translated text for that key and language.
- Populate this metadata with all 18 languages and their corresponding translations for every template element.
- In your Conga template, use a custom Apex helper method to fetch the correct translation. For example:
- Write an Apex method like this:
public class CongaTranslationHelper { public static String getTranslation(String languageCode, String templateKey) { Conga_Template_Translation__mdt translation = [ SELECT Translated_Content__c FROM Conga_Template_Translation__mdt WHERE Language_Code__c = :languageCode AND Template_Key__c = :templateKey LIMIT 1 ]; return translation != null ? translation.Translated_Content__c : 'Default Text'; } } - Call the method in your Conga template using the quote’s language field:
{!$Apex.CongaTranslationHelper.getTranslation(Quote.Language__c, 'quote_header_subtitle')}
- Write an Apex method like this:
Pros:
- Fully independent of user language settings—translations are tied directly to the quote’s language field.
- Easy to update: Edit metadata records instead of modifying templates or user profiles.
- Supports long-form content (like terms and conditions) that exceeds Custom Label character limits.
Option 2: Custom Labels + Translation Workbench (With Dynamic Fetching)
While Translation Workbench is user-context based, you can bypass that by using Apex to fetch label translations for a specific language code directly:
- Set up your Custom Labels and translate them via Translation Workbench for all 18 languages.
- Create an Apex helper method to retrieve the translated label value:
public class LabelTranslationHelper { public static String getLabelTranslation(String labelName, String languageCode) { return Translation.get(labelName, languageCode); } } - Call this method in your Conga template:
{!$Apex.LabelTranslationHelper.getLabelTranslation('Quote_Header_Title', Quote.Language__c)}
Pros:
- Reuses your existing Salesforce translation ecosystem if you already have labels translated.
- No need to manage a separate metadata store.
Cons:
- Custom Labels have a 1,000-character limit, so they’re not ideal for long sections of text.
Option 3: Multi-Language Conga Templates (For Layout-Heavy Content)
If your templates have significant layout differences across languages (e.g., right-to-left formatting for Arabic), creating separate templates for each language might make sense:
- Duplicate your base template 17 times, one for each target language.
- Translate and adjust the layout directly in each template.
- Use Conga’s built-in logic (via formula or custom button) to select the correct template based on the quote’s language field when generating the document.
Pros:
- Full control over layout and formatting for each language.
- No need for complex Apex or metadata queries.
Cons:
- High maintenance overhead: Any change to the template structure requires updating all 18 versions.
Final Verdict on Custom Metadata
Yes, using Custom Metadata is absolutely a solid solution for your use case. It balances flexibility, maintainability, and independence from user context—perfect for translating 18 languages tied directly to the quote’s language field.
内容的提问来源于stack exchange,提问作者bksfdc

