Skip to content

Commit

Permalink
Support for languages, covers greggilbert#87
Browse files Browse the repository at this point in the history
  • Loading branch information
bmichotte committed Jul 1, 2016
1 parent fb835b2 commit 909d436
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/RecaptchaServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,16 @@ public function boot()
*/
public function addValidator()
{
$translator = app('translator');
$translator->addNamespace('recaptcha', __DIR__ . '/lang');
$translator->load('recaptcha', 'recaptcha', $translator->locale());

$this->app->validator->extendImplicit('recaptcha', function ($attribute, $value, $parameters) {
$captcha = app('recaptcha.service');
$challenge = app('request')->input($captcha->getResponseKey());

return $captcha->check($challenge, $value);
}, 'Please ensure that you are a human!');
}, $translator->get('recaptcha::recaptcha.error'));
}

/**
Expand Down
5 changes: 5 additions & 0 deletions src/lang/en/recaptcha.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

return [
'error' => 'Please ensure that you are a human!'
];
5 changes: 5 additions & 0 deletions src/lang/fr/recaptcha.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

return [
'error' => 'Merci de vérifier que vous êtes un humain!'
];

0 comments on commit 909d436

Please sign in to comment.