LoginSignup
4
9

More than 3 years have passed since last update.

FirebaseUI(iOS)を日本語で使う方法

Last updated at Posted at 2019-05-25

FirebaseUIの使い方はたくさん出てくるけど、日本語で使う方法がなかなか見つからなかったので記事にしておきます。

環境

  • Swift 4.2.1
  • FirebaseUI 6.2.1

バンドルの追加

まず、GitHubからFirebaseUI-iOSのソースをダウンロードします。
次にダウンロードしたファイルを解凍して、以下の場所のFirebaseAuthUI.stringsをja.lprojフォルダごと自分のプロジェクトにコピーします。
Auth/FirebaseAuthUI/Strings/ja.lproj/FirebaseAuthUI.strings
※ファイルだけコピーするとバンドルと認識されないので注意!

ソースの変更

FirebaseUIのカスタムバンドルに先ほど追加したFirebaseAuthUI.stringsを設定します。

if let bundlePath = Bundle.main.path(forResource: "FirebaseAuthUI", ofType: "strings") {
    let bundle = Bundle(path: bundlePath)
    authUI?.customStringsBundle = bundle
}

実行結果

実行すると、このように日本語で表示されます。

iOS の画像.png

ちなみにメールを日本語化するには、メールを送る前に以下のコードを実行すればOKです。
(Firebaseコンソールで日本語のテンプレートを選択しただけでは日本語にならないので注意!)

Auth.auth().languageCode = "jp"
4
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
9