Azure B2C custom policy - Language Customization

Ashutosh Rath 6 Reputation points
2022-03-15T04:46:29.013+00:00

I have been using the latest page kayout version 2.1.10, in my custom policy but still the placeholders in the sign up page don't get translated to appropriate language. Kindly have a look into this.

183069-screenshot-2022-03-14-180552.png

Microsoft Entra External ID
Microsoft Entra External ID
A modern identity solution for securing access to customer, citizen and partner-facing apps and services. It is the converged platform of Azure AD External Identities B2B and B2C. Replaces Azure Active Directory External Identities.
3,017 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. AmanpreetSingh-MSFT 56,751 Reputation points
    2022-03-16T10:48:01.14+00:00

    Hi @Ashutosh Rath • Thank you for reaching out.

    Looks like the problem is not with the page layout version 2.1.10 as the translation works correctly with the same page layout version in built-in user flows. The problem occurs only with Custom Policy and using the page layout version lower than 2.1.10 doesn't help either. I will engage the product team to address this issue but it may take a long time to roll out the fix.

    In the meantime, as a workaround, you can localize the strings in the languages that you want to use. If you are using the latest Starter Pack, you need to update the TrustFrameworkLocalization.xml file as mentioned below:

    1. Update the api.localaccountsignup ContentDefinition with the language that you want to use:
        <ContentDefinition Id="api.localaccountsignup">  
          <LocalizedResourcesReferences MergeBehavior="Prepend">  
            <LocalizedResourcesReference Language="en" LocalizedResourcesReferenceId="api.localaccountsignup.en" />  
      	  <LocalizedResourcesReference Language="hi" LocalizedResourcesReferenceId="api.localaccountsignup.hi" />  
            <!-- Add more languages here -->  
          </LocalizedResourcesReferences>  
        </ContentDefinition>  
      
    2. Add the language that you want to use as SupportedLanguage.
      <Localization Enabled="true">  
        <SupportedLanguages DefaultLanguage="en" MergeBehavior="Prepend">  
          <SupportedLanguage>en</SupportedLanguage>  
          <SupportedLanguage>hi</SupportedLanguage>  
        </SupportedLanguages>  
      
    3. Define the localized strings that you want.
        <!--Local account sign-up page Hindi-->  
        <LocalizedResources Id="api.localaccountsignup.hi">  
          <LocalizedStrings>  
      	  <LocalizedString ElementType="ClaimType" ElementId="newPassword" StringId="DisplayName">नया पासवर्ड</LocalizedString>  
            <LocalizedString ElementType="ClaimType" ElementId="reenterPassword" StringId="DisplayName">नए पासवर्ड की पुष्टि करें </LocalizedString>  
      	  <LocalizedString ElementType="ClaimType" ElementId="givenName" StringId="DisplayName">पहला नाम</LocalizedString>  
            <LocalizedString ElementType="ClaimType" ElementId="displayName" StringId="DisplayName">प्रदर्शित होने वाला नाम</LocalizedString>  
            <LocalizedString ElementType="ClaimType" ElementId="email" StringId="DisplayName">ईमेल पता</LocalizedString>  
            <LocalizedString ElementType="ClaimType" ElementId="surname" StringId="DisplayName">उप नाम</LocalizedString>  
          </LocalizedStrings>  
        </LocalizedResources>  
      

    Once the above steps are done, you will get the specified fields translated when used with ui_locales=hi parameter, as shown below:

    183741-image.png

    -----------------------------------------------------------------------------------------------------------

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.


  2. Andrew Campbell 1 Reputation point
    2022-07-14T04:54:20.59+00:00

    Hi @AmanpreetSingh-MSFT :

    Thanks for your help in advance. I'm facing a similar issue to @Ashutosh Rath using Azure B2C Localization with custom policies.

    I can't localise the placeholder text of input fields for Claims that use "Password" UserInputTypes.
    Please note that we've successfully implemented Localization for everything else - it is just the placeholders that aren't customisable.

    Here's how the input field appears for the "newPassword" claim:

    220559-image.png

    Here's are the localization elements that I'm using:

    <LocalizedStrings>  
    				<LocalizedString ElementType="ClaimType" ElementId="newPassword" StringId="DisplayName">Password DisplayName</LocalizedString>  
    				<LocalizedString ElementType="ClaimType" ElementId="newPassword" StringId="PatternHelpText">Password PatternHelpText</LocalizedString>  
    				<LocalizedString ElementType="ClaimType" ElementId="newPassword" StringId="AdminHelpText">Password AdminHelpText</LocalizedString>  
    				<LocalizedString ElementType="ClaimType" ElementId="newPassword" StringId="UserHelpText">Password UserHelpText</LocalizedString>  
    </LocalizedStrings>  
    

    I've tried using both 2.1.6 and 2.1.10 pagelayout versions.

    <ContentDefinition Id="signup-page">  
    ...  
        <DataUri>urn:com:microsoft:aad:b2c:elements:contract:selfasserted:2.1.10</DataUri>  
    ...  
    </ContentDefinition>  
    

    Here's the ClaimType for thenewPassword field:

    <ClaimType Id="newPassword">  
    	<DisplayName>This does not appear on the UI either</DisplayName>  
    	<DataType>string</DataType>  
    	<UserHelpText>Enter new password</UserHelpText>  
    	<UserInputType>Password</UserInputType>  
    	...  
    </ClaimType>  
    

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.