【发布时间】:2020-07-01 08:52:34
【问题描述】:
我有一个自定义 Azure B2C 策略,其中包含在注册中使用的以下声明:
...
<ClaimType Id="givenName">
<DisplayName>First Name</DisplayName>
<DataType>string</DataType>
<DefaultPartnerClaimTypes>
<Protocol Name="OAuth2"
PartnerClaimType="given_name" />
<Protocol Name="OpenIdConnect"
PartnerClaimType="given_name" />
<Protocol Name="SAML2"
PartnerClaimType="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname" />
</DefaultPartnerClaimTypes>
<UserHelpText>Your given name (also known as first name).</UserHelpText>
<UserInputType>TextBox</UserInputType>
</ClaimType>
...
我希望能够本地化当用户未输入值并尝试继续时出现的错误消息。
这是当前默认/使用本地化元素的“required_field”。 但是,还有许多其他类似的声明,即姓氏,我希望为每个声明显示不同的消息。 即“名是必需的”、“姓是必需的”等;而不仅仅是针对所有声明“需要此信息”的通用消息。
此文档https://docs.microsoft.com/en-us/azure/active-directory-b2c/localization-string-ids 显示了可用的各种 id,但我还是看不到要完成此操作?
这是本地化当前的样子
...
<LocalizedResources Id="api.localaccountsignup.en">
<LocalizedStrings>
<!-- Header -->
<LocalizedString ElementType="UxElement" StringId="initial_intro">Create a account to start</LocalizedString>
<!-- First name -->
<LocalizedString ElementType="ClaimType" ElementId="givenName" StringId="DisplayName">First name</LocalizedString>
<LocalizedString ElementType="ClaimType" ElementId="givenName" StringId="UserHelpText"></LocalizedString>
<LocalizedString ElementType="ClaimType" ElementId="givenName" StringId="PatternHelpText">First name is required.</LocalizedString>
<!-- Last name -->
<LocalizedString ElementType="ClaimType" ElementId="surname" StringId="DisplayName">Last name</LocalizedString>
<LocalizedString ElementType="ClaimType" ElementId="surname" StringId="UserHelpText"></LocalizedString>
<LocalizedString ElementType="ClaimType" ElementId="surname" StringId="PatternHelpText"></LocalizedString>
...
<LocalizedString ElementType="UxElement" StringId="required_field">This information is required.</LocalizedString>
...
我可以看到本地化帮助文本和模式(用于限制)的方法,但当用户根本没有输入任何内容时,什么都没有。
感谢您的帮助!
【问题讨论】:
-
我已与 AAD 团队取得联系,并会回复您。
-
@AlfredoR 对此有任何更新,我也有类似情况stackoverflow.com/questions/68387341/…
-
@noelor,您的问题解决了吗,如果是,请分享详细信息
-
@AlfredoR 对不起,我从来没有回答过,因为我从来没有真正得到过答案!