Answer the question
In order to leave comments, you need to log in
Why user data in English, socialite + vk + laravel?
I made a way to register on the site through Vkontakte, I used socialite + vk provider + laravel. After registration, data about the user is returned, but the data is in English, although the site is in Russian. I checked on three accounts, from different locations in Russia, the data is still returned in English.
How can this be fixed? The vendor has the following request:
protected function getUserByToken($token)
{
$response = $this->getHttpClient()->get(
'https://api.vk.com/method/users.get?user_ids='.$token['user_id'].'&fields=uid,first_name,last_name,screen_name,photo'
);
.......
Answer the question
In order to leave comments, you need to log in
I thought about this option. When socialite receives user data, do not write it down, but make another call to vk api using the user ID, and pull out all the necessary information already in Russian, passing the lang=ru parameter, you will get one request to api more, but the result is necessary. The repeated appeal will be only at registration and not at each entrance to the site, so I think there will be nothing terrible from this. For now I will do so, but probably the problem is in the location of the server.
Try setting the application language variable in config/app.php to en
Set the variable VKONTAKTE_LANG with the value ru in the env file.VKONTAKTE_LANG=ru
/config/services.php
Where you have settings for VK, add 'lang'=>'ru', you should get something like:
'vkontakte' => [
'client_id' => env('VKONTAKTE_CLIENT_ID'),
'client_secret' => env('VKONTAKTE_CLIENT_SECRET'),
'redirect' => env('VKONTAKTE_REDIRECT_URI') ,
'lang' => 'en'
],
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question