3

I have localized DisplayName and UserHelpText (like shown below). How to localize the email pattern HelpText ("The email you provided is not valid")? Please advise

<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-.]+$" HelpText="The email you provided is not valid"/>
    </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>
Baloon1985
  • 89
  • 2
  • 9

3 Answers3

2

For invalid email Id, you can use inbuilt invalid_email UXElement and add the below LocalizedString:

<LocalizedString ElementType="UxElement" StringId="invalid_email">#Please enter a valid email address</LocalizedString>

Reference docs:

Harshita Singh
  • 4,590
  • 1
  • 10
  • 13
1

Found the best way.

For en,

<LocalizedString ElementType="ClaimType" ElementId="signInName" StringId="PatternHelpText">The email you provided is not valid</LocalizedString>

For es,

<LocalizedString ElementType="ClaimType" ElementId="signInName" StringId="PatternHelpText">El correo electrónico que proporcionaste no es válido</LocalizedString>
Baloon1985
  • 89
  • 2
  • 9
0

I have the "same" problem with the localization.

In my TrustedFrameworkExperience file I added the password complexity:

<Predicates>
    <Predicate Id="LengthRange" Method="IsLengthRange">
      <UserHelpText>The password must be between 10 and 16 characters</UserHelpText>
      <Parameters>
        <Parameter Id="Minimum">10</Parameter>
        <Parameter Id="Maximum">16</Parameter>
      </Parameters>
    </Predicate>
    <Predicate Id="Lowercase" Method="IncludesCharacters">
      <UserHelpText>a lowercase letter</UserHelpText>
      <Parameters>
        <Parameter Id="CharacterSet">a-z</Parameter>
      </Parameters>
    </Predicate>
    <Predicate Id="Uppercase" Method="IncludesCharacters">
      <UserHelpText>an uppercase letter</UserHelpText>
      <Parameters>
        <Parameter Id="CharacterSet">A-Z</Parameter>
      </Parameters>
    </Predicate>
    <Predicate Id="Number" Method="IncludesCharacters">
      <UserHelpText>a digit</UserHelpText>
      <Parameters>
        <Parameter Id="CharacterSet">0-9</Parameter>
      </Parameters>
    </Predicate>
    <Predicate Id="Symbol" Method="IncludesCharacters">
      <UserHelpText>a symbol</UserHelpText>
      <Parameters>
        <Parameter Id="CharacterSet">@#$%^&amp;*\-_+=[]{}|\\:',.?/`~"();!</Parameter>
      </Parameters>
    </Predicate>
    <Predicate Id="DisallowedWhitespace" Method="MatchesRegex" HelpText="The password must not begin or end with a whitespace character">
      <Parameters>
      <Parameter Id="RegularExpression">(^\S.*\S$)|(^\S+$)|(^$)</Parameter>
    </Parameters>
    </Predicate>
  </Predicates>
  
  <PredicateValidations>
    <PredicateValidation Id="CustomPassword">
      <PredicateGroups>
        <PredicateGroup Id="DisallowedWhitespaceGroup">
          <PredicateReferences>
            <PredicateReference Id="DisallowedWhitespace" />
          </PredicateReferences>
        </PredicateGroup>
        <PredicateGroup Id="LengthGroup">
          <PredicateReferences MatchAtLeast="1">
            <PredicateReference Id="LengthRange" />
          </PredicateReferences>
        </PredicateGroup>
        <PredicateGroup Id="CharacterClasses">
          <UserHelpText>The password must have at least one of the following:</UserHelpText>
          <PredicateReferences MatchAtLeast="4">
            <PredicateReference Id="Lowercase" />
            <PredicateReference Id="Uppercase" />
            <PredicateReference Id="Number" />
            <PredicateReference Id="Symbol" />
          </PredicateReferences>
        </PredicateGroup>
      </PredicateGroups>
    </PredicateValidation>
  </PredicateValidations>

How can I add the localization for the UserHelpText?

P.S. Resolved I edited the trust framework localization file and added the localized string on localizedresourcesid api.localaccountsignup

  1. Localized string element type "predictate" elementid "lenghtrange" stringid "helptext"
  2. Localized string element type "predictate" elementid "lowercase" stringid "helptext"
  3. Localized string element type "predictate" elementid "uppercase" stringid "helptext"
  4. Localized string element type "predictate" elementid "number" stringid "helptext"
  5. Localized string element type "predictate" elementid "Symbol" stringid "helptext"
  6. Localized string element type "predictatevalidation" elementid "custompassword" stringid "characterclasses"
denisdm91
  • 1
  • 1
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 26 '22 at 22:06