通过JS判断浏览器语言后跳转到对应谷歌对应语言翻译

admin4年前javascript565

        <script>
        var lang = navigator.language || navigator.userLanguage;
        if(!/google|goog/i.test(window.location.href)) {
            if(lang == "es"){
                window.location.href = 'https://translate.google.com/translate?sl=auto&tl=es&u='+nowSiteUrl;
            }else if(lang == 'fr'){
                window.location.href = 'https://translate.google.com/translate?sl=auto&tl=fr&u='+nowSiteUrl;
            }else if(lang == 'de'){
                window.location.href = 'https://translate.google.com/translate?sl=auto&tl=de&u='+nowSiteUrl;
            }else if(lang == 'ru'){
                window.location.href = 'https://translate.google.com/translate?sl=auto&tl=ru&u='+nowSiteUrl;
            }else if(lang == 'da'){
                window.location.href = 'https://translate.google.com/translate?sl=auto&tl=da&u='+nowSiteUrl;
            }
        }
        </script>

相关文章

paypal sandbox账号密码

sb-ix9iy15691932@business.example.com5fBKPo$Z...

vuejs学习官网

https://cn.vuejs.org/...

rem与px换算的计算方式

rem与px换算的计算方式

前言这段时间的小项目中算是真正意义上使用了rem来进行移动端的页面布局,项目结束了我反思了一下之前的对于rem的使用...原来我以前对rem用法完全是在搞笑啊!!结合这次这个小项目,我觉得我也有必要对...

用rem怎么解决【移动端或pc端适配】问题?

https://blog.csdn.net/weixin_50450473/article/details/119169118...

viewjs使用参考

https://www.jq22.com/jquery-info6536{eyou:static file="/public/plugins/viewerjs/css/viewer.min....

thinkphp第三方类库放到extend如何引用?生成条形码barcodegen扩展包

1.下载barcodegen扩展包官网地址:https://www.barcodebakery.com2.下载完后解压至 extend/BarcodeBakery文件夹use BarcodeBaker...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。