简体   繁体   English

Google翻译无法更改语言吗?

[英]Google Translate not working on changing language?

I have just added a google translate in website.And set the default language English. 我刚刚在网站上添加了Google翻译,并设置了默认语言为英语。 I have a jquery slider on this page.Now what is happening is that text is shown only when the page reloads in description of images contained in a jquery slider. 我在此页面上有一个jquery滑块。现在发生的事情是,仅当页面重新加载jquery滑块中包含的图像的描述时才显示文本。 After changing the language through GOOGLE translate, the text disappears and only images are displayed in the jquery slider. 通过GOOGLE翻译更改语言后,文本消失,并且jquery滑块中仅显示图像。 Can anyone help me out why this is happening. 谁能帮我解决为什么会这样。 Thank you in advance. 先感谢您。

Google translate injects span tags in the document while translating. Google翻译会在翻译时在文档中插入span标签。 jQuery-ui powered widgets such as sliders also use spans for example to represent buttons, graphics and icons. jQuery-ui驱动的小部件(例如滑块)也使用跨度来表示按钮,图形和图标。 When the page is translated, the spans added by Google translate conflict with those used by jQuery-ui elements, often resulting in broken functionality and appearance. 翻译页面时,Google翻译添加的跨度与jQuery-ui元素使用的跨度冲突,通常会导致功能和外观损坏。

The solution is to add a notranslate class to the elements that you do not want translated ( ref ). 解决方案是将notranslate类添加到您不希望翻译的元素( ref )。 Example: 例:

<div id="slider" class="notranslate"></div>
$(function() {
    $( "#slider" ).slider();
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM