sfDoctrineGuardPluginの日本語用辞書ファイル
sfDoctrineGuardPluginのユーザー向け画面(管理画面を除く)のリソースを日本語化するための辞書ファイルです。
次の内容を「sf_guard.ja.xml」という名前で、/plugins/sfDoctrineGuardPlugin/i18n ディレクトリに保存してください。
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE xliff PUBLIC "-//XLIFF//DTD XLIFF//EN" "http://www.oasis-open.org/committees/xliff/documents/xliff.dtd" > <xliff version="1.0"> <file original="global" source-language="en" datatype="plaintext"> <header/> <body> <trans-unit> <source>Username</source> <target>ユーザー名</target> </trans-unit> <trans-unit> <source>Password</source> <target>パスワード</target> </trans-unit> <trans-unit> <source>Username or E-Mail</source> <target>ユーザー名またはE メール</target> </trans-unit> <trans-unit> <source>First name</source> <target>姓</target> </trans-unit> <trans-unit> <source>Last name</source> <target>名</target> </trans-unit> <trans-unit> <source>Password again</source> <target>パスワード (確認)</target> </trans-unit> <trans-unit> <source>Required.</source> <target>必須</target> </trans-unit> <trans-unit> <source>Change</source> <target>変更</target> </trans-unit> <trans-unit> <source>Email address</source> <target>E メール</target> </trans-unit> <trans-unit> <source>Remember</source> <target>次回からの入力を省略</target> </trans-unit> <trans-unit> <source>Signin</source> <target>サインイン</target> </trans-unit> <trans-unit> <source>Register</source> <target>登録</target> </trans-unit> <trans-unit> <source>Request</source> <target>パスワードのリセット情報をリクエスト</target> </trans-unit> <trans-unit> <source>Hi %first_name%</source> <target>%first_name% さんのパスワードの設定</target> </trans-unit> <trans-unit> <source>Hello %name%</source> <target>%name% さんのパスワードの設定</target> </trans-unit> <trans-unit> <source>Forgot your password?</source> <target>パスワードをお忘れですか?</target> </trans-unit> <trans-unit> <source>Want to register?</source> <target>登録しますか?</target> </trans-unit> <trans-unit> <source>The two passwords must be the same.</source> <target>パスワードの入力が一致しません。</target> </trans-unit> <trans-unit> <source>Enter your new password in the form below.</source> <target>新しいパスワードを入力してください。</target> </trans-unit> <trans-unit> <source>You don't have the required permission to access this page.</source> <target>このページにアクセスする権限がありません。</target> </trans-unit> <trans-unit> <source>Do not worry, we can help you get back in to your account safely!</source> <target>アカウントに登録されている E メールアドレスを入力して送信してください。</target> </trans-unit> <trans-unit> <source>Fill out the form below to request an e-mail with information on how to reset your password.</source> <target>パスワードをリセットするための URL を E メールでお送りします。</target> </trans-unit> </body> </file> </xliff>
また、この日本語リソースを有効にするために、次の手順が必要です。
- アプリケーションでi18nを有効にします。
- sf_guard辞書が使われるように以下のファイルに setup() メソッドを追加します。
- /plugins/sfDoctrineGuardPlugin/lib/form/doctrine 配下の
- sfGuardChangeUserPasswordForm.class
- sfGuardFormSignin.class
- sfGuardRegisterForm.class
- /plugins/sfDoctrineGuardPlugin/lib/form 配下の
- sfGuardRequestForgotPasswordForm.class
- /plugins/sfDoctrineGuardPlugin/lib/form/doctrine 配下の
<?php public function setup() { parent::setup(); $this->widgetSchema->getFormFormatter()->setTranslationCatalogue('sf_guard'); }
プラグイン内のコードを直接変更するのはややためらわれますが、プラグイン内にのみ影響する処理なのであえてここで変更しています。
※上記カタログの指定は、setup()メソッドではなくてconfigure()メソッドでもOKです。