I made my own solution based on "select" version of Google Translate:
<div id="google_translate_element"></div><script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'pl', includedLanguages: 'de,en,pl', autoDisplay: false}, 'google_translate_element');
}
</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
I used setcookie() on PHP:
if ($_GET['lang']) {
setcookie("googtrans", "", time() - 3600);
$domena = "." . $_SERVER['HTTP_HOST'];
setcookie("googtrans", '/pl/' . $_GET['lang'], time()+(3600*24), '/' , $domena);
}
I don't know why google script makes 2 same cookies, with the same name, but different domain:
look at the screen of EditThisCookie
($_COOKIE[] sees only one cookie)
so this code needs to name domain with "." on beggining, and first delete "googtrans" cookie (doesnt work without deleting ;/ ).
and here are my html icons:
wybierz język:
<a href="?lang=pl"><img src="imgcss/pl.png" alt="" /></a>
<a href="?lang=en"><img src="imgcss/en.png" alt="" /></a>
<a href="?lang=de"><img src="imgcss/de.png" alt="" /></a>
and to hide default google select list which is generated, just add one line to css code:
#google_translate_element {display: none; }
Remember to change page language values before using code above ;)