Skip to content

Commit a207622

Browse files
committed
added language support
1 parent 6ef27eb commit a207622

File tree

6 files changed

+28
-3
lines changed

6 files changed

+28
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ This package requires the following dependencies:
5555
Via Composer
5656

5757
``` sh
58-
$ composer require timehunter/laravel-google-recaptcha-v3 "~1.2.3"
58+
$ composer require timehunter/laravel-google-recaptcha-v3 "~1.2.4"
5959
```
6060

6161
If your Laravel framework version <= 5.4, please register the service provider in your config file: /config/app.php, otherwise please skip it.

config/googlerecaptchav3.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,13 @@
9898
| Google reCAPTCHA API
9999
*/
100100
'site_verify_url' => 'https://www.google.com/recaptcha/api/siteverify',
101+
102+
/*
103+
|--------------------------------------------------------------------------
104+
| Language
105+
|--------------------------------------------------------------------------
106+
| Type: string
107+
| https://developers.google.com/recaptcha/docs/language
108+
*/
109+
'language' => 'en'
101110
];

resources/views/googlerecaptchav3/template.blade.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ function onloadCallback() {
55
let client{{$field}} = grecaptcha.render('{{$field}}', {
66
'sitekey': '{{$publicKey}}',
77
@if($inline===true) 'badge': 'inline', @endif
8-
'size': 'invisible'
8+
'size': 'invisible',
9+
'hl' : '{{$language}}'
910
});
1011
grecaptcha.ready(function () {
1112
grecaptcha.execute(client{{$field}}, {

src/Configurations/ReCaptchaConfigV3.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,12 @@ public function isInline()
8181
{
8282
return config('googlerecaptchav3.inline');
8383
}
84+
85+
/**
86+
* @return string
87+
*/
88+
public function getLanguage()
89+
{
90+
return config('googlerecaptchav3.language');
91+
}
8492
}

src/GoogleReCaptchaV3.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ public function render($mappers)
4545
[
4646
'publicKey' => $this->getConfig()->getSiteKey(),
4747
'mappers' => $prepareData,
48-
'inline' => $this->config->isInline()
48+
'inline' => $this->config->isInline(),
49+
'language' => $this->config->getLanguage()
4950
]
5051
);
5152
}

src/Interfaces/ReCaptchaConfigV3Interface.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,10 @@ public function getHostName();
5656
* @return boolean
5757
*/
5858
public function isInline();
59+
60+
61+
/**
62+
* @return string
63+
*/
64+
public function getLanguage();
5965
}

0 commit comments

Comments
 (0)