谷歌翻译setcookie默认语言不起作用

时间:2017-04-28 15:59:28

标签: javascript php jquery html

我无法设置googletrans Cookie来设置默认语言(意大利语)。我的代码:

<html>
<body>
<?php 
if(!isset($_COOKIE['googtrans']))
{
  setcookie('googtrans', '/en/it',  time()+3600, '/','.impiantild.it'); 
  header("Location: www.impiantild.it"); //redirect to himself
}
?>

<div id="google_translate_element"></div><script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({pageLanguage: 'en', includedLanguages: 'ar,en,es,it,zh-TW', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');
}
</script><script type="text/javascript" src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

</body>
</html>

0 个答案:

没有答案