diff --git a/README.md b/README.md index 87613e9..4a59e56 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ to your database, obviously): 'password' => 'h4ckr', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci' -)); +), 'en'); //English is the default messages language, may be left empty ``` ------------------------------------------------------------------------------------------------------------ diff --git a/src/LaravelBook/Ardent/Ardent.php b/src/LaravelBook/Ardent/Ardent.php index 4c5bb11..140410f 100755 --- a/src/LaravelBook/Ardent/Ardent.php +++ b/src/LaravelBook/Ardent/Ardent.php @@ -134,7 +134,7 @@ abstract class Ardent extends Model { protected static $externalValidator = false; /** - * A Translator instance, to be used by standalone Ardent instances. + * A Validation Factory instance, to be used by standalone Ardent instances with the Translator. * * @var \Illuminate\Validation\Factory */ @@ -484,7 +484,7 @@ public function getAttribute($key) { * @param array $connection Connection info used by {@link \Illuminate\Database\Capsule\Manager::addConnection}. * Should contain driver, host, port, database, username, password, charset and collation. */ - public static function configureAsExternal(array $connection) { + public static function configureAsExternal(array $connection, $lang = 'en') { $db = new DatabaseCapsule; $db->addConnection($connection); $db->setEventDispatcher(new Dispatcher(new Container)); @@ -495,11 +495,11 @@ public static function configureAsExternal(array $connection) { $db->bootEloquent(); - $translator = new Translator('en'); + $translator = new Translator($lang); $translator->addLoader('file_loader', new PhpFileLoader()); $translator->addResource('file_loader', - dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.'en'. - DIRECTORY_SEPARATOR.'validation.php', 'en'); + dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.$lang. + DIRECTORY_SEPARATOR.'validation.php', $lang); self::$externalValidator = true; self::$validationFactory = new ValidationFactory($translator);