sumit sumit - 17 days ago 7
PHP Question

Get google translate dropdown selected language in PHP

I am using Google translate dropdown on my website where user can select any language and after that when user navigate the google translate keep translating pages automatically to selected language.

I want to save selected language on every page load. So how can I get selected language in google translate using PHP. I know they are saving it somewhere in session, but cant find out how to access that.

I am using this one:


You have to do some digging and check to see what Google translate is using to store user preference but if I guess correctly it would be a cookie. If it is a cookie you need to know the cookie name. If you get the cookie name you can refer to it using the $_COOKIE['cookie_name']. To get the cookie name. Open your site in chrome and open the chrome dev tools type this command in the console: document.cookie()