Azure Active Directory B2C 中的語言自定義

選擇原則類型

重要

自 2025 年 5 月 1 日起,Azure AD B2C 將不再可供新客戶購買。 在我們的常見問題中深入瞭解

開始之前,請使用此頁面頂端的 [選擇原則類型] 選取器,選擇您要設定的原則類型。 Azure Active Directory B2C 提供兩種方法來定義使用者如何與您的應用程式互動:透過預先定義的使用者流程,或透過完全可設定的自訂原則。 此文章中所需的步驟隨各方法而異。

Azure Active Directory B2C (Azure AD B2C) 中的語言自定義可讓您的使用者流程適應不同的語言,以符合客戶需求。 Microsoft提供 36 種語言的翻譯,但您也可以為任何語言提供自己的翻譯。 即使您的體驗只提供單一語言,您也可以自定義頁面上的任何文字。

語言自訂的運作方式

您可以使用語言自定義來選取使用者流程可用的語言。 開啟此功能之後,您可以從應用程式提供查詢字串參數 ui_locales。 當您向 Azure AD B2C 呼叫時,您的頁面會翻譯為您指示的語言地區。 這種類型的設定可讓您完全控制使用者流程中的語言,並忽略客戶瀏覽器的語言設定。

您不一定需要對客戶所看到的語言進行這種程度的控制。 如果您沒有提供 ui_locales 參數,則客戶的體驗會由其瀏覽器的設定決定。 您仍然可以透過新增支援的語言來控制您的使用者流程被翻譯成哪些語言。 如果客戶的瀏覽器設定為顯示您不想支援的語言,則會改為顯示您選取為支援文化特性中預設值的語言。

  • ui 地區設定指定的語言:啟用語言自定義之後,您的使用者流程會轉譯為這裡指定的語言。
  • 瀏覽器要求的語言:如果未 ui_locales 指定任何參數,則如果 支持語言,您的使用者流程會轉譯為瀏覽器要求的語言。
  • 原則預設語言:如果瀏覽器未指定語言,或指定不支持的語言,則會將使用者流程轉譯為使用者流程默認語言。

注意

如果您使用自定義使用者屬性,則必須提供自己的翻譯。 如需詳細資訊,請參閱 自定義您的字串

觀看這段影片,瞭解如何使用 Azure AD B2C 當地語系化或自定義語言。

本地化需要三個步驟:

  1. 設定支援語言的明確清單
  2. 提供特定語言的字串和集合
  3. 編輯頁面 的內容定義

先決條件

支援ui_locales要求的語言

在語言自定義正式運作之前所建立的原則,必須先啟用此功能。 建立在「語言自定義已啟用」後的原則和使用者流程會默認啟用此功能。

當您在使用者流程上啟用語言自定義時,您可以藉由新增 ui_locales 參數來控制使用者流程的語言。

  1. 在您的 Azure AD B2C 租戶中,選取 使用者流程
  2. 按一下您想啟用翻譯的使用者流程。
  3. 選取 [語言]
  4. 選取 [啟用語言自定義]。

選擇在使用者流程中已啟用的語言

啟用一組語言,以便在瀏覽器要求時將您的使用者流程翻譯為這些語言,而不需要 ui_locales 參數。

  1. 請確定您的使用者流程已從先前的指示啟用語言自定義。
  2. 在使用者流程的 [ 語言] 頁面上,選取您想要支持的語言。
  3. 在 [屬性] 窗格中,將 [已啟用] 變更為 [是]。
  4. 選取屬性窗格頂端的 [ 儲存 ]。

注意

如果ui_locales參數未提供,則頁面只有在啟用時才會翻譯為客戶的瀏覽器語言。

自訂您的字串

語言自訂可讓您自訂使用者流程中的任何字串。

  1. 請確保您的使用者流程根據先前的指示啟用了語言設定。
  2. 在使用者流程的 [語言] 頁面上,選取您想要自訂的語言。
  3. [頁面層級資源檔案] 底下,選取您要編輯的頁面。
  4. 選取 下載預設值(如果您先前已編輯此語言,請選取 下載覆蓋)。

上述步驟會向您提供 JSON 檔案,以供您用來開始編輯字串。

變更頁面上的任何字串

  1. 在 JSON 編輯器中開啟透過前面的指示所下載的 JSON 檔案。
  2. 尋找您想要變更的元素。 您可以尋找 StringId 以取得您要尋找的字串,或尋找您要變更的 Value 屬性。
  3. 以您想要顯示的內容來更新 Value 屬性。
  4. 對於您想要變更的每個字串,請將 Override 變更為 true
  5. 儲存檔案並上傳您的修改。 (您可以在下載 JSON 檔案的位置找到上傳控制件。

重要

如果您需要覆寫字串,請務必將 Override 值設定為 true。 如果值未變更,項目將被忽略。

變更擴充屬性

如果您想要變更自訂使用者屬性的字串,或想要將字串新增到 JSON 中,其格式如下︰

JSON
{
  "LocalizedStrings": [
    {
      "ElementType": "ClaimType",
      "ElementId": "extension_<ExtensionAttribute>",
      "StringId": "DisplayName",
      "Override": true,
      "Value": "<ExtensionAttributeValue>"
    }
    [...]
  ]
}

以自訂使用者屬性的名稱來取代 <ExtensionAttribute>

以要顯示的新字串來取代 <ExtensionAttributeValue>

使用 LocalizedCollections 提供值清單

如果您想要提供設定好的回應值清單,您需要建立 LocalizedCollections 屬性。 LocalizedCollectionsNameValue 的配對陣列。 項目的順序將會是其顯示的順序。 若要新增 LocalizedCollections,請使用下列格式:

JSON
{
  "LocalizedStrings": [...],
  "LocalizedCollections": [
    {
      "ElementType":"ClaimType",
      "ElementId":"<UserAttribute>",
      "TargetCollection":"Restriction",
      "Override": true,
      "Items":[
        {
          "Name":"<Response1>",
          "Value":"<Value1>"
        },
        {
          "Name":"<Response2>",
          "Value":"<Value2>"
        }
      ]
    }
  ]
}
  • ElementId 是使用者屬性,而其回應則是這個 LocalizedCollections 屬性。
  • Name 是向用戶顯示的值。
  • Value 是選取此選項時在宣告中所傳回的內容。

上傳您的變更

  1. 完成 JSON 檔案的變更之後,請返回 B2C 租使用者。
  2. 選取 [使用者流程 ],然後按下您想要啟用翻譯的使用者流程。
  3. 選取 [語言]
  4. 選取您想要轉譯成什麼語言。
  5. 選取您想要提供翻譯的頁面。
  6. 選取資料夾圖示,然後選取要上傳的 JSON 檔案。

這些變更會自動儲存到您的使用流程。

使用語言自定義頁面 UI

有兩種方式可將 HTML 內容當地語系化。 其中一種方式是開啟 語言自定義。 啟用此功能可讓 Azure AD B2C 將 OpenID Connect 參數 ui-locales轉送至您的端點。 您的內容伺服器可以使用此參數來提供特定語言的自定義 HTML 頁面。

或者,您可以根據所使用的地區設定,從不同位置提取內容。 在啟用 CORS 的端點中,您可以設定資料夾結構來裝載特定語言的內容。 如果您使用通配符值 {Culture:RFC5646},就會選擇正確的選項。 例如,假設這是您的自定義頁面 URI:

https://wingtiptoysb2c.blob.core.windows.net/{Culture:RFC5646}/wingtip/unified.html

您可以在 fr 中載入頁面。 當頁面提取 HTML 和 CSS 內容時,它會從下列專案提取:

https://wingtiptoysb2c.blob.core.windows.net/fr/wingtip/unified.html

新增自訂語言

您也可以新增 Microsoft 目前未提供翻譯的語言。 您必須提供使用者流程中所有字串的翻譯。 語言和地區設定代碼僅限於 ISO 639-1 標準。 地區設定程式代碼格式應該是 「ISO_639-1_code」-「CountryCode」,例如 en-GB。 如需詳細資訊,請參閱 地區設定標識符格式

  1. 在您的 Azure AD B2C 租戶中,選取 使用者流程
  2. 按兩下您要新增自訂語言的使用者流程,然後按兩下 [ 語言]。
  3. 從頁面頂端選取 [新增自定義語言 ]。
  4. 在開啟的內容窗格中,輸入有效的地區設定程式代碼來識別您要提供翻譯的語言。
  5. 針對每個頁面,您可以下載一組英文修改內容,然後著手進行翻譯工作。
  6. 使用 JSON 檔案完成之後,您可以針對每個頁面上傳它們。
  7. 選取 [啟用],您的使用者流程現在可以為您的用戶顯示此語言。
  8. 保存語言。

重要

您需要先啟用自定義語言或上傳覆蓋設定,然後才能儲存。

設定支援的語言清單

開啟您政策的延伸檔案。 例如: SocialAndLocalAccounts/TrustFrameworkExtensions.xml

  1. 搜尋 BuildingBlocks 元素。 如果元素不存在,加以新增。
  2. 新增元素 Localization,搭配支援的語言:英文(預設值)和西班牙文。
XML
<Localization Enabled="true">
  <SupportedLanguages DefaultLanguage="en" MergeBehavior="ReplaceAll">
    <SupportedLanguage>en</SupportedLanguage>
    <SupportedLanguage>es</SupportedLanguage>
  </SupportedLanguages>
</Localization>

提供特定語言的標籤

LocalizedResourcesLocalization 元素包含在地化字串的清單。 本地化的資源元素具有用來唯一識別本地化資源的標識碼。 此標識碼稍後會在 內容定義 專案中使用。

您可以設定內容定義的當地語系化資源元素,以及您想要支援的任何語言。 若要自定義英文和西班牙文的統一註冊或登入頁面,請在元素關閉LocalizedResources之後新增下列</SupportedLanguages>元素。

注意

在下列範例中,我們在每一行開頭新增了磅 # 符號,讓您可以輕鬆地在畫面上尋找本地化的標籤。

XML
<!--Local account sign-up or sign-in page English-->
<Localization Enabled="true">
  ...
 <LocalizedResources Id="api.signuporsignin.en">
        <LocalizedStrings>
          <LocalizedString ElementType="ClaimType" ElementId="signInName" StringId="DisplayName">Email Address</LocalizedString>
          <LocalizedString ElementType="UxElement" StringId="heading">Sign in</LocalizedString>
          <LocalizedString ElementType="UxElement" StringId="social_intro">Sign in with your social account</LocalizedString>
          <LocalizedString ElementType="UxElement" StringId="local_intro_generic">Sign in with your {0}</LocalizedString>
          <LocalizedString ElementType="ClaimType" ElementId="password" StringId="DisplayName">Password</LocalizedString>
          <LocalizedString ElementType="UxElement" StringId="requiredField_password">Please enter your password</LocalizedString>
          <LocalizedString ElementType="UxElement" StringId="requiredField_generic">Please enter your {0}</LocalizedString>
          <LocalizedString ElementType="UxElement" StringId="invalid_generic">Please enter a valid {0}</LocalizedString>
          <LocalizedString ElementType="UxElement" StringId="createaccount_one_link">Sign up now</LocalizedString>
          <LocalizedString ElementType="UxElement" StringId="createaccount_two_links">Sign up with {0} or {1}</LocalizedString>
          <LocalizedString ElementType="UxElement" StringId="createaccount_three_links">Sign up with {0}, {1}, or {2}</LocalizedString>
          <LocalizedString ElementType="UxElement" StringId="forgotpassword_link">Forgot your password?</LocalizedString>
          <LocalizedString ElementType="UxElement" StringId="button_signin">Sign in</LocalizedString>
          <LocalizedString ElementType="UxElement" StringId="divider_title">OR</LocalizedString>
          <LocalizedString ElementType="UxElement" StringId="createaccount_intro">Don't have an account?</LocalizedString>
          <LocalizedString ElementType="UxElement" StringId="unknown_error">We are having trouble signing you in. Please try again later.</LocalizedString>
          <!-- Uncomment the remember_me only if the keep me signed in is activated. 
          <LocalizedString ElementType="UxElement" StringId="remember_me">Keep me signed in</LocalizedString> -->
          <LocalizedString ElementType="ClaimsProvider" StringId="FacebookExchange">Facebook</LocalizedString>
          <LocalizedString ElementType="ErrorMessage" StringId="ResourceOwnerFlowInvalidCredentials">Your password is incorrect.</LocalizedString>
          <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfInvalidPassword">Your password is incorrect.</LocalizedString>
          <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfPasswordExpired">Your password has expired.</LocalizedString>
          <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfClaimsPrincipalDoesNotExist">We can't seem to find your account.</LocalizedString>
          <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfOldPasswordUsed">Looks like you used an old password.</LocalizedString>
          <LocalizedString ElementType="ErrorMessage" StringId="DefaultMessage">Invalid username or password.</LocalizedString>
          <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfUserAccountDisabled">Your account has been locked. Contact your support person to unlock it, then try again.</LocalizedString>
          <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfUserAccountLocked">Your account is temporarily locked to prevent unauthorized use. Try again later.</LocalizedString>
          <LocalizedString ElementType="ErrorMessage" StringId="AADRequestsThrottled">There are too many requests at this moment. Please wait for some time and try again.</LocalizedString>
        </LocalizedStrings>
      </LocalizedResources>
  <!--Local account sign-up or sign-in page Spanish-->
  <LocalizedResources Id="api.signuporsignin.es">
    <LocalizedStrings>
      <LocalizedString ElementType="UxElement" StringId="logonIdentifier_email">#Correo electrónico</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="requiredField_email">#Este campo es obligatorio</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="logonIdentifier_username">#Nombre de usuario</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="password">#Contraseña</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="createaccount_link">#Registrarse ahora</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="requiredField_username">#Escriba su nombre de usuario</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="createaccount_intro">#¿No tiene una cuenta?</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="forgotpassword_link">#¿Olvidó su contraseña?</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="divider_title">#O</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="cancel_message">#El usuario ha olvidado su contraseña</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="button_signin">#Iniciar sesión</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="social_intro">#Iniciar sesión con su cuenta de redes sociales</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="requiredField_password">#Escriba su contraseña</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="invalid_password">#La contraseña que ha escrito no está en el formato esperado.</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="local_intro_username">#Iniciar sesión con su nombre de usuario</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="local_intro_email">#Iniciar sesión con su cuenta existente</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="invalid_email">#Escriba una dirección de correo electrónico válida</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="unknown_error">#Tenemos problemas para iniciar su sesión. Vuelva a intentarlo más tarde.  </LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="email_pattern">^[a-zA-Z0-9.!#$%&amp;'^_`\{\}~\-]+@[a-zA-Z0-9\-]+(?:\.[a-zA-Z0-9\-]+)*$</LocalizedString>
      <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfInvalidPassword">#Su contraseña es incorrecta.</LocalizedString>
      <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfClaimsPrincipalDoesNotExist">#Parece que no podemos encontrar su cuenta.</LocalizedString>
      <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfOldPasswordUsed">#Parece que ha usado una contraseña antigua.</LocalizedString>
      <LocalizedString ElementType="ErrorMessage" StringId="DefaultMessage">#El nombre de usuario o la contraseña no son válidos.</LocalizedString>
      <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfUserAccountDisabled">#Se bloqueó su cuenta. Póngase en contacto con la persona responsable de soporte técnico para desbloquearla y vuelva a intentarlo.</LocalizedString>
      <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfUserAccountLocked">#Su cuenta se bloqueó temporalmente para impedir un uso no autorizado. Vuelva a intentarlo más tarde.</LocalizedString>
      <LocalizedString ElementType="ErrorMessage" StringId="AADRequestsThrottled">#Hay demasiadas solicitudes en este momento. Espere un momento y vuelva a intentarlo.</LocalizedString>
    </LocalizedStrings>
  </LocalizedResources>
  <!--Local account sign-up page English-->
  <LocalizedResources Id="api.localaccountsignup.en">
    <LocalizedStrings>
      <LocalizedString ElementType="ClaimType" ElementId="email" StringId="DisplayName">#Email Address</LocalizedString>
      <LocalizedString ElementType="ClaimType" ElementId="email" StringId="UserHelpText">#Email address that can be used to contact you.</LocalizedString>
      <LocalizedString ElementType="ClaimType" ElementId="email" StringId="PatternHelpText">#Please enter a valid email address.</LocalizedString>
      <LocalizedString ElementType="ClaimType" ElementId="newPassword" StringId="DisplayName">#New Password</LocalizedString>
      <LocalizedString ElementType="ClaimType" ElementId="newPassword" StringId="UserHelpText">#Enter new password</LocalizedString>
      <LocalizedString ElementType="ClaimType" ElementId="newPassword" StringId="PatternHelpText">#8-16 characters, containing 3 out of 4 of the following: Lowercase characters, uppercase characters, digits (0-9), and one or more of the following symbols: @ # $ % ^ &amp; * - _ + = [ ] { } | \ : ' , ? / ` ~ " ( ) ; .</LocalizedString>
      <LocalizedString ElementType="ClaimType" ElementId="reenterPassword" StringId="DisplayName">#Confirm New Password</LocalizedString>
      <LocalizedString ElementType="ClaimType" ElementId="reenterPassword" StringId="UserHelpText">#Confirm new password</LocalizedString>
      <LocalizedString ElementType="ClaimType" ElementId="reenterPassword" StringId="PatternHelpText">#8-16 characters, containing 3 out of 4 of the following: Lowercase characters, uppercase characters, digits (0-9), and one or more of the following symbols: @ # $ % ^ &amp; * - _ + = [ ] { } | \ : ' , ? / ` ~ " ( ) ; .</LocalizedString>
      <LocalizedString ElementType="ClaimType" ElementId="displayName" StringId="DisplayName">#Display Name</LocalizedString>
      <LocalizedString ElementType="ClaimType" ElementId="displayName" StringId="UserHelpText">#Your display name.</LocalizedString>
      <LocalizedString ElementType="ClaimType" ElementId="surname" StringId="DisplayName">#Surname</LocalizedString>
      <LocalizedString ElementType="ClaimType" ElementId="surname" StringId="UserHelpText">#Your surname (also known as family name or last name).  </LocalizedString>
      <LocalizedString ElementType="ClaimType" ElementId="givenName" StringId="DisplayName">#Given Name</LocalizedString>
      <LocalizedString ElementType="ClaimType" ElementId="givenName" StringId="UserHelpText">#Your given name (also known as first name).</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="button_continue">#Create</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="error_fieldIncorrect">#One or more fields are filled out incorrectly. Please check your entries and try again.</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="error_passwordEntryMismatch">#The password entry fields do not match. Please enter the same password in both fields and try again.</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="error_requiredFieldMissing">#A required field is missing. Please fill out all required fields and try again.</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="helplink_text">#What is this?</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="initial_intro">#Please provide the following details.</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="preloader_alt">#Please wait</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="required_field">#This information is required.</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="ver_but_edit">#Change e-mail</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="ver_but_resend">#Send new code</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="ver_but_send">#Send verification code</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="ver_but_verify">#Verify code</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="ver_fail_code_expired">#That code is expired. Please request a new code.</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="ver_fail_no_retry">#You've made too many incorrect attempts. Please try again later.</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="ver_fail_retry">#That code is incorrect. Please try again.</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="ver_fail_server">#We are having trouble verifying your email address. Please enter a valid email address and try again.</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="ver_fail_throttled">#There have been too many requests to verify this email address. Please wait a while, then try again.</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="ver_info_msg">#Verification code has been sent to your inbox. Please copy it to the input box below.</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="ver_input">#Verification code</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="ver_intro_msg">#Verification is necessary. Please click Send button.</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="ver_success_msg">#E-mail address verified. You can now continue.</LocalizedString>
      <LocalizedString ElementType="ErrorMessage" StringId="ServiceThrottled">#There are too many requests at this moment. Please wait for some time and try again.</LocalizedString>
      <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfClaimNotVerified">#Claim not verified: {0}</LocalizedString>
      <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfClaimsPrincipalAlreadyExists">#A user with the specified ID already exists. Please choose a different one.</LocalizedString>
      <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfIncorrectPattern">#Incorrect pattern for: {0}</LocalizedString>
      <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfInvalidInput">#{0} has invalid input.</LocalizedString>
      <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfMissingRequiredElement">#Missing required element: {0}</LocalizedString>
      <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfValidationError">#Error in validation by: {0}</LocalizedString>
    </LocalizedStrings>
  </LocalizedResources>
  <!--Local account sign-up page Spanish-->
  <LocalizedResources Id="api.localaccountsignup.es">
    <LocalizedStrings>
      <LocalizedString ElementType="ClaimType" ElementId="email" StringId="DisplayName">#Dirección de correo electrónico</LocalizedString>
      <LocalizedString ElementType="ClaimType" ElementId="email" StringId="UserHelpText">#Dirección de correo electrónico que puede usarse para ponerse en contacto con usted.</LocalizedString>
      <LocalizedString ElementType="ClaimType" ElementId="email" StringId="PatternHelpText">#Introduzca una dirección de correo electrónico válida.  </LocalizedString>
      <LocalizedString ElementType="ClaimType" ElementId="newPassword" StringId="DisplayName">#Nueva contraseña</LocalizedString>
      <LocalizedString ElementType="ClaimType" ElementId="newPassword" StringId="UserHelpText">#Escriba la contraseña nueva</LocalizedString>
      <LocalizedString ElementType="ClaimType" ElementId="newPassword" StringId="PatternHelpText">#De 8 a 16 caracteres, que contengan 3 de los 4 tipos siguientes: caracteres en minúsculas, caracteres en mayúsculas, dígitos (0-9) y uno o más de los siguientes símbolos: @ # $ % ^ &amp; * - _ + = [ ] { } | \\ : ' , ? / ` ~ \" ( ) ; .</LocalizedString>
      <LocalizedString ElementType="ClaimType" ElementId="reenterPassword" StringId="DisplayName">#Confirmar nueva contraseña</LocalizedString>
      <LocalizedString ElementType="ClaimType" ElementId="reenterPassword" StringId="UserHelpText">#Confirmar nueva contraseña</LocalizedString>
      <LocalizedString ElementType="ClaimType" ElementId="reenterPassword" StringId="PatternHelpText">#8 a 16 caracteres, que contengan 3 de los 4 tipos siguientes: caracteres en minúsculas, caracteres en mayúsculas, dígitos (0-9) y uno o más de los siguientes símbolos: @ # $ % ^ &amp; * - _ + = [ ] { } | \\ : ' , ? / ` ~ \" ( ) ; .</LocalizedString>
      <LocalizedString ElementType="ClaimType" ElementId="displayName" StringId="DisplayName">#Nombre para mostrar</LocalizedString>
      <LocalizedString ElementType="ClaimType" ElementId="displayName" StringId="UserHelpText">#Su nombre para mostrar.</LocalizedString>
      <LocalizedString ElementType="ClaimType" ElementId="surname" StringId="DisplayName">#Apellido</LocalizedString>
      <LocalizedString ElementType="ClaimType" ElementId="surname" StringId="UserHelpText">#Su apellido.</LocalizedString>
      <LocalizedString ElementType="ClaimType" ElementId="givenName" StringId="DisplayName">#Nombre</LocalizedString>
      <LocalizedString ElementType="ClaimType" ElementId="givenName" StringId="UserHelpText">#Su nombre (también conocido como nombre de pila).</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="button_continue">#Crear</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="error_fieldIncorrect">#Hay uno o varios campos rellenados de forma incorrecta. Compruebe las entradas y vuelva a intentarlo.</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="error_passwordEntryMismatch">#Los campos de entrada de contraseña no coinciden. Escriba la misma contraseña en ambos campos y vuelva a intentarlo.</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="error_requiredFieldMissing">#Falta un campo obligatorio. Rellene todos los campos necesarios y vuelva a intentarlo.</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="helplink_text">#¿Qué es esto?</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="initial_intro">#Proporcione los siguientes detalles.</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="preloader_alt">#Espere</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="required_field">#Esta información es obligatoria.</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="ver_but_edit">#Cambiar correo electrónico</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="ver_but_resend">#Enviar nuevo código</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="ver_but_send">#Enviar código de comprobación</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="ver_but_verify">#Comprobar código</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="ver_fail_code_expired">#El código ha expirado. Solicite otro nuevo.</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="ver_fail_no_retry">#Ha realizado demasiados intentos incorrectos. Vuelva a intentarlo más tarde.</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="ver_fail_retry">#Ese código es incorrecto. Inténtelo de nuevo.</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="ver_fail_server">#Tenemos problemas para comprobar la dirección de correo electrónico. Escriba una dirección de correo electrónico válida y vuelva a intentarlo.</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="ver_fail_throttled">#Ha habido demasiadas solicitudes para comprobar esta dirección de correo electrónico. Espere un poco y vuelva a intentarlo.</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="ver_info_msg">#Se ha enviado el código de verificación a su Bandeja de entrada. Cópielo en el siguiente cuadro de entrada.</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="ver_input">#Código de verificación</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="ver_intro_msg">#La comprobación es obligatoria. Haga clic en el botón Enviar.</LocalizedString>
      <LocalizedString ElementType="UxElement" StringId="ver_success_msg">#Dirección de correo electrónico comprobada. Puede continuar.</LocalizedString>
      <LocalizedString ElementType="ErrorMessage" StringId="ServiceThrottled">#Hay demasiadas solicitudes en este momento. Espere un momento y vuelva a intentarlo.</LocalizedString>
      <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfClaimNotVerified">#Reclamación no comprobada: {0}</LocalizedString>
      <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfClaimsPrincipalAlreadyExists">#Ya existe un usuario con el id. especificado. Elija otro diferente.</LocalizedString>
      <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfIncorrectPattern">#Patrón incorrecto para: {0}</LocalizedString>
      <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfInvalidInput">#{0} tiene una entrada no válida.</LocalizedString>
      <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfMissingRequiredElement">#Falta un elemento obligatorio: {0}</LocalizedString>
      <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfValidationError">#Error en la validación de: {0}</LocalizedString>
    </LocalizedStrings>
  </LocalizedResources>
</Localization>

使用當地語系化編輯內容定義

將您作為 BuildingBlocks 元素子項目複製的 ContentDefinitions 元素整個內容貼上。

在下列範例中,英文 (en) 和西班牙文 (es) 自定義字串會新增至註冊或登入頁面,以及本機帳戶註冊頁面。 每個 LocalizedResourcesReference 的 LocalizedResourcesReferenceId 與其地區設定相同,但您可以使用任何字串作為標識符。 針對每個語言和頁面組合,您會指向您先前建立的對應 LocalizedResources

XML
<ContentDefinitions>
  <ContentDefinition Id="api.signuporsignin">
    <LocalizedResourcesReferences MergeBehavior="Prepend">
        <LocalizedResourcesReference Language="en" LocalizedResourcesReferenceId="api.signuporsignin.en" />
        <LocalizedResourcesReference Language="es" LocalizedResourcesReferenceId="api.signuporsignin.es" />
    </LocalizedResourcesReferences>
  </ContentDefinition>

  <ContentDefinition Id="api.localaccountsignup">
    <LocalizedResourcesReferences MergeBehavior="Prepend">
        <LocalizedResourcesReference Language="en" LocalizedResourcesReferenceId="api.localaccountsignup.en" />
        <LocalizedResourcesReference Language="es" LocalizedResourcesReferenceId="api.localaccountsignup.es" />
    </LocalizedResourcesReferences>
  </ContentDefinition>
</ContentDefinitions>

上傳並測試您已更新的自訂策略

上傳自定義原則

  1. 儲存延伸模組檔案。
  2. 如果您有多個租用戶的存取權,請使用頂端功能表中的 [設定] 圖示,從 [目錄 + 訂用帳戶] 功能表切換至您的 Azure AD B2C 租用戶。
  3. 搜尋並選取 Azure AD B2C
  4. 在 [ 原則] 底下,選取 [ 身分識別體驗架構]。
  5. 選取 上傳自定義政策
  6. 上傳您先前變更的擴展名檔案。

使用 [立即執行] 測試自定義原則

  1. 選取您上傳的原則,然後選取 [ 立即執行]。
  2. 您應該可以看到本地化的註冊或登入頁面。
  3. 按兩下註冊連結,您應該可以看到本地化的註冊頁面。
  4. 將您的瀏覽器預設語言切換為西班牙文。 或者,您可以將查詢字串參數 ui_locales 新增至授權要求。 例如:
HTTP
https://<tenant-name>.b2clogin.com/<tenant-name>.onmicrosoft.com/B2C_1A_signup_signin/oauth2/v2.0/authorize&client_id=00001111-aaaa-2222-bbbb-3333cccc4444&nonce=defaultNonce&redirect_uri=https%3A%2F%2Fjwt.ms&scope=openid&response_type=id_token&prompt=login&ui_locales=es

其他資訊

以頁面 UI 自訂標籤作為覆寫

當您啟用語言自訂時,您先前使用頁面 UI 自訂對標籤所進行的編輯會保存在英文 (en) 的 JSON 檔案中。 您可以上傳語言自訂中的語言資源,來繼續變更您的標籤和其他字串。

最新的翻譯

Microsoft 致力於提供最新的翻譯來供您使用。 Microsoft 會持續改善翻譯,並讓它們符合您的需求。 Microsoft會識別全域術語中的 Bug 和變更,並進行可順暢地在您的使用者流程中運作的更新。

支援從右至左的語言

Microsoft目前不支援由右至左的語言。 您可以使用自定義地區設定,並使用 CSS 來變更字串的顯示方式來完成此作業。 如果您需要此功能,請在 Azure 意見反應上投票給此功能。

社交識別提供者的翻譯

Microsoft 為社交登入提供 ui_locales OIDC 參數。 但有些社交識別提供者不接受此參數,包括 Facebook 和 Google。

瀏覽器行為

Microsoft Edge、Chrome 和 Firefox 要求設定其語言選項。 如果是支持的語言,則會在預設值之前顯示。

支援的語言

Azure AD B2C 包含下列語言的支援,方法是使用 ISO 639-1 代碼。 使用者流程語言是由 Azure AD B2C 提供。 多重要素驗證通知語言是由 Microsoft Entra 多重要素驗證提供。

語言 語言代碼 使用者流程圖 MFA 通知
阿拉伯文 阿拉伯語 X表示否。 綠色勾選符號。
保加利亞文 bg X表示否。 綠色勾選符號。
班格拉 綠色勾選符號。 X表示否。
加泰隆語 ca X表示否。 綠色勾選符號。
捷克 cs 綠色勾選符號。 綠色勾選符號。
丹麥文 (No improvements can be made without additional context.) 綠色勾選符號。 綠色勾選符號。
德語 綠色勾選符號。 綠色勾選符號。
希臘語 el 綠色勾選符號。 綠色勾選符號。
英語 en 綠色勾選符號。 綠色勾選符號。
西班牙文 es 綠色勾選符號。 綠色勾選符號。
愛沙尼亞語 et X表示否。 綠色勾選符號。
巴斯克文 歐盟 X表示否。 綠色勾選符號。
芬蘭文 芬蘭 綠色勾選符號。 綠色勾選符號。
法語 法國 綠色勾選符號。 綠色勾選符號。
加利西亞文 gl X表示否。 綠色勾選符號。
古吉拉特語 綠色勾選符號。 X表示否。
希伯來文 X表示否。 綠色勾選符號。
印地語 你好 綠色勾選符號。 綠色勾選符號。
克羅埃西亞語 人力資源 綠色勾選符號。 綠色勾選符號。
匈牙利語 綠色勾選符號。 綠色勾選符號。
印尼文 識別碼 X表示否。 綠色勾選符號。
義大利語 綠色勾選符號。 綠色勾選符號。
日語 ja 綠色勾選符號。 綠色勾選符號。
哈薩克語 kk X表示否。 綠色勾選符號。
卡納拉語 Known (假設 "kn" 代表 "known",則翻譯為「已知」) 綠色勾選符號。 X表示否。
朝鮮語 ko 綠色勾選符號。 綠色勾選符號。
立陶宛語 The translation remains as "lt" unless additional context is provided to clarify its meaning. X表示否。 綠色勾選符號。
拉脫維亞語 低壓 X表示否。 綠色勾選符號。
馬來亞拉姆文 毫升 綠色勾選符號。 X表示否。
馬拉地語 先生 綠色勾選符號。 X表示否。
馬來語 毫秒 綠色勾選符號。 綠色勾選符號。
挪威文 (巴克摩) 綠色勾選符號。 X表示否。
荷蘭語 綠色勾選符號。 綠色勾選符號。
挪威文 X表示否。 綠色勾選符號。
旁遮普語 爸爸 綠色勾選符號。 X表示否。
波蘭語 pl 綠色勾選符號。 綠色勾選符號。
葡萄牙文 - 巴西 pt-br 綠色勾選符號。 綠色勾選符號。
葡萄牙文 - 葡萄牙 pt-pt 綠色勾選符號。 綠色勾選符號。
羅馬尼亞 RO 綠色勾選符號。 綠色勾選符號。
俄語 RU 綠色勾選符號。 綠色勾選符號。
斯洛伐克語 sk 綠色勾選符號。 綠色勾選符號。
斯洛維尼亞文 sl X表示否。 綠色勾選符號。
塞爾維亞文 - 西里爾字母 SR-CRYL-CS 系列 X表示否。 綠色勾選符號。
塞爾維亞文 (拉丁) SR-LATN-CS X表示否。 綠色勾選符號。
瑞典文 SV 綠色勾選符號。 綠色勾選符號。
泰米爾語 他/她 綠色勾選符號。 X表示否。
泰盧固語 te 綠色勾選符號。 X表示否。
泰語 泰国 綠色勾選符號。 綠色勾選符號。
土耳其文 tr 綠色勾選符號。 綠色勾選符號。
烏克蘭文 英國 X表示否。 綠色勾選符號。
越南文 X表示否。 綠色勾選符號。
威爾士語 cy X表示否。 X表示否。
中文 - 簡體 zh-hans 綠色勾選符號。 綠色勾選符號。
中文(繁體) zh-hant 綠色勾選符號。 綠色勾選符號。

後續步驟

Azure Active Directory B2C 中自定義應用程式的使用者介面中,尋找如何自定義應用程式使用者介面的詳細資訊。


其他資源

文件