InfoWindow:在 div 标记内设置 lang 属性不起作用
我正在尝试将语言属性设置为除 div 标签内的“en”[说“ko”]。我创建的内容字符串 这种方式用于设置 InfoWindow 的 setContent()。不幸的是,我仍然看到英文文本,而不是我定义的语言值。 以下是相关代码片段:
content_string = '<div style="width: 210px; padding-right: 10px" lang="ko" xml:lang="ko">' + biz_name_html + '<br>' + biz_addr + '<br>' + biz_url_html + '<br>' + biz_phone + '<br>' + biz_description + '</div>';
marker = new google.maps.Marker({
position: latlng,
map: map,
title: biz_name,
html: content_string,
icon: new google.maps.MarkerImage(marker_icon_url)
});
google.maps.event.addListener(marker, 'click', function() {
info_window.setContent(this.html);
info_window.open(map, this);
});
I am trying to set language attribute to some value other than
"en" [say "ko"] inside a div tag. The content string that I create in
this way is being used to set the InfoWindow's setContent(). Unfortunately, I continue to see the text in English rather than the language value I have defined.
Here are the relevant pieces of code:
content_string = '<div style="width: 210px; padding-right: 10px" lang="ko" xml:lang="ko">' + biz_name_html + '<br>' + biz_addr + '<br>' + biz_url_html + '<br>' + biz_phone + '<br>' + biz_description + '</div>';
marker = new google.maps.Marker({
position: latlng,
map: map,
title: biz_name,
html: content_string,
icon: new google.maps.MarkerImage(marker_icon_url)
});
google.maps.event.addListener(marker, 'click', function() {
info_window.setContent(this.html);
info_window.open(map, this);
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
定义 lang 属性不会将文本转换为指定的语言。来自 htmlhelp.com
实际上将韩语放入您的 div 标签(或使用字符代码)将正确显示,例如:
Defining the lang attribute will not convert text to a specified language. From the htmlhelp.com
Actually putting Korean into your div tag (or using the character codes) will display correctly, such as :