返回新闻列表

网站自动翻译成英文,谷歌翻译api,怎样能打开网站默认自动翻译

发布日期: 2021-11-10 | 来源: 智软设计工作室

测试可用,就是要加载下js

网站自动翻译成英文

谷歌翻译api,怎样能打开网站默认自动翻译,设置Cookie就行了。 


也可以做多语言翻译。去除隐藏css选择项就行了。


<style><!--隐藏长条-->

.goog-te-banner-frame.skiptranslate {

    display: none !important;

} body { top: 0px !important; }

.goog-tooltip {

    display: none !important;

}

.goog-tooltip:hover {

    display: none !important;

}

.goog-text-highlight {

    background-color: transparent !important;

    border: none !important; 

    box-shadow: none !important;

}

</style>


<div id="google_translate_element" style="display:none">

<!--我是谁?翻译条-->

</div>

<!---写入cookie,默认翻译语言-->

<script type="text/javascript">

function setCookie(name, value) {

                var Days = 30;

                var exp = new Date();

                exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);

                document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();

            }


setCookie("googtrans", "/en/en");


function googleTranslateElementInit() {

  new google.translate.TranslateElement({pageLanguage: 'zh-CN', layout: google.translate.TranslateElement.FloatPosition.BOTTOM_RIGHT, multilanguagePage: true}, 'google_translate_element');

}

</script>

<script type="text/javascript" src="//translate.google.cn/translate_a/element.js?cb=googleTranslateElementInit">

</script>


推荐技术资料

pbootcms 判断电脑版和手机版 ,直接程序判断增加自定义标签函数

2024-08-19

修改文件/apps/home/controller/ExtLabelController.php1,找到代码$this->test();在下方添加代码$this->ismobile();2,新增ismobile()函数//判断是否移动端设备privatefunctionismobile(){&nbs

阅读更多

pboot:nav 加入多条件判断 pboot:if

2022-01-05

{pboot:navnum=7}<liclass="menu-item{pboot:if([nav:soncount]>0)}menu-item-has-children{/pboot:if}"><ahref="[nav:link]">[nav:name]</a>{pboot:if([nav:soncount]>0)}&

阅读更多

pbootcms 上传的图片自动转换webp,ueditor也自动转换,达到最佳网站加载速度

2024-12-23

pbootcms 上传的图片自动转换webp下面是修改过的文件。直接替换\core\function目录里的file.php文件.rar这里就不贴修改了。

阅读更多

.htaccess HTTP 80 强制转 HTTPS 443规则分享

2024-06-18

HTTP 80 强制转 HTTPS全站采用https协议访问,所以需要http重定向到https,只需要在.htaccess加入下面规则在相应的网站根目录新建 .htaccessRewriteEngineOnRewriteCond%{SERVER_PORT}80RewriteRule^(.*)$https://%{HTTP_HOST}/$1[R,L]COPY

阅读更多

pbootcms栏目三级分类循环与判断,更多级别也可以。

2024-04-28

大概 代码。是这样的。{pboot:nav num=10 parent=0}{pboot:if([nav:soncount]>0)}menu-item-has-children{/pboot:if} {pboot:2nav parent=[nav:scode]} {pboot:if([2nav:soncount]>0)}menu-item-has-children{/pboot:if} {pboot:3

阅读更多

pboot:list 调用tag链接,以及内容页和全站tag调用方法

2023-07-08

pboot:list 调用tag链接:{pboot:listnum=15order=sorting}&

阅读更多

ueditor 取消 过滤格式化规则 html css js 以及div转P问题解决

2022-03-08

主要更改二个js,1、ueditor.config.js2.在ueditor.all.js文件内搜索allowDivTransToP 将true设置为false(禁止将div 转为 p)

阅读更多

百度编辑器UEditor开源富文本编辑,加载bootstrap格栅系统-百度编辑器UEditor加入其他css样式

2023-02-28

百度开源富文本编辑器UEditor,如何加入其他css样式了?我们比如要在编辑器里面排版响应式布局。比如bootstrap的格栅系统。等其他样式,我们这里就不能实时预览。这个功能网站制作的时候还是比较常用。网络上找了一圈,好像没有这个文章。我研究了下。其他百度编辑器已经预留css文件。添加样式。大家在、/ueditor/themes/if

阅读更多

2021 godaddy域名转出教程 最新版 转入阿里云 半个小时就能转出成功

2021-11-05

首页到域名列表找到要转移的域名。点击进去。先解锁域名转移限制,然后点击转出域名获取 转移密码。然后到阿里云,提交转入,到这一部后再次进入godaddy,点击转移,到里面点击批准转出。 如果当天看不到。就隔天去godaddy 批准。这样不用等5-7天。就能转入了。

阅读更多