Logic Composer
Localized resources
Store user-facing text once in every language your users speak, and show each user the text in their own language.
A localized resource is one piece of user-facing text, such as an error message, an email subject or a notification, with a translation for each language. Your logic refers to the resource by name, and at run time it gets the text in the language of the user it runs for. You keep translations out of your blocks and flows, and translators can update them without touching the logic.
One localized resource holds one text in several languages. For a family of messages, create one resource per message and give them a common name prefix, such as Quote_DiscountTooHigh and Quote_MissingPriceList.
Create a localized resource
Section titled “Create a localized resource”- Go to Logic FabricSettingsLocalized Resources and select New.
- Enter a Name and choose the Project.
- In the Resource section, the Value editor shows one text box for each language available in your environment. Enter the text for each language your users use.
- Save the form.
The editor lists the languages that are enabled in the Dataverse environment, by name; you never enter language codes. If a language is enabled later, it appears with an empty box, and the existing translations are kept.
Use a resource in logic
Section titled “Use a resource in logic”In the expression editor, open the Localized Value category and choose Localized Resource. Pick the resource by name and, optionally, a Language:
- Without a language, the text is returned in the UI language of the current user.
- With a language, the text is returned in that language, whatever the user’s own setting. Use this for text that goes to someone else, for example an email to a customer whose preferred language you know.
Insert values into the text
Section titled “Insert values into the text”To include values such as an amount or a name, write numbered placeholders in every translation and fill them with the Format function:
| Name | English | French |
|---|---|---|
Quote_DiscountTooHigh |
Discount of {0}% exceeds your limit of {1}%. |
La remise de {0} % dépasse votre limite de {1} %. |
Use Format with the Localized Resource Quote_DiscountTooHigh as the text to format, and DiscountPercent and MaxDiscount as the values. The result is the sentence in the user’s language with both numbers filled in. Every placeholder needs a value: a placeholder without a matching value makes the run fail. See text functions.
Where to use localized text
Section titled “Where to use localized text”- Flows: in the Error Message of the Raise Error step, in email subjects and bodies, in notes and tasks you create, and in any step setting that takes text.
- Logic blocks: in formulas and in decision table and tree outcomes that return text.
- Validations in recipes: when a validation in a recipe’s Validation stage fails, the user sees the block’s name, or the names of the failed rules for a validation set, not a localized resource. To use translated text, check the rule in a flow instead and put the localized text in the Error Message of its Raise Error step. See Logic recipes.
How it behaves
Section titled “How it behaves”- If a resource has no text for the requested language, the result is empty text. There is no fallback to another language, so fill in every language your users use.
- A localized resource that a logic block, logic flow or logic recipe uses cannot be deleted (“Localized resource entry is in use. Remove all dependencies before deleting.”).
- Translations can differ per environment. With the CLI’s data map files you can set them for each environment when you deploy; see Data mapping.
- In a project whose solution is managed, the resource opens read-only.
Example: bilingual quote messages
Section titled “Example: bilingual quote messages”A company in the Gulf serves customers in English and Arabic. Both languages are enabled in the environment.
- Create the resource
Quote_DiscountTooHighwith the English textDiscount of {0}% exceeds your limit of {1}%.and its Arabic translation, keeping both placeholders. - Create
Quote_ApprovedEmailSubjectwithYour quote {0} is approvedand its Arabic translation. - In the flow that checks quote discounts, add Raise Error with the error code
DISCOUNT_LIMITand an Error Message built with Format fromQuote_DiscountTooHigh,DiscountPercentandMaxDiscount. The message is produced in the UI language of the user the flow runs for. - In the approval flow, build the email subject with Localized Resource and its Language set to Arabic for customers who prefer Arabic, so they get an Arabic subject even when an English-speaking manager approves the quote.