Azure B2C自定义策略-api.localaccountsignup-仅自动翻译某些字段

时间:2020-06-27 00:13:02

标签: azure azure-ad-b2c

我已使用B2C入门包作为新政策的基础。

经过一些史诗般的战斗后,几乎所有东西都可以工作,但是翻译似乎只能部分完成。 我不相信微软真的只留下了那几个字符串,所以我这边肯定有一些错误。

我也尝试过手动翻译-但是我找不到要翻译的ID

电子邮件地址

新密码

确认新密码

这些字符串根本没有提到 https://docs.microsoft.com/en-us/azure/active-directory-b2c/localization-string-ids

如何翻译“继续”和“取消” 的按钮,但这些字段却没有?

毕竟,这些都是直接来自B2C的<div id='api'>标记中,所以我需要为这些基本字段手动进行翻译有点奇怪。

    <ClaimsProvider>
      <DisplayName>Local Account</DisplayName>
      <TechnicalProfiles>
        <TechnicalProfile Id="LocalAccountSignUpWithLogonEmail">
          <DisplayName>Email signup</DisplayName>
          <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.SelfAssertedAttributeProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
          <Metadata>
            <Item Key="IpAddressClaimReferenceId">IpAddress</Item>
            <Item Key="ContentDefinitionReferenceId">api.localaccountsignup</Item>
            <!-- <Item Key="language.button_continue">Create</Item> Had to disable this to get the translation -->
          </Metadata>
      <ContentDefinition Id="api.localaccountsignup">                 
        <LoadUri>https://my_blob_on.core.windows.net/b2c/custom-ui.html</LoadUri>
        <RecoveryUri>~/common/default_page_error.html</RecoveryUri>
        <DataUri>urn:com:microsoft:aad:b2c:elements:contract:selfasserted:1.2.0</DataUri>
        <!-- <DataUri>urn:com:microsoft:aad:b2c:elements:selfasserted:1.1.0</DataUri> - No Changes with this -->
        <Metadata>
          <Item Key="DisplayName">Local account sign up page</Item>
        </Metadata>
        <LocalizedResourcesReferences MergeBehavior="Prepend">
          <LocalizedResourcesReference Language="en" 
 LocalizedResourcesReferenceId="api.localaccountsignup.en" />
          <LocalizedResourcesReference Language="de" 
 LocalizedResourcesReferenceId="api.localaccountsignup.de" />
        </LocalizedResourcesReferences></ContentDefinition>
    <Localization Enabled="true">
      <SupportedLanguages DefaultLanguage="en" MergeBehavior="Prepend">
        <SupportedLanguage>en</SupportedLanguage>
        <SupportedLanguage>de</SupportedLanguage>
        <SupportedLanguage>it</SupportedLanguage>
      </SupportedLanguages>
<!-- adding my DIY translations as B2C doesnt provide them ?! -->
      <LocalizedResources Id="api.localaccountsignup.en">
        <LocalizedStrings>
          <LocalizedString ElementType="ClaimType" ElementId="givenName" StringId="DisplayName">Given Name</LocalizedString>
          <LocalizedString ElementType="ClaimType" ElementId="surname" StringId="DisplayName">Surname</LocalizedString>
        </LocalizedStrings>

      </LocalizedResources>
      <LocalizedResources Id="api.localaccountsignup.de">
        <LocalizedStrings>
          <LocalizedString ElementType="ClaimType" ElementId="givenName" StringId="DisplayName">Vorname</LocalizedString>
          <LocalizedString ElementType="ClaimType" ElementId="surname" StringId="DisplayName">Nachname</LocalizedString>
        </LocalizedStrings>

      </LocalizedResources>

    </Localization>

1 个答案:

答案 0 :(得分:1)

不确定是否应该内置,但我们也可以自行设置。

这是您可以设置剩余值的方法:


          <LocalizedString ElementType="ClaimType" 
            ElementId="email" 
            StringId="DisplayName">E-Mail-Adresse</LocalizedString>

          <LocalizedString ElementType="ClaimType" 
            ElementId="newPassword" 
            StringId="DisplayName">Neues Kennwort</LocalizedString>

          <LocalizedString ElementType="ClaimType" 
            ElementId="reenterPassword" 
            StringId="DisplayName">Kennwort wiederholen</LocalizedString>


You probably don't need these, but just in case:
          <LocalizedString ElementType="UxElement" StringId="button_continue">Weiter</LocalizedString>
          <LocalizedString ElementType="UxElement" StringId="button_cancel">Abbrechen</LocalizedString>

作为准则,您也可以在TrustFrameworkBase文件中查找这些声明,并使用开发人员工具检查浏览器中的字段。我发现这大部分时间都能帮助我找到正确的值。

相关问题