Hi all, for our Descope flow Im currently checking...
# ask-a-descoper
t
Hi all, for our Descope flow Im currently checking error handling. I dont see how to handle translations in errors. For example in an if/else I treat the else as an error. But the error message doesnt pop up in the list of values (localization-> flows and widgets) which I can translate. This means that no matter what language I choose, the error will be shown in English (or language I create the message in). I also tried with gobal strings, but then its just returning {{strings.non_existing_user}} for example and not a translation. Anyone who can help me with this? Thanks!
✅ 1
d
Error Message Translation in Flows For custom error messages in if/else conditions, you have two main approaches to handle translations. Using Global Strings 1. Create your error messages as global strings in the Global Strings section 2. Reference them in your flow conditions using
{{strings.your_key}}
syntax 3. Ensure your flow has localization enabled with a translation connector configured
Copy code
// In Global Strings section:
Key: non_existing_user
English: "User does not exist"
Spanish: "El usuario no existe"
// In your flow condition error message:
{{strings.non_existing_user}}
Flow-Level Localization Custom error messages from conditions should appear in the localization section once you: 1. Configure a localization connector for your flow (Google Cloud Translation, AWS Translate, etc.) 2. Enable translation for the flow with source and target languages 3. The connector will automatically translate your custom error messages Troubleshooting Global Strings If
{{strings.non_existing_user}}
displays literally instead of translating, verify: • The global string key exists and matches exactly • Your flow references global strings (check the
referencesGlobalStrings
property) • The locale is properly set in your component or browser The global strings approach gives you more control over translations, while flow-level localization with connectors provides automatic translation of all flow content . Customizing Localization | Descope Documentation Google Cloud Translation Connector | Descope Documentation Localization Connectors | Descope Documentation List/Search Flows | API Reference | Descope Documentation Descope Component Guide | Client SDK | Descope Documentation
t
And how to set that
referencesGlobalStrings
property?
d
Setting referencesGlobalStrings Property The
referencesGlobalStrings
property is automatically set by Descope when your flow contains global string references. Automatic Detection 1. Add global string references to your flow using
{{strings.your_key}}
syntax in any component 2. Descope automatically detects these references and sets
referencesGlobalStrings: true
3. No manual configuration is required Where to Use Global Strings • Error messages in conditions and actions • Text content in screens and components • Custom validation messages • Any text field that supports template syntax
Copy code
// Examples that trigger automatic detection:
{{strings.welcome_message}}
{{strings.error_invalid_user}}
{{strings.button_continue}}
Verification You can verify the property is set by checking your flow via the Management API, but this is primarily for debugging purposes. The key is simply using the
{{strings.}}
syntax anywhere in your flow - Descope handles the rest automatically . If global strings still aren't resolving, ensure the keys exist in your Global Strings section and match exactly (case-sensitive). Customizing Localization | Descope Documentation
a
Hi @Timo Heuts To narrow this down can you confirm: 1. Does the key
non_existing_user
exist exactly as-is in your Global Strings? 2. Do you have a localization connector configured on this flow? 3. Are you passing the
locale
attribute to your Descope component (e.g.,
<descope-wc locale="nl">
) ? If all three are set up correctly and it's still showing literally, it may be that the error is being returned from a step that exits before global string resolution. In that case, the workaround is to use a Set Attribute action to set the error text before routing to a screen component — that way the screen component handles localization properly.
t
Hi, I configured as in image. Im using manual translations. Am I obliged to use a connector? Also when adding console.log('{{strings.non_existing_user}}') in a step before, its just returning plain text {{strings.non_existing_user}}. Im running the flow in Descope flow builder itself. When I add plain text in the error message its returned so with that Im sure its just not replacing the error message.
a
No, a connector is not required — manual translations work perfectly fine.
The key thing to know is that
{{strings.key}}
is resolved by the Descope web component on the client side, not by the flow engine. So: •
console.log('{{strings.non_existing_user}}')
will always show the literal string — this is expected. • The flow builder preview doesn't simulate client-side localization, so it won't resolve there either To test properly, deploy your flow and test it in your actual app with the Descope web component (
<descope-wc>
), making sure to pass the
locale
attribute (e.g.,
locale="nl"
). The global string should resolve correctly there. Also double-check that your error message from the if/else condition is being passed to a screen component that's what picks up the
{{strings.key}}
and renders it translated. If the flow exits before hitting a screen, the substitution won't happen.
@Timo Heuts Is the issue resolved now ?
t
unfortunatly not. If I add for example the {{strings.non_existing_user}} in a text of a page in the flow, its visible. But once the error is triggered its just showing {{strings.non_existing_user}}
image.png,image.png
I found a workaround, where I duplicate the login screen basicly. If the error needs to be shown, Im not treating it as error but I will send the user to the login screen where I code the {{strings.non_existing_user}}, which shows the correct translation. The user can try to login again and the same validation step will be retriggered
a
Great! The only downside is maintaining duplicate screens as your flow grows. If that becomes a pain, the
errorTransformer
on the client SDK side is the cleaner long-term solution — you keep a single screen, set the error message field to a plain key (e.g.
non_existing_user
), and handle all translations in one place in your frontend code. But if the current workaround works for your use case, no need to change anything.
t
cool, thanks for your help. Im maintaining a duplicate of the flow anyway, because I have one project for test and one for prod. Thanks for your help!
a
Happy to help, and glad you found a solution that works! Feel free to reach out if anything else comes up.
🙌 1