> ## Documentation Index
> Fetch the complete documentation index at: https://auth0.generaltranslation.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Lockの国際化

> Lock v11は複数の言語をサポートしており、それ以外のカスタム言語ファイルの追加と、Lockウィジェットに表示される特定のテキスト値のカスタマイズも可能です。

export const AuthCodeBlock = ({filename, icon, language, highlight, children}) => {
  const [processedChildren, setProcessedChildren] = useState(children);
  useEffect(() => {
    let unsubscribe = null;
    function init() {
      unsubscribe = window.autorun(() => {
        let processedChildren = children;
        for (const [key, value] of window.rootStore.variableStore.values.entries()) {
          processedChildren = processedChildren.replace(new RegExp(key, "g"), value);
        }
        setProcessedChildren(processedChildren);
      });
    }
    if (window.rootStore) {
      init();
    } else {
      window.addEventListener("adu:storeReady", init);
    }
    return () => {
      window.removeEventListener("adu:storeReady", init);
      unsubscribe?.();
    };
  }, [children]);
  return <CodeBlock filename={filename} icon={icon} language={language} lines highlight={highlight}>
      {processedChildren}
    </CodeBlock>;
};

Lockの言語は、`language`構成オプションを使用して変更できます。これにより、対応する言語ファイルがLockの`i18n`ディレクトリから取得されます。

<div id="provided-languages">
  ## 提供言語
</div>

[i18nディレクトリ](https://github.com/auth0/lock/blob/master/src/i18n/)の言語ファイルをご覧ください。

<table class="table">
  <thead>
    <tr>
      <th>言語</th>
      <th>コード</th>
      <th>ソース</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>アフリカーンス語</td>
      <td>`'af'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/af.js">af.js</a></td>
    </tr>

    <tr>
      <td>カタロニア語</td>
      <td>`'ca'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/ca.js">ca.js</a></td>
    </tr>

    <tr>
      <td>中国語</td>
      <td>`'zh'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/zh.js">zh.js</a></td>
    </tr>

    <tr>
      <td>中国語（台湾）</td>
      <td>`'zh-tw'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/zh-tw.js">zh-tw\.js</a></td>
    </tr>

    <tr>
      <td>クロアチア語</td>
      <td>`'hr'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/hr.js">hr.js</a></td>
    </tr>

    <tr>
      <td>チェコ語</td>
      <td>`'cs'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/cs.js">cs.js</a></td>
    </tr>

    <tr>
      <td>デンマーク語</td>
      <td>`'da'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/da.js">da.js</a></td>
    </tr>

    <tr>
      <td>オランダ語</td>
      <td>`'nl'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/nl.js">nl.js</a></td>
    </tr>

    <tr>
      <td>英語</td>
      <td>`'en'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/en.js">en.js</a></td>
    </tr>

    <tr>
      <td>エストニア語</td>
      <td>`'et'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/et.js">et.js</a></td>
    </tr>

    <tr>
      <td>ファルシ語（ペルシア語）</td>
      <td>`'fa'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/fa.js">fa.js</a></td>
    </tr>

    <tr>
      <td>フィンランド語</td>
      <td>`'fi'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/fi.js">fi.js</a></td>
    </tr>

    <tr>
      <td>フランス語</td>
      <td>`'fr'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/fr.js">fr.js</a></td>
    </tr>

    <tr>
      <td>ドイツ語</td>
      <td>`'de'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/de.js">de.js</a></td>
    </tr>

    <tr>
      <td>ギリシャ語</td>
      <td>`'el`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/el.js">el.js</a></td>
    </tr>

    <tr>
      <td>ヘブライ語</td>
      <td>`'he'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/he.js">he.js</a></td>
    </tr>

    <tr>
      <td>ハンガリー語</td>
      <td>`'hu'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/hu.js">hu.js</a></td>
    </tr>

    <tr>
      <td>イタリア語</td>
      <td>`'it'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/it.js">it.js</a></td>
    </tr>

    <tr>
      <td>日本語</td>
      <td>`'ja'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/ja.js">ja.js</a></td>
    </tr>

    <tr>
      <td>韓国語</td>
      <td>`'ko'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/ko.js">ko.js</a></td>
    </tr>

    <tr>
      <td>リトアニア語</td>
      <td>`'lt'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/lt.js">lt.js</a></td>
    </tr>

    <tr>
      <td>ノルウェー語</td>
      <td>`'no'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/no.js">no.js</a></td>
    </tr>

    <tr>
      <td>ノルウェー語（ブークモール）</td>
      <td>`'nb'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/nb.js">nb.js</a></td>
    </tr>

    <tr>
      <td>ノルウェー語（ニューノシク）</td>
      <td>`'nn'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/nn.js">nn.js</a></td>
    </tr>

    <tr>
      <td>ポーランド語</td>
      <td>`'pl'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/pl.js">pl.js</a></td>
    </tr>

    <tr>
      <td>ポルトガル語（ブラジル）</td>
      <td>`'pt-br'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/pt-br.js">pt-br.js</a></td>
    </tr>

    <tr>
      <td>ルーマニア語</td>
      <td>`'ro'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/ro.js">ro.js</a></td>
    </tr>

    <tr>
      <td>ロシア語</td>
      <td>`'ru'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/ru.js">ru.js</a></td>
    </tr>

    <tr>
      <td>スロバキア語</td>
      <td>`'sk'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/sk.js">sk.js</a></td>
    </tr>

    <tr>
      <td>スロベニア語</td>
      <td>`'sl'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/sl.js">sl.js</a></td>
    </tr>

    <tr>
      <td>スペイン語</td>
      <td>`'es'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/es.js">es.js</a></td>
    </tr>

    <tr>
      <td>スウェーデン語</td>
      <td>`'sv'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/sv.js">sv.js</a></td>
    </tr>

    <tr>
      <td>トルコ語</td>
      <td>`'tr'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/tr.js">tr.js</a></td>
    </tr>

    <tr>
      <td>ウクライナ語</td>
      <td>`'ua'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/uk.js">ua.js</a></td>
    </tr>

    <tr>
      <td>ベトナム語</td>
      <td>`'vi'`</td>
      <td><a href="https://github.com/auth0/lock/blob/master/src/i18n/vi.js">vi.js</a></td>
    </tr>
  </tbody>
</table>

<div id="set-language-option">
  ## 言語オプションを設定する
</div>

以下の例を使用するには、まずページにLockを含める必要があります。

`<script src="https://cdn.auth0.com/js/lock/11.14/lock.min.js"></script>`

次に、`options`オブジェクトを定義して`language`オプションを含めます。`language`オプションは、[Lock内](https://github.com/auth0/lock/tree/master/src/i18n)の`i18n`ディレクトリにある対応するファイルの名前と一致する文字列でなければなりません。その後、Lockをインスタンス化します。

export const codeExample1 = `// Select a supported language
var options = {
  language: 'es'
};

// Initiating our Auth0Lock
var lock = new Auth0Lock(
  '{yourClientId}',
  '{yourDomain}',
  options
);`;

<AuthCodeBlock children={codeExample1} language="javascript" />

Lockの翻訳データは、さまざまな翻訳を表すキー/値ペアのある言語ファイルから取得されます。一部の言語に欠落している値があり、その場合は「`language does not have property <missing prop>`（言語にプロパティがありません）」という警告が表示されます。このように欠落している値に遭遇した場合は、追加するためにぜひ[プル要求](https://github.com/auth0/lock/tree/master/src/i18n)を提出してください。もしくは、Lockの`options`で欠落している値を定義することもできます（下記参照）。

<div id="replace-dictionary-terms">
  ## 辞書の用語を置き換える
</div>

さらに、独自の辞書項目を`languageDictionary`オプションを使ってカスタマイズすることも可能です。この機能は、サポートされている言語を使用しつつ、いくつかの項目の文言を変更したい場合に便利です。たとえば、ユーザーに表示される`title`、あるいはその他のラベルの言葉を変更して、ウィジェットのそれ以外のテキストはそのまま使いたい場合です。

export const codeExample2 = `// Customize some languageDictionary attributes
var options = {
  languageDictionary: {
    emailInputPlaceholder: "something@youremail.com",
    title: "Log me in"
  },
};

// Initiating our Auth0Lock
var lock = new Auth0Lock(
  '{yourClientId}',
  '{yourDomain}',
  options
);`;

<AuthCodeBlock children={codeExample2} language="javascript" />

利用できる`languageDictionary`プロパティの例と、`language`ファイルの構造化の方法については、「[Lockの英語辞書ファイル](https://github.com/auth0/lock/blob/master/src/i18n/en.js)」を参照してください。

文字列値（URL）を取る`languageBaseUrl`オプションは、Auth0が提供する翻訳の言語ソースURLをオーバーライドします。デフォルトでは、提供言語の翻訳が保存されている場所、Auth0のCDN URL `https://cdn.auth0.com`を使用します。ここに別の値を入力すると、アプリケーションの必要に応じて言語翻訳に独自のソースを使用することができます。言語ソースはJavaScriptファイルでなければなりません。
