Skip to content

Commit 54970ce

Browse files
authored
Update string-transformations.md
Adding the GetLocalizedStringsTransformation claims transformation
1 parent a3119d5 commit 54970ce

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

articles/active-directory-b2c/string-transformations.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,75 @@ Use this claims transformation to format any string with two parameters, {0} and
358358
- Output claims:
359359
- **outputClaim**: Joe Fernando
360360

361+
## GetLocalizedStringsTransformation
362+
363+
Copies localized strings into claims.
364+
365+
| Item | TransformationClaimType | Data Type | Notes |
366+
| ---- | ----------------------- | --------- | ----- |
367+
| OutputClaim | The name of the localized string | string | List of claim types that is produced after this claims transformation has been invoked. |
368+
369+
To use the GetLocalizedStringsTransformation claims transformation:
370+
371+
1. Define a [localization string](localization.md) and associate it with a [self-asserted-technical-profile](self-asserted-technical-profile.md).
372+
1. The `ElementType` of the `LocalizedString` element must set to `GetLocalizedStringsTransformationClaimType`.
373+
1. The `StringId` is a unique identifier that you define, and use it later in your claims transformation.
374+
1. In the claims transformation specify the list of claims to be set with the localized string. The `ClaimTypeReferenceId` is a reference to a ClaimType already defined in the ClaimsSchema section in the policy. The `TransformationClaimType` is the name of the localized string as defined in the `StringId` of the `LocalizedString` element.
375+
1. In a [self-asserted technical profile](self-asserted-technical-profile.md), or a [display control](display-controls.md) input or output claims transformation, make a reference to your claims transformation.
376+
377+
378+
The following example looks up the email subject, body, your code message, and the signature of the email, from localized strings. These claims later used by custom email verification template.
379+
380+
Define localized strings for English (default) and Spanish.
381+
382+
```XML
383+
<Localization Enabled="true">
384+
<SupportedLanguages DefaultLanguage="en" MergeBehavior="Append">
385+
<SupportedLanguage>en</SupportedLanguage>
386+
<SupportedLanguage>es</SupportedLanguage>
387+
</SupportedLanguages>
388+
389+
<LocalizedResources Id="api.localaccountsignup.en">
390+
<LocalizedStrings>
391+
<LocalizedString ElementType="GetLocalizedStringsTransformationClaimType" StringId="email_subject">Contoso account email verification code</LocalizedString>
392+
<LocalizedString ElementType="GetLocalizedStringsTransformationClaimType" StringId="email_message">Thanks for verifying your account!</LocalizedString>
393+
<LocalizedString ElementType="GetLocalizedStringsTransformationClaimType" StringId="email_code">Your code is</LocalizedString>
394+
<LocalizedString ElementType="GetLocalizedStringsTransformationClaimType" StringId="email_signature">Sincerely</LocalizedString>
395+
</LocalizedStrings>
396+
</LocalizedResources>
397+
<LocalizedResources Id="api.localaccountsignup.es">
398+
<LocalizedStrings>
399+
<LocalizedString ElementType="GetLocalizedStringsTransformationClaimType" StringId="email_subject">Código de verificación del correo electrónico de la cuenta de Contoso</LocalizedString>
400+
<LocalizedString ElementType="GetLocalizedStringsTransformationClaimType" StringId="email_message">Gracias por comprobar la cuenta de </LocalizedString>
401+
<LocalizedString ElementType="GetLocalizedStringsTransformationClaimType" StringId="email_code">Su código es</LocalizedString>
402+
<LocalizedString ElementType="GetLocalizedStringsTransformationClaimType" StringId="email_signature">Atentamente</LocalizedString>
403+
</LocalizedStrings>
404+
</LocalizedResources>
405+
</Localization>
406+
```
407+
408+
The claims transformation sets the value of the claim type *subject* with the value of the string id *email_subject*.
409+
410+
```XML
411+
<ClaimsTransformation Id="GetLocalizedStringsForEmail" TransformationMethod="GetLocalizedStringsTransformation">
412+
<OutputClaims>
413+
<OutputClaim ClaimTypeReferenceId="subject" TransformationClaimType="email_subject" />
414+
<OutputClaim ClaimTypeReferenceId="message" TransformationClaimType="email_message" />
415+
<OutputClaim ClaimTypeReferenceId="codeIntro" TransformationClaimType="email_code" />
416+
<OutputClaim ClaimTypeReferenceId="signature" TransformationClaimType="email_signature" />
417+
</OutputClaims>
418+
</ClaimsTransformation>
419+
```
420+
421+
### Example
422+
423+
- Output claims:
424+
- **subject**: Contoso account email verification code
425+
- **message**: Thanks for verifying your account!
426+
- **codeIntro**: Your code is
427+
- **signature**: Sincerely
428+
429+
361430
## GetMappedValueFromLocalizedCollection
362431

363432
Looking up an item from a claim **Restriction** collection.

0 commit comments

Comments
 (0)