Unable to translate "Verification code has been sent. Please copy it to the input box below." message

Viewed 343

I'm unable to translate the text "Verification code has been sent. Please copy it to the input box below." on my Sing up page using Azure AD B2C.

I tried the solution on Cant customize the Verification code message, but it didn't work for me. I was able to translate all the other texts on the page, but not this one.

I tried doing the following with no success:

      <ContentDefinition Id="api.localaccountsignup">
        <LoadUri>~/tenant/templates/AzureBlue/selfAsserted.cshtml</LoadUri>
        <RecoveryUri>~/common/default_page_error.html</RecoveryUri>
        <DataUri>urn:com:microsoft:aad:b2c:elements:contract:selfasserted:2.1.1</DataUri>
        <Metadata>
          <Item Key="DisplayName">Local account Signup</Item>
        </Metadata>
        <LocalizedResourcesReferences MergeBehavior="Prepend">
          <LocalizedResourcesReference Language="pt" LocalizedResourcesReferenceId="localaccountsignup.pt" />
        </LocalizedResourcesReferences>
      </ContentDefinition>
...
      <LocalizedResources Id="localaccountsignup.pt">
        <LocalizedStrings>
            <LocalizedString ElementType="UxElement" StringId="verification_control_code_sent">Test.</LocalizedString>
...

When I try inserting the code above, I get the error:

Validation failed: 1 validation error(s) found in policy "B2C_1A_PHONE_EMAIL_BASE" of tenant "MYWEBSITE.com".The localized string with ElementType: UxElement and StringId: verification_control_code_sent has an invalid StringIdThe localized string with ElementType: UxElement and StringId: verification_control_code_sent has an invalid StringId

Message

I tried a lot of other things too, with no success.

2 Answers

I ended up getting this to work by changing the localization string to have the ElementType of a DisplayControl.

<LocalizedResources Id="localaccountsignup.pt">
  <LocalizedStrings>
    <LocalizedString ElementType="DisplayControl" ElementId="NAME_OF_YOUR_PHONE_CONTROL" StringId="success_send_code_msg">   </LocalizedString>
  </LocalizedStrings>
</LocalizedResources>

I found the code by looking in the attribute in the web console: enter image description here

Made an issue on github about this: https://github.com/MicrosoftDocs/azure-docs/issues/70611

Related