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

> Auth0 を使用して、iOS向け Lock をアプリケーションに国際化対応させます。

# Lock.swift の国際化

デフォルトでは、[**iOS向け Lock v2**](/docs/ja-jp/libraries/lock-swift) のテキストはすべて英語で表示されます。別の言語で表示したい場合や、アプリケーション用に文言を変更したい場合は、`Lock.strings` ファイルを用意し、Lock が表示する各種テキスト項目に使用する値を定義できます。

言語の扱い方について詳しくは、Apple の公式ドキュメント [Internationalization and Localization](https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPInternational/Introduction/Introduction.html) を参照してください。

<div id="lock-string-values">
  ## Lock の文字列
</div>

Lock で使用される用語の一覧については、Lock.swift リポジトリ内の基本の [Lock.strings](https://raw.githubusercontent.com/auth0/Lock.swift/master/Lock/Base.lproj/Lock.strings) ファイルを参照してください。

<div id="providing-alternative-english-strings">
  ### 英語の代替文字列を設定する
</div>

既存の文言の一部またはすべてを変更したい場合は、[Lock.strings](https://raw.githubusercontent.com/auth0/Lock.swift/master/Lock/Base.lproj/Lock.strings) ファイルをダウンロードしてプロジェクトに追加することで対応できます。

**Lock.strings** ファイルを選択し、`File inspector` で `Localize...` をクリックします。

<Frame>
  <img src="https://mintcdn.com/translations/Dcx0M11uuptU53TX/docs/images/cdy7uua7fh8z/2dL3QXXrURBjNjyF5R0xYG/68cf0217f351bfb5e5a0bf45a7361b03/xcode_localize.png?fit=max&auto=format&n=Dcx0M11uuptU53TX&q=85&s=8915174cc28d0c7cd33e6ec87931ebee" alt="Lock.swift: Localize" width="288" height="59" data-path="docs/images/cdy7uua7fh8z/2dL3QXXrURBjNjyF5R0xYG/68cf0217f351bfb5e5a0bf45a7361b03/xcode_localize.png" />
</Frame>

次に、`English` を選択します。

<Frame>
  <img src="https://mintcdn.com/translations/Dcx0M11uuptU53TX/docs/images/cdy7uua7fh8z/2dffBsE133pnk0Y7Y0nxHU/8b82700bbd844d5df0864287b7a0acdf/xcode_localize_english.png?fit=max&auto=format&n=Dcx0M11uuptU53TX&q=85&s=561aea3ee3e3d90d66ca2bc050ee9851" alt="Lock.swift: Localize English" width="470" height="205" data-path="docs/images/cdy7uua7fh8z/2dffBsE133pnk0Y7Y0nxHU/8b82700bbd844d5df0864287b7a0acdf/xcode_localize_english.png" />
</Frame>

では、**Lock.strings** 内のいくつかの文言を別のテキストに変更してみましょう。

`// Forgot password
"com.auth0.lock.database.button.forgot_password" = "Did you forget your password?";
// tos & privacy
"com.auth0.lock.database.button.tos" = "Signing up is an indication of your agreement to our terms of\n service and privacy policy";`

<div id="supporting-other-languages">
  ### 他言語への対応
</div>

別の言語を追加するには、まず `Project/Info` で新しい言語を追加する必要があります。

<Frame>
  <img src="https://mintcdn.com/translations/3nS3prIggmJG9TUI/docs/images/cdy7uua7fh8z/3mHt6UmbEq7Xl05OZqtF70/20055f0037971f7b8c921d5902559b93/xcode_add_language.png?fit=max&auto=format&n=3nS3prIggmJG9TUI&q=85&s=f58873abead479066426c8b25c007567" alt="Lock.swift: Add language" width="1013" height="213" data-path="docs/images/cdy7uua7fh8z/3mHt6UmbEq7Xl05OZqtF70/20055f0037971f7b8c921d5902559b93/xcode_add_language.png" />
</Frame>

新しい言語を追加し、**Lock.strings** が選択されていることを確認します。

<Frame>
  <img src="https://mintcdn.com/translations/6GE5Z24GDCZehiJ9/docs/images/cdy7uua7fh8z/6E7BZaCVtkHcCQFhEcgSTq/3314eb8142c03266b25ab84fbefbb8f6/xcode_add_language_step_2.png?fit=max&auto=format&n=6GE5Z24GDCZehiJ9&q=85&s=e0658264890b6cf0f2cf85ea3c3f8328" alt="Lock.swift: Add Language step 2" width="1091" height="645" data-path="docs/images/cdy7uua7fh8z/6E7BZaCVtkHcCQFhEcgSTq/3314eb8142c03266b25ab84fbefbb8f6/xcode_add_language_step_2.png" />
</Frame>

すると、**Lock.strings** の下に、**Reference Language** の設定に基づいて、指定した言語用の新しいファイルが作成されていることがわかります。

これで、目的の言語への翻訳を始める準備が整いました。

<div id="notes">
  ### 注意
</div>

一部の用語ではパラメータが使用されており、翻訳時にはその位置に注意することが重要です。特に、次のように複数のパラメータを含む用語には注意してください。

`// No more than %@{count} identical characters in a row (such as, \"%@{identical sample}\" not allowed)
"com.auth0.lock.error.password.no_more_identical" = "No more than %1$d identical characters in a row (such as, \"%2$@\" not allowed)";`
