TOTP MFA 控件的本地化

Localization of TOTP MFA controls

我已经按照文档 (https://docs.microsoft.com/en-us/azure/active-directory-b2c/display-control-time-based-one-time-password) and samples (https://github.com/azure-ad-b2c/samples/tree/master/policies/totp) 中的描述实现了基于 TOTP 的 MFA。

现在我想翻译在 MFA 注册和验证期间显示的文本。但是,我在文档中找不到任何关于可以使用 B2C 本地化机制覆盖的 StringIds 的内容。

在 GitHub - https://github.com/azure-ad-b2c/samples/issues/378 上有一个类似的问题,10 天后没有回复。

我想翻译以下屏幕:

如果你想翻译如上所示的屏幕,你可以执行以下操作:

  1. 在您的 TrustFrameworkBase.xml 节点 ContentDefinitions 下,添加以下内容
<ContentDefinition Id="api.selfasserted.totp">
        <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.9</DataUri>
        <Metadata>
          <Item Key="DisplayName">Collect information from user page</Item>
        </Metadata>
</ContentDefinition>

  1. 在你的TrustFrameworkLocalization.xmlContentDefinitions节点添加
<ContentDefinition Id="api.selfasserted.totp">
        <LocalizedResourcesReferences MergeBehavior="Prepend">
          <LocalizedResourcesReference Language="en" LocalizedResourcesReferenceId="api.selfasserted.totp.en" />
          <LocalizedResourcesReference Language="af" LocalizedResourcesReferenceId="api.selfasserted.totp.af" />
          <!-- Add more languages here -->
        </LocalizedResourcesReferences>
</ContentDefinition>

  1. 最后,同样在本地化 xml 中,您可以添加以下翻译(当然,将 .af 更改为您的语言偏好)
<!-- Edit profile page English-->
      <LocalizedResources Id="api.selfasserted.totp.en">
        <LocalizedStrings>
          <LocalizedString ElementType="ClaimType" ElementId="totpQrCodeControl" StringId="DisplayName">You can download the Microsoft Authenticator app or use any other authenticator app of your choice.</LocalizedString>
          <LocalizedString ElementType="DisplayControl" ElementId="totpQrCodeControl" StringId="title_text">Scan the QR code</LocalizedString>
          <LocalizedString ElementType="DisplayControl" ElementId="totpQrCodeControl" StringId="info_msg">Using your app scan this QR code and click "Continue"</LocalizedString>          
          <LocalizedString ElementType="DisplayControl" ElementId="totpQrCodeControl" StringId="link_text">Can&#39;t scan? Try this</LocalizedString>
          <LocalizedString ElementType="ClaimType" ElementId="otpCode" StringId="UserHelpText">Enter the 6-digit verification code generated by the the Authenticator app in the box.</LocalizedString>
          <LocalizedString ElementType="ClaimType" ElementId="otpCode" StringId="DisplayName">Enter your code</LocalizedString>
          <LocalizedString ElementType="ClaimType" ElementId="QrCodeVerifyInstruction" StringId="DisplayName">Enter the verification code from your authenticator app​.</LocalizedString>
          <LocalizedString ElementType="ClaimType" ElementId="QrCodeScanInstruction" StringId="DisplayName">Once you've downloaded the Authenticator app, you can use any of the methods below to continue with enrollment.</LocalizedString>
          <LocalizedString ElementType="DisplayControl" ElementId="authenticatorAppIconControl" StringId="title_text">Download the Microsoft Authenticator using the download links for iOS and Android or use any other authenticator app of your choice.</LocalizedString>          
          <LocalizedString ElementType="DisplayControl" ElementId="authenticatorInfoControl" StringId="title_text">Enter the account details manually</LocalizedString>
          <LocalizedString ElementType="DisplayControl" ElementId="authenticatorInfoControl" StringId="account_name">Account Name:</LocalizedString>
          <LocalizedString ElementType="DisplayControl" ElementId="authenticatorInfoControl" StringId="display_prefix">Secret</LocalizedString>
          <LocalizedString ElementType="DisplayControl" ElementId="authenticatorInfoControl" StringId="collapse_text">Still having trouble?</LocalizedString>
          <LocalizedString ElementType="UxElement" StringId="button_continue">Continue</LocalizedString>
          <LocalizedString ElementType="UxElement" StringId="button_cancel">Cancel</LocalizedString>
        </LocalizedStrings>
      </LocalizedResources>
      <LocalizedResources Id="api.selfasserted.totp.af">
        <LocalizedStrings>
          <LocalizedString ElementType="ClaimType" ElementId="totpQrCodeControl" StringId="DisplayName">Jy kan die Microsoft Authenticator-toepassing aflaai of enige ander Authenticator-toepassing van jou keuse gebruik.</LocalizedString>
          <LocalizedString ElementType="DisplayControl" ElementId="totpQrCodeControl" StringId="title_text">Skandeer die QR-kode</LocalizedString>
          <LocalizedString ElementType="DisplayControl" ElementId="totpQrCodeControl" StringId="link_text">Kan jy nie skandeer nie? Probeer hierdie</LocalizedString>
          <LocalizedString ElementType="DisplayControl" ElementId="totpQrCodeControl" StringId="info_msg">Deur jou toepassing te gebruik, skandeer hierdie QR-kode en klik "Gaan voort"</LocalizedString>
          <LocalizedString ElementType="ClaimType" ElementId="otpCode" StringId="UserHelpText">Voer die 6-syfer-verifikasiekode in wat deur die die Authenticator-toepassing gegenereer is in die blokkie.</LocalizedString>
          <LocalizedString ElementType="ClaimType" ElementId="otpCode" StringId="DisplayName">Sleutel in jou kode</LocalizedString>
          <LocalizedString ElementType="ClaimType" ElementId="QrCodeVerifyInstruction" StringId="DisplayName">Voer die verifikasiekode vanaf jou verifikasie-toepassing in.</LocalizedString>
          <LocalizedString ElementType="ClaimType" ElementId="QrCodeScanInstruction" StringId="DisplayName">Sodra jy die Authenticator-toepassing afgelaai het, kan jy enige van die metodes hieronder gebruik om voort te gaan met inskrywing.</LocalizedString>
          <LocalizedString ElementType="DisplayControl" ElementId="authenticatorAppIconControl" StringId="title_text">Laai die Microsoft Authenticator af deur die aflaaiskakels vir iOS en Android te gebruik of gebruik enige ander Authenticator-toepassing van jou keuse.</LocalizedString>          
          <LocalizedString ElementType="DisplayControl" ElementId="authenticatorInfoControl" StringId="title_text">Voer die rekeningbesonderhede handmatig in</LocalizedString>
          <LocalizedString ElementType="DisplayControl" ElementId="authenticatorInfoControl" StringId="account_name">Rekeningnaam:</LocalizedString>
          <LocalizedString ElementType="DisplayControl" ElementId="authenticatorInfoControl" StringId="display_prefix">Geheim</LocalizedString>
          <LocalizedString ElementType="DisplayControl" ElementId="authenticatorInfoControl" StringId="collapse_text">Het u steeds probleme?</LocalizedString>
          <LocalizedString ElementType="UxElement" StringId="button_continue">Gaan voort</LocalizedString>
          <LocalizedString ElementType="UxElement" StringId="button_cancel">Kanselleer</LocalizedString>
        </LocalizedStrings>
</LocalizedResources>

这应该会为您提供以下输出

注意 一些错误消息你必须测试并弄清楚如何翻译,这些代码可以找到 here,但我做到了找到一个或两个不能按我预期工作的,并且仍在努力使它全部正确翻译。希望对此有更好的文档