> ## Documentation Index
> Fetch the complete documentation index at: https://docs-dev-fix-docs-5528-php-updates.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# ユニバーサルログインの国際化

> ログインページをローカライズする際に選択できる言語について説明します。

export const AuthCodeGroup = ({children, dropdown}) => {
  const [processedChildren, setProcessedChildren] = useState(children);
  useEffect(() => {
    let unsubscribe = null;
    function init() {
      unsubscribe = window.autorun(() => {
        const processChildren = node => {
          if (typeof node === "string") {
            let processedNode = node;
            for (const [key, value] of window.rootStore.variableStore.values.entries()) {
              const escapedKey = key.replaceAll(/[.*+?^${}()|[\]\\]/g, (String.raw)`\$&`);
              processedNode = processedNode.replaceAll(new RegExp(escapedKey, "g"), value);
            }
            return processedNode;
          } else if (Array.isArray(node)) {
            return node.map(processChildren);
          } else if (node && node.props && node.props.children) {
            return {
              ...node,
              props: {
                ...node.props,
                children: processChildren(node.props.children)
              }
            };
          }
          return node;
        };
        setProcessedChildren(processChildren(children));
      });
    }
    if (window.rootStore) {
      init();
    } else {
      window.addEventListener("adu:storeReady", init);
    }
    return () => {
      window.removeEventListener("adu:storeReady", init);
      unsubscribe?.();
    };
  }, [children]);
  return <CodeGroup dropdown={dropdown}>{processedChildren}</CodeGroup>;
};

export const AuthCodeBlock = ({filename, icon, language, highlight, children}) => {
  const [displayText, setDisplayText] = useState(children);
  const [copyText, setCopyText] = useState(children);
  const wrapperRef = React.useRef(null);
  useEffect(() => {
    let unsubscribe = null;
    function init() {
      if (!window.autorun || !window.rootStore) {
        return;
      }
      unsubscribe = window.autorun(() => {
        let processedChildrenForDisplay = children;
        let processedChildrenForCopy = children;
        for (const [key, value] of window.rootStore.variableStore.values.entries()) {
          const escapedKey = key.replaceAll(/[.*+?^${}()|[\]\\]/g, (String.raw)`\$&`);
          let displayValue = value;
          if (key === "{yourClientSecret}" && value !== "{yourClientSecret}") {
            displayValue = value.substring(0, 3) + "*****MASKED*****";
          }
          processedChildrenForDisplay = processedChildrenForDisplay.replaceAll(new RegExp(escapedKey, "g"), displayValue);
          processedChildrenForCopy = processedChildrenForCopy.replaceAll(new RegExp(escapedKey, "g"), value);
        }
        setDisplayText(processedChildrenForDisplay);
        setCopyText(processedChildrenForCopy);
      });
    }
    if (window.rootStore) {
      init();
    } else {
      window.addEventListener("adu:storeReady", init);
    }
    return () => {
      window.removeEventListener("adu:storeReady", init);
      unsubscribe?.();
    };
  }, [children]);
  useEffect(() => {
    if (!wrapperRef.current) return;
    const originalWriteText = navigator.clipboard.writeText.bind(navigator.clipboard);
    let isOverriding = false;
    const handleClick = e => {
      const button = e.target.closest('[data-testid="copy-code-button"]');
      if (!button || !wrapperRef.current.contains(button)) return;
      isOverriding = true;
      navigator.clipboard.writeText = text => {
        if (isOverriding) {
          isOverriding = false;
          navigator.clipboard.writeText = originalWriteText;
          return originalWriteText(copyText);
        }
        return originalWriteText(text);
      };
      setTimeout(() => {
        if (isOverriding) {
          isOverriding = false;
          navigator.clipboard.writeText = originalWriteText;
        }
      }, 100);
    };
    const wrapper = wrapperRef.current;
    wrapper.addEventListener('click', handleClick, true);
    return () => {
      wrapper.removeEventListener('click', handleClick, true);
      if (navigator.clipboard.writeText !== originalWriteText) {
        navigator.clipboard.writeText = originalWriteText;
      }
    };
  }, [copyText]);
  return <div ref={wrapperRef}>
      <CodeBlock filename={filename} icon={icon} language={language} lines highlight={highlight}>
        {displayText}
      </CodeBlock>
    </div>;
};

## ユニバーサルログインのローカライズ

ユニバーサルログインエクスペリエンスは、以下の言語にローカライズされています。

| 言語               | コード      |
| ---------------- | -------- |
| アルバニア語           | `sq`     |
| アムハラ語            | `am`     |
| アルメニア語           | `hy`     |
| アゼルバイジャン語        | `az`     |
| バスク語             | `eu-ES`  |
| ベンガル語            | `bn`     |
| ボスニア語            | `bs`     |
| ブルガリア語           | `bg`     |
| カタルニア語           | `ca-ES`  |
| 中国語 - 香港特別行政区    | `zh-HK`  |
| 中国語 - 簡体         | `zh-CN`  |
| 中国語 - 繁体         | `zh-TW`  |
| クロアチア語           | `hr`     |
| チェコ語             | `cs`     |
| デンマーク語           | `da`     |
| オランダ語            | `nl`     |
| 英語               | `en`     |
| 英語 - カナダ         | `en-CA`  |
| エストニア語           | `et`     |
| フィンランド語          | `fi`     |
| フランス語            | `fr-FR`  |
| フランス語 - カナダ      | `fr-CA`  |
| ガリシア語            | `gl-ES`  |
| ジョージア語           | `ka`     |
| ドイツ語             | `de`     |
| ギリシャ語            | `el`     |
| グジャラート語          | `gu`     |
| ヒンディー語           | `hi`     |
| ハンガリー語           | `hu`     |
| アイスランド語          | `is`     |
| インドネシア語          | `id`     |
| イタリア語            | `it`     |
| 日本語              | `ja`     |
| カンナダ語            | `kn`     |
| 韓国語              | `ko`     |
| ラトビア語            | `lv`     |
| リトアニア語           | `lt`     |
| マケドニア語           | `mk`     |
| マレー語             | `ms`     |
| マラヤーラム語          | `ml`     |
| マラーティー語          | `mr`     |
| モンゴル語            | `mn`     |
| モンテネグロ語          | `cnr`    |
| ミャンマー語           | `my`     |
| ノルウェー語           | `no`     |
| ノルウェー語 - ブークモール  | `nb`     |
| ノルウェー語 - ニーノシュク  | `nn`     |
| ポーランド語           | `pl`     |
| ポルトガル語 - ブラジル    | `pt-BR`  |
| ポルトガル語 - ポルトガル   | `pt-PT`  |
| パンジャブ語           | `pa`     |
| ルーマニア語           | `ro`     |
| ロシア語             | `ru`     |
| セルビア語            | `sr`     |
| スロバキア語           | `sk`     |
| スロベニア語           | `sl`     |
| ソマリ語             | `so`     |
| スペイン語            | `es`     |
| スペイン語 - アルゼンチン   | `es-AR`  |
| スペイン語 - ラテン アメリカ | `es-419` |
| スペイン語 - メキシコ     | `es-MX`  |
| スワヒリ語            | `sw`     |
| スウェーデン語          | `sv`     |
| タガログ語            | `tl`     |
| タマジット語           | `zgh`    |
| タミール語            | `ta`     |
| テルグ語             | `te`     |
| タイ語              | `th`     |
| トルコ語             | `tr`     |
| ウクライナ語           | `uk`     |
| ベトナム語            | `vi`     |
| ウェールズ語           | `cy`     |

### 言語の選択

ページの言語は、以下の条件に基づいて選択されます。

* Auth0がサポートする言語（上記に記載）。
* テナント設定で構成された言語のリスト。ここでテナントがサポートする言語を選択し、デフォルト言語を設定できます。このリストでは、デフォルトで英語のみが選択されていますが、必要な言語を選択できます。
* アプリケーションまたはセッションの言語リストを制限するための、[Authorization Requestエンドポイント](https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest)に送信される`ui_locales`パラメーターの値。スペース区切りのロケールのリストを指定できます。UIに反映されるためには、リストの最初のロケールがテナントで有効化されているロケールと一致している必要があります。
* ブラウザーによって送信される`Accept-Language` HTTPヘッダー。ページは、上記の設定で許可されている限り、この言語で表示されます。そうでない場合、ページはデフォルトの言語で表示されます。

上記に記載されていない言語を追加するには、管理APIを使用して、次の本文で[テナントエンドポイント](https://auth0.com/docs/api/management/v2/tenants/patch-settings)に`PATCH`呼び出しを行い、`he`を追加する言語コードに置き換えます。

```javascript lines theme={null}
{
  "enabled_locales": [
    "en","he"
  ]
}
```

追加したら、ログイン要求のui\_localesクエリパラメーターで言語を指定します。

### テナントでサポートされている言語を設定する

サポートされている言語とデフォルト言語は、Dashboardの[［Tenant Settings（テナント設定）］](https://manage.auth0.com/#/tenant)セクションで設定できます。

<Tooltip data-tooltip-id="react-containers-DefinitionTooltip-0" href="/docs/ja-jp/glossary?term=management-api" tip="Management API: 顧客が管理タスクを実行できるようにするための製品。" cta="用語集の表示">Management API</Tooltip>を使用して、[Update Tenant Settingsエンドポイント](/docs/ja-jp/api/management/v2#!/Tenants/patch_settings)からテナントの有効な言語を指定することもできます。リストの最初の言語がデフォルトの言語になります。

<AuthCodeGroup>
  ```bash cURL theme={null}
  curl --request PATCH \
    --url 'https://{yourDomain}/api/v2/tenants/settings' \
    --header 'authorization: Bearer API2_ACCESS_TOKEN' \
    --header 'content-type: application/json' \
    --data '{ "enabled_locales" : [ "en", "es"]}'
  ```

  ```csharp C# theme={null}
  var client = new RestClient("https://{yourDomain}/api/v2/tenants/settings");
  var request = new RestRequest(Method.PATCH);
  request.AddHeader("content-type", "application/json");
  request.AddHeader("authorization", "Bearer API2_ACCESS_TOKEN");
  request.AddParameter("application/json", "{ "enabled_locales" : [ "en", "es"]}", ParameterType.RequestBody);
  IRestResponse response = client.Execute(request);
  ```

  ```go Go theme={null}
  package main

  import (
  	"fmt"
  	"strings"
  	"net/http"
  	"io/ioutil"
  )

  func main() {

  	url := "https://{yourDomain}/api/v2/tenants/settings"

  	payload := strings.NewReader("{ "enabled_locales" : [ "en", "es"]}")

  	req, _ := http.NewRequest("PATCH", url, payload)

  	req.Header.Add("content-type", "application/json")
  	req.Header.Add("authorization", "Bearer API2_ACCESS_TOKEN")

  	res, _ := http.DefaultClient.Do(req)

  	defer res.Body.Close()
  	body, _ := ioutil.ReadAll(res.Body)

  	fmt.Println(res)
  	fmt.Println(string(body))

  }
  ```

  ```java Java theme={null}
  HttpResponse<String> response = Unirest.patch("https://{yourDomain}/api/v2/tenants/settings")
    .header("content-type", "application/json")
    .header("authorization", "Bearer API2_ACCESS_TOKEN")
    .body("{ "enabled_locales" : [ "en", "es"]}")
    .asString();
  ```

  ```javascript Node.JS theme={null}
  var axios = require("axios").default;

  var options = {
    method: 'PATCH',
    url: 'https://{yourDomain}/api/v2/tenants/settings',
    headers: {'content-type': 'application/json', authorization: 'Bearer API2_ACCESS_TOKEN'},
    data: {enabled_locales: ['en', 'es']}
  };

  axios.request(options).then(function (response) {
    console.log(response.data);
  }).catch(function (error) {
    console.error(error);
  });
  ```

  ```objc Obj-C theme={null}
  #import <Foundation/Foundation.h>

  NSDictionary *headers = @{ @"content-type": @"application/json",
                             @"authorization": @"Bearer API2_ACCESS_TOKEN" };
  NSDictionary *parameters = @{ @"enabled_locales": @[ @"en", @"es" ] };

  NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];

  NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://{yourDomain}/api/v2/tenants/settings"]
                                                         cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                     timeoutInterval:10.0];
  [request setHTTPMethod:@"PATCH"];
  [request setAllHTTPHeaderFields:headers];
  [request setHTTPBody:postData];

  NSURLSession *session = [NSURLSession sharedSession];
  NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
                                              completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
                                                  if (error) {
                                                      NSLog(@"%@", error);
                                                  } else {
                                                      NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
                                                      NSLog(@"%@", httpResponse);
                                                  }
                                              }];
  [dataTask resume];
  ```

  ```php PHP theme={null}
  $curl = curl_init();

  curl_setopt_array($curl, [
    CURLOPT_URL => "https://{yourDomain}/api/v2/tenants/settings",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "PATCH",
    CURLOPT_POSTFIELDS => "{ "enabled_locales" : [ "en", "es"]}",
    CURLOPT_HTTPHEADER => [
      "authorization: Bearer API2_ACCESS_TOKEN",
      "content-type: application/json"
    ],
  ]);

  $response = curl_exec($curl);
  $err = curl_error($curl);

  curl_close($curl);

  if ($err) {
    echo "cURL Error #:" . $err;
  } else {
    echo $response;
  }
  ```

  ```python Python theme={null}
  import http.client

  conn = http.client.HTTPSConnection("")

  payload = "{ "enabled_locales" : [ "en", "es"]}"

  headers = {
      'content-type': "application/json",
      'authorization': "Bearer API2_ACCESS_TOKEN"
      }

  conn.request("PATCH", "/{yourDomain}/api/v2/tenants/settings", payload, headers)

  res = conn.getresponse()
  data = res.read()

  print(data.decode("utf-8"))
  ```

  ```ruby Ruby theme={null}
  require 'uri'
  require 'net/http'
  require 'openssl'

  url = URI("https://{yourDomain}/api/v2/tenants/settings")

  http = Net::HTTP.new(url.host, url.port)
  http.use_ssl = true
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE

  request = Net::HTTP::Patch.new(url)
  request["content-type"] = 'application/json'
  request["authorization"] = 'Bearer API2_ACCESS_TOKEN'
  request.body = "{ "enabled_locales" : [ "en", "es"]}"

  response = http.request(request)
  puts response.read_body
  ```

  ```swift Swift theme={null}
  import Foundation

  let headers = [
    "content-type": "application/json",
    "authorization": "Bearer API2_ACCESS_TOKEN"
  ]
  let parameters = ["enabled_locales": ["en", "es"]] as [String : Any]

  let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

  let request = NSMutableURLRequest(url: NSURL(string: "https://{yourDomain}/api/v2/tenants/settings")! as URL,
                                          cachePolicy: .useProtocolCachePolicy,
                                      timeoutInterval: 10.0)
  request.httpMethod = "PATCH"
  request.allHTTPHeaderFields = headers
  request.httpBody = postData as Data

  let session = URLSession.shared
  let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
    if (error != nil) {
      print(error)
    } else {
      let httpResponse = response as? HTTPURLResponse
      print(httpResponse)
    }
  })

  dataTask.resume()
  ```
</AuthCodeGroup>

### 制限事項

* `ui_locales`パラメーターは、<Tooltip data-tooltip-id="react-containers-DefinitionTooltip-1" href="/docs/ja-jp/glossary?term=security-assertion-markup-language" tip="Security Assertion Markup Language（SAML）: パスワードなしに二者間で認証情報を交換できる標準化プロトコル。" cta="用語集の表示">SAML</Tooltip>や WS-Federationでは利用できないため、<Tooltip data-tooltip-id="react-containers-DefinitionTooltip-0" href="/docs/ja-jp/glossary?term=oath2" tip="OAuth 2.0: 認可プロトコルとワークフローを定義する認可フレームワーク。" cta="用語集の表示">OAuth</Tooltip>フローでしか使用できません。
* `ui_locales`パラメーターは、上流のアイデンティティプロバイダーには転送されません。アイデンティティプロバイダーにパラメーターを渡す方法については、「[パラメータをアイデンティティプロバイダーに渡す](/docs/ja-jp/authenticate/identity-providers/pass-parameters-to-idps)」をお読みください。
* 同意ページ内のスコープをローカライズすることはできません。

### 既知の問題

* ULPは、言語コード`fr-FR`に対してHTMLの`lang`属性を`fr`としてレンダリングします。
* ULPは、言語コード`pt-PT`に対してHTMLの`lang`属性を`pt`としてレンダリングします。

## クラシックログインのローカライズ

クラシックログインエクスペリエンスでは、[ログイン](/docs/ja-jp/customize/internationalization-and-localization/lock-internationalization)用のJavaScriptウィジェット、[パスワードリセットページ](/docs/ja-jp/customize/login-pages/classic-login/customize-password-reset-page)、[パスワードポリシー](/docs/ja-jp/customize/internationalization-and-localization/password-options-translation)を使用してローカライズが行われます。

[MFAページ](/docs/ja-jp/secure/multi-factor-authentication/customize-mfa/customize-mfa-classic-login)はデフォルトで、ローカライズできないAuth0 <Tooltip data-tooltip-id="react-containers-DefinitionTooltip-0" href="/docs/ja-jp/glossary?term=multifactor-authentication" tip="多要素認証（MFA）: ユーザー名とパスワードに加えて、SMS経由のコードなどの要素を使用するユーザー認証プロセス。" cta="用語集の表示">MFA</Tooltip>ウィジェットを使用しています。[guardian.js](https://github.com/auth0/auth0-guardian.js)を使用することで、ローカライズされたバージョンを作成できます。

同意ページをローカライズすることはできません。

## もっと詳しく

* [ユニバーサルログインのページテンプレートをカスタマイズする](/docs/ja-jp/customize/login-pages/universal-login/customize-templates)
* [クラシックログインページをLockまたはSDKでカスタマイズする](/docs/ja-jp/customize/login-pages/classic-login/customize-with-lock-sdk)
