1
votes

Am trying to configure language customization for sign up using custom policies, but with no success. Any guidance appreciated and thanks in advance.

 I made the following configuration to achieve language customization.
  1. In trust framework extension policy, I have enabled localization with following XML changes.

        <SupportedLanguages DefaultLanguage="en" >
          <SupportedLanguage>en</SupportedLanguage>
          <SupportedLanguage>fr</SupportedLanguage>
          <SupportedLanguage>ta</SupportedLanguage>
        </SupportedLanguages>
    
  2. Created Localization resource for claim type 'extension_CompanyName'.

      <LocalizedResources Id="api.idpselections.signup.fr">
          <LocalizedStrings>
    
            <LocalizedString ElementType="ClaimType" ElementId="extension_CompanyName" StringId="DisplayName"> Some French word</LocalizedString>
            <LocalizedString ElementType="ClaimType" ElementId="extension_CompanyName" StringId="UserHelpText">Some french text</LocalizedString>
          </LocalizedStrings>
        </LocalizedResources>
    
  3. Mapped the localized resource created in step 2 with sign up screen.

     <ContentDefinition Id="api.idpselections.signup" >
          <LoadUri>~/tenant/default/idpSelector.cshtml</LoadUri>
          <RecoveryUri>~/common/default_page_error.html</RecoveryUri>
          <DataUri>urn:com:microsoft:aad:b2c:elements:idpselection:1.0.0</DataUri>
          <Metadata>
            <Item Key="DisplayName">Idp selection page</Item>
            <Item Key="language.intro">Sign up</Item>
          </Metadata>
            <LocalizedResourcesReferences MergeBehavior="Prepend">
            <LocalizedResourcesReference Language="en" LocalizedResourcesReferenceId="api.idpselections.signup.en" />
            <LocalizedResourcesReference Language="fr" LocalizedResourcesReferenceId="api.idpselections.signup.fr" />
          </LocalizedResourcesReferences>
     </ContentDefinition>
    

Finally, in my SPA app while routing to sign up policy I have appened the new query parameter 'ui_locales = 'fr'. But, unfortunately, 'extension_CompanyName' is not showing localized text.

Correct me where I went wrong.

1

1 Answers

1
votes

Renaming localized resources id fixed my problem. Not sure how it worked.

 <ContentDefinitions>
    <ContentDefinition Id="api.idpselections.signup" >
    <LoadUri>~/tenant/default/idpSelector.cshtml</LoadUri>
    <RecoveryUri>~/common/default_page_error.html</RecoveryUri>
    <DataUri>urn:com:microsoft:aad:b2c:elements:idpselection:1.0.0</DataUri>
    <Metadata>
      <Item Key="DisplayName">Idp selection page</Item>
      <Item Key="language.intro">Sign up</Item>
    </Metadata>
    <LocalizedResourcesReferences MergeBehavior="Prepend">
      <LocalizedResourcesReference Language="en" LocalizedResourcesReferenceId="en" />
      <LocalizedResourcesReference Language="fr" LocalizedResourcesReferenceId="fr" />
    </LocalizedResourcesReferences>
  </ContentDefinition>

  <LocalizedResources Id="fr">
          <LocalizedStrings>
          <LocalizedString ElementType="ClaimType" ElementId="extension_CompanyName" StringId="DisplayName">Nom de la compagnie</LocalizedString>
          <LocalizedString ElementType="ClaimType" ElementId="extension_CompanyName" StringId="UserHelpText">Nom de la compagnie</LocalizedString>
          <LocalizedString ElementType="ClaimsProvider" StringId="SignUpWithLogonEmailExchange">Local Account Sign-Up</LocalizedString>
          </LocalizedStrings>
  </LocalizedResources>