Unable to translate any text with element type "errorMessage" in Azure B2C

andreaag 1 Reputation point
2022-01-13T08:58:02.367+00:00

Hi! While working on my Signup and Signin page with azure B2C, I noticed some texts weren't being translated to the language that I customized so I proceeded to translate them manually. Most of them were translated succesfully except for the error messages.

No matter what I try, only the texts with type element "errorMessage" are the ones who don't get translated and I don't really know why.

This is my code to translate the texts manually:

<BuildingBlocks>      
        <ContentDefinitions>  
                <ContentDefinition Id="api.signuporsignin">  
                    <LocalizedResourcesReferences MergeBehavior="Prepend">  
                        <LocalizedResourcesReference Language="en" LocalizedResourcesReferenceId="api.signuporsignin.en"/>  
                        <LocalizedResourcesReference Language="es" LocalizedResourcesReferenceId="api.signuporsignin.es"/>  
                        <LocalizedResourcesReference Language="ca" LocalizedResourcesReferenceId="api.signuporsignin.ca"/>  
                        <!-- Add more languages here -->  
                    </LocalizedResourcesReferences>  
                </ContentDefinition>  
                <ContentDefinition Id="api.localaccountsignup">  
                    <LocalizedResourcesReferences MergeBehavior="Prepend">  
                        <LocalizedResourcesReference Language="es" LocalizedResourcesReferenceId="api.localaccountsignup.es"/>  
                        <LocalizedResourcesReference Language="ca" LocalizedResourcesReferenceId="api.localaccountsignup.ca"/>  
                        <!-- Add more languages here -->  
                    </LocalizedResourcesReferences>  
                </ContentDefinition>  
                <ContentDefinition Id="api.localaccountpasswordreset">  
                    <LocalizedResourcesReferences MergeBehavior="Prepend">  
                        <LocalizedResourcesReference Language="es" LocalizedResourcesReferenceId="api.localaccountpasswordreset.es"/>  
                        <LocalizedResourcesReference Language="ca" LocalizedResourcesReferenceId="api.localaccountpasswordreset.ca"/>  
                        <!-- Add more languages here -->  
                    </LocalizedResourcesReferences>  
                </ContentDefinition>  
            </ContentDefinitions>  
        <Localization Enabled="true">  
          <SupportedLanguages DefaultLanguage="en" MergeBehavior="Append">  
            <SupportedLanguage>en</SupportedLanguage>  
                <SupportedLanguage>es</SupportedLanguage>  
                <SupportedLanguage>ca</SupportedLanguage>  
          </SupportedLanguages>  
          <LocalizedResources Id="api.signuporsignin.en">  
                <LocalizedStrings>  
                    <LocalizedString ElementType="UxElement" StringId="local_intro_generic">Sign in</LocalizedString>  
                </LocalizedStrings>  
            </LocalizedResources>  
          <LocalizedResources Id="api.signuporsignin.es">  
                <LocalizedStrings>  
                    <LocalizedString ElementType="ErrorMessage" StringId="DefaultMessage">Usuario o contraseña incorrectos.</LocalizedString>  
                    <LocalizedString ElementType="ClaimType" ElementId="signInName" StringId="DisplayName">Correo Electrónico</LocalizedString>  
                    <LocalizedString ElementType="ClaimType" ElementId="password" StringId="DisplayName">Contraseña</LocalizedString>  
                    <LocalizedString ElementType="UxElement" StringId="local_intro_generic">Iniciar sesión</LocalizedString>  
                </LocalizedStrings>  
            </LocalizedResources>  
            <LocalizedResources Id="api.signuporsignin.ca">  
                <LocalizedStrings>  
                    <LocalizedString ElementType="ErrorMessage" StringId="DefaultMessage">Usuari o contrasenya incorrectes.</LocalizedString>  
                    <LocalizedString ElementType="ClaimType" ElementId="signInName" StringId="DisplayName">Adreça electrònica</LocalizedString>  
                    <LocalizedString ElementType="ClaimType" ElementId="password" StringId="DisplayName">Contrasenya</LocalizedString>  
                    <LocalizedString ElementType="UxElement" StringId="local_intro_generic">Iniciar sessió</LocalizedString>  
                </LocalizedStrings>  
            </LocalizedResources>  
            <LocalizedResources Id="api.localaccountsignup.es">  
                <LocalizedStrings>  
                    <LocalizedString ElementType="ClaimType" ElementId="email" StringId="DisplayName">Correo Electrónico</LocalizedString>  
                    <LocalizedString ElementType="ClaimType" ElementId="newPassword" StringId="DisplayName">Nueva Contraseña</LocalizedString>  
                    <LocalizedString ElementType="ClaimType" ElementId="newPassword" StringId="PatternHelpText">8-16 caracteres, que contengan 3 de los 4 siguientes: Minúsculas, mayúsculas, números (0-9),y uno o más de los símbolos siguientes: @ # $ % ^ &amp; * - _ + = [ ] { } | \ : ' , ? / ` ~ " ( ) ; .</LocalizedString>  
                    <LocalizedString ElementType="ClaimType" ElementId="reenterPassword" StringId="DisplayName">Confirmar Nueva Contraseña</LocalizedString>  
                    <LocalizedString ElementType="ClaimType" ElementId="reenterPassword" StringId="PatternHelpText">8-16 caracteres, que contengan 3 de los 4 siguientes: Minúsculas, mayúsculas, números (0-9),y uno o más de los símbolos siguientes: @ # $ % ^ &amp; * - _ + = [ ] { } | \ : ' , ? / ` ~ " ( ) ; .</LocalizedString>  
                    <LocalizedString ElementType="ClaimType" ElementId="surname" StringId="DisplayName">Apellido</LocalizedString>  
                    <LocalizedString ElementType="ClaimType" ElementId="givenName" StringId="DisplayName">Nombre</LocalizedString>  
                </LocalizedStrings>  
            </LocalizedResources>  
            <LocalizedResources Id="api.localaccountsignup.ca">  
                <LocalizedStrings>  
                    <LocalizedString ElementType="ClaimType" ElementId="email" StringId="DisplayName">Adreça electrònica</LocalizedString>  
                    <LocalizedString ElementType="ClaimType" ElementId="newPassword" StringId="DisplayName">Nova Contrasenya</LocalizedString>  
                    <LocalizedString ElementType="ClaimType" ElementId="newPassword" StringId="PatternHelpText">8-16 caràcters, que continguin 3 dels 4 símbols següents: Minúscules, majúscules, números (0-9), i un o més caràcters dels següents símbols: @ # $ % ^ &amp; * - _ + = [ ] { } | \ : ' , ? / ` ~ " ( ) ; .</LocalizedString>  
                    <LocalizedString ElementType="ClaimType" ElementId="reenterPassword" StringId="DisplayName">Confirmar Nova Contrasenya</LocalizedString>  
                    <LocalizedString ElementType="ClaimType" ElementId="reenterPassword" StringId="PatternHelpText">8-16 caràcters, que continguin 3 dels 4 símbols següents: Minúscules, majúscules, números (0-9), i un o més caràcters dels següents símbols: @ # $ % ^ &amp; * - _ + = [ ] { } | \ : ' , ? / ` ~ " ( ) ; .</LocalizedString>  
                    <LocalizedString ElementType="ClaimType" ElementId="surname" StringId="DisplayName">Cognom</LocalizedString>  
                    <LocalizedString ElementType="ClaimType" ElementId="givenName" StringId="DisplayName">Nom</LocalizedString>  
                </LocalizedStrings>  
            </LocalizedResources>  
            <LocalizedResources Id="api.localaccountpasswordreset.es">  
                <LocalizedStrings>  
                    <LocalizedString ElementType="ClaimType" ElementId="email" StringId="DisplayName">Correo Electrónico</LocalizedString>  
                    <LocalizedString ElementType="ClaimType" ElementId="newPassword" StringId="DisplayName">Nueva Contraseña</LocalizedString>  
                    <LocalizedString ElementType="ClaimType" ElementId="newPassword" StringId="PatternHelpText">8-16 caracteres, que contengan 3 de los 4 siguientes: Minúsculas, mayúsculas, números (0-9),y uno o más de los símbolos siguientes: @ # $ % ^ &amp; * - _ + = [ ] { } | \ : ' , ? / ` ~ " ( ) ; .</LocalizedString>  
                    <LocalizedString ElementType="ClaimType" ElementId="reenterPassword" StringId="DisplayName">Confirmar Nueva Contraseña</LocalizedString>  
                    <LocalizedString ElementType="ClaimType" ElementId="reenterPassword" StringId="PatternHelpText">8-16 caracteres, que contengan 3 de los 4 siguientes: Minúsculas, mayúsculas, números (0-9),y uno o más de los símbolos siguientes: @ # $ % ^ &amp; * - _ + = [ ] { } | \ : ' , ? / ` ~ " ( ) ; .</LocalizedString>  
                    <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfClaimsPrincipalAlreadyExists">Ya existe un usuario con el ID especificado. Por favor, elija uno diferente.</LocalizedString>  
                    <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfClaimsPrincipalAlreadyExist">No se pudo encontrar un usuario con la credencial especificada.</LocalizedString>  
                </LocalizedStrings>  
            </LocalizedResources>  
            <LocalizedResources Id="api.localaccountpasswordreset.ca">  
                <LocalizedStrings>  
                    <LocalizedString ElementType="ClaimType" ElementId="email" StringId="DisplayName">Adreça electrònica</LocalizedString>  
                    <LocalizedString ElementType="ClaimType" ElementId="newPassword" StringId="DisplayName">Nova Contrasenya</LocalizedString>  
                    <LocalizedString ElementType="ClaimType" ElementId="newPassword" StringId="PatternHelpText">8-16 caràcters, que continguin 3 dels 4 símbols següents: Minúscules, majúscules, números (0-9), i un o més caràcters dels següents símbols: @ # $ % ^ &amp; * - _ + = [ ] { } | \ : ' , ? / ` ~ " ( ) ; .</LocalizedString>  
                    <LocalizedString ElementType="ClaimType" ElementId="reenterPassword" StringId="DisplayName">Confirmar Nova Contrasenya</LocalizedString>  
                    <LocalizedString ElementType="ClaimType" ElementId="reenterPassword" StringId="PatternHelpText">8-16 caràcters, que continguin 3 dels 4 símbols següents: Minúscules, majúscules, números (0-9), i un o més caràcters dels següents símbols: @ # $ % ^ &amp; * - _ + = [ ] { } | \ : ' , ? / ` ~ " ( ) ; .</LocalizedString>  
                    <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfClaimsPrincipalAlreadyExists">Ja existeix un usuari amb la ID especificada. Si us plau, trieu-ne un de diferent.</LocalizedString>  
                    <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfClaimsPrincipalAlreadyExist">No s'ha pogut trobar un usuari amb la credencial especificada.</LocalizedString>  
                </LocalizedStrings>  
            </LocalizedResources>  

And those are the versions I'm using i my policy:

<ContentDefinitions>  
            <!-- This content definition is to render an error page that displays unhandled errors. -->  
            <ContentDefinition Id="api.error">  
                <LoadUri>~/tenant/templates/AzureBlue/exception.cshtml</LoadUri>  
                <RecoveryUri>~/common/default_page_error.html</RecoveryUri>  
                <DataUri>urn:com:microsoft:aad:b2c:elements:contract:globalexception:1.2.1</DataUri>  
                <Metadata>  
                    <Item Key="DisplayName">Error page</Item>  
                </Metadata>  
            </ContentDefinition>  
            <ContentDefinition Id="api.idpselections">  
                <LoadUri>~/tenant/templates/AzureBlue/idpSelector.cshtml</LoadUri>  
                <RecoveryUri>~/common/default_page_error.html</RecoveryUri>  
                <DataUri>urn:com:microsoft:aad:b2c:elements:contract:providerselection:1.2.1</DataUri>  
                <Metadata>  
                    <Item Key="DisplayName">Idp selection page</Item>  
                    <Item Key="language.intro">Sign in</Item>  
                </Metadata>  
            </ContentDefinition>  
            <ContentDefinition Id="api.idpselections.signup">  
                <LoadUri>~/tenant/templates/AzureBlue/idpSelector.cshtml</LoadUri>  
                <RecoveryUri>~/common/default_page_error.html</RecoveryUri>  
                <DataUri>urn:com:microsoft:aad:b2c:elements:contract:providerselection:1.2.1</DataUri>  
                <Metadata>  
                    <Item Key="DisplayName">Idp selection page</Item>  
                    <Item Key="language.intro">Sign up</Item>  
                </Metadata>  
            </ContentDefinition>  
            <ContentDefinition Id="api.signuporsignin">  
                <LoadUri></LoadUri>  
                <RecoveryUri>~/common/default_page_error.html</RecoveryUri>  
                <DataUri>urn:com:microsoft:aad:b2c:elements:contract:unifiedssp:2.1.5</DataUri>  
                <Metadata>  
                    <Item Key="DisplayName">Signin and Signup</Item>  
                </Metadata>  
            </ContentDefinition>  
            <ContentDefinition Id="api.selfasserted">  
                <LoadUri></LoadUri>  
                <RecoveryUri>~/common/default_page_error.html</RecoveryUri>  
                <DataUri>urn:com:microsoft:aad:b2c:elements:contract:selfasserted:2.1.8</DataUri>  
                <Metadata>  
                    <Item Key="DisplayName">Collect information from user page</Item>  
                </Metadata>  
            </ContentDefinition>  
            <ContentDefinition Id="api.selfasserted.profileupdate">  
                <LoadUri></LoadUri>  
                <RecoveryUri>~/common/default_page_error.html</RecoveryUri>  
                <DataUri>urn:com:microsoft:aad:b2c:elements:contract:selfasserted:2.1.8</DataUri>  
                <Metadata>  
                    <Item Key="DisplayName">Collect information from user page</Item>  
                </Metadata>  
            </ContentDefinition>  
            <ContentDefinition Id="api.localaccountsignup">  
                <LoadUri></LoadUri>  
                <RecoveryUri>~/common/default_page_error.html</RecoveryUri>  
                <DataUri>urn:com:microsoft:aad:b2c:elements:contract:selfasserted:2.1.7</DataUri>  
                <Metadata>  
                    <Item Key="DisplayName">Local account sign up page</Item>  
                </Metadata>  
            </ContentDefinition>  
            <ContentDefinition Id="api.localaccountpasswordreset">  
                <LoadUri>l</LoadUri>  
                <RecoveryUri>~/common/default_page_error.html</RecoveryUri>  
                <DataUri>urn:com:microsoft:aad:b2c:elements:contract:selfasserted:2.1.7</DataUri>  
                <Metadata>  
                    <Item Key="DisplayName">Local account change password page</Item>  
                </Metadata>  
            </ContentDefinition>  
            <ContentDefinition Id="api.localaccountsignin">  
                <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.7</DataUri>  
                <Metadata>  
                    <Item Key="DisplayName">Collect information from user page</Item>  
                </Metadata>  
            </ContentDefinition>  
        </ContentDefinitions>  

And as you can see, only the error messages aren't being translated, the other texts that I translated manually are just working fine:

Image 1

Image 2

Anyone knows why this is happening? Thanks!

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.
2,654 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Marilee Turscak-MSFT 34,046 Reputation points Microsoft Employee
    2022-01-14T22:03:29.6+00:00

    Are you able to share your login-NonInteractive technical profile?

    There appears to be an issue when the policy is configured with ROPC flow. There is an open ticket regarding this issue with the product team and several ongoing threads related to this.

    There are also some workarounds here and here that involve removing the "Key : grant_type = password" from the technical profile.

    Is your multifactor page layout version updated to the latest version? In some cases updating the version resolves the issue. https://learn.microsoft.com/en-us/azure/active-directory-b2c/page-layout

    It doesn't look like you included the full code snippet but make sure you include the end of the "</Localization>" element and ensure that your XML matches the documentation fully:

    <Localization Enabled="true">  
      <SupportedLanguages DefaultLanguage="en" MergeBehavior="ReplaceAll">  
        <SupportedLanguage>en</SupportedLanguage>  
        <SupportedLanguage>es</SupportedLanguage>  
      </SupportedLanguages>  
      
       
      
      <LocalizedResources Id="api.localaccountsignup.en">  
      <LocalizedStrings>  
        <LocalizedString ElementType="ErrorMessage" StringId="CustomErrorMessage">You have exceed the maximum time allowed.</LocalizedString>  
      </LocalizedStrings>  
    </LocalizedResources>  
      
       
      
      <LocalizedResources Id="api.localaccountsignup.es">  
      <LocalizedStrings>  
        <LocalizedString ElementType="ErrorMessage" StringId="CustomErrorMessage">Ha superado el tiempo máximo permitido.</LocalizedString>  
      </LocalizedStrings>  
    </LocalizedResources>  
      ...  
    </Localization>  
    
    0 comments No comments