0
votes

I have implemented localization in Azure ADB2C custom policy.

<ClaimType Id="signInName">
    <DisplayName>Please enter your email</DisplayName>
    <DataType>string</DataType>
    <UserHelpText>Enter your email address to signin</UserHelpText>
    <Restriction>
        <Pattern RegularExpression="^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$"/>
    </Restriction>
</ClaimType>

<Localization Enabled="true">
    <SupportedLanguages DefaultLanguage="en" MergeBehavior="ReplaceAll">
        <SupportedLanguage>en</SupportedLanguage>
        <SupportedLanguage>es</SupportedLanguage>
    </SupportedLanguages>
    <LocalizedResources Id="en">
        <LocalizedStrings>
            <LocalizedString ElementType="ClaimType" ElementId="signInName" StringId="DisplayName">Please enter your email</LocalizedString>
            <LocalizedString ElementType="ClaimType" ElementId="signInName" StringId="UserHelpText">Enter your email address to signin</LocalizedString>
        </LocalizedStrings>
    </LocalizedResources>
    <LocalizedResources Id="es">
        <LocalizedStrings>
            <LocalizedString ElementType="ClaimType" ElementId="signInName" StringId="DisplayName">Por favor introduzca su correo electrónico</LocalizedString>
            <LocalizedString ElementType="ClaimType" ElementId="signInName" StringId="UserHelpText">Ingrese su dirección de correo electrónico para iniciar sesión</LocalizedString>
        </LocalizedStrings>
    </LocalizedResources>
</Localization>

Everything is working as expected but when the login button is clicked, an API call is made and the response is always in English. Also the query string parameter to indicate the language is not sent in the API call. Any help is greatly appreciated.

enter image description here

1
is that message coming from a custom validation technical profile or the default one (the AAD one who checks credentials)?FuMe
Hi @Baloon1985 How are you passing the language parameter? Can you paste the REST API technical profile in the above question?Chris Padgett

1 Answers

1
votes

You need to first find what is the string ID which is showing this error.

We support these IDs for localization which you might have customized in your policies.

Then, once you know which ID is being used for your error message, you can add a LocalizedString element like below (For example, I am assuming the ElementType is ErrorMessage and StringID is DefaultMessage):

<LocalizedString ElementType="ErrorMessage" StringId="DefaultMessage">#Invalid username or password.</LocalizedString>

You can find out different examples of the same here: https://docs.microsoft.com/en-us/azure/active-directory-b2c/custom-policy-localization