GWT服务的html页面如何设置lang属性?

GWT服务的html页面如何设置lang属性?,gwt,lang,Gwt,Lang,根据GAR合规性,必须在页面上注明语言 Question 2.9. Is the content’s human language indicated in the markup? E.g. for a page written in all one language, `<html lang="fr">`, or for a multi-lingual page, `<div lang="fr">`. 问题2.9。标记中是否指示了内容的人类语言? 例如,对于所有一种

根据GAR合规性,必须在页面上注明语言

Question 2.9. Is the content’s human language indicated in the markup?
E.g. for a page written in all one language, `<html lang="fr">`, or for a multi-lingual page,  `<div lang="fr">`.
问题2.9。标记中是否指示了内容的人类语言?
例如,对于所有一种语言编写的页面,``,或者对于多语言页面,``。
GWT应用程序在其GWT.xml中指示其受支持的区域设置列表,并提供客户端请求的具有该区域设置的html页面。 GWT应用程序如何在html标记中设置lang属性? 我们的应用程序是基于UI小部件的,因此我们没有主机html页面,而是直接将小部件添加到RootPanel()

试试这个:

 Document.get().getDocumentElement().setAttribute("lang",
     LocaleInfo.getCurrentLocale().getLocaleName());

我试过了:HelloWorld HelloWorld=新HelloWorld(“abcd”);//HelloWorld是一个ui小部件。Document.get().getBody().appendChild(helloWorld.getElement());Document.get().getDocumentElement().setAttribute(“lang”,LocaleInfo.getCurrentLocale().getLocaleName());但是,当我在浏览器上转到呈现页面的页面源时,html标记中没有任何属性。Try.setAttribute(“lang”、“fr”)。你有相同的结果吗?好的,你的答案已经正确了。浏览器中的页面源未显示lang属性,但将页面另存为文件并在编辑器中打开会显示该属性。