0

As per GAR compliance, language has to be indicate with page.

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">`.

A GWT application indicates its supported locales list in in its gwt.xml, and the html page with the locale requested by the client gets served. How can a GWT application have the lang attribute set in the html tag? Our application is UI widget based, and therefore we don't have a host html page, but directly add the widget to the RootPanel().

1 Answer 1

1

Try this:

 Document.get().getDocumentElement().setAttribute("lang",
     LocaleInfo.getCurrentLocale().getLocaleName());
Sign up to request clarification or add additional context in comments.

3 Comments

I tried that: HelloWorld helloWorld = new HelloWorld("abcd"); // HelloWorld is a ui widget. Document.get().getBody().appendChild(helloWorld.getElement()); Document.get().getDocumentElement().setAttribute("lang", LocaleInfo.getCurrentLocale().getLocaleName()); But when I go to the page source of the rendered page on the browser, there is no attribute in the html tag.
Try .setAttribute("lang", "fr"). Do you have the same result?
Ok, your answer was already correct. Page source in the browser did not show the lang attribute but saving the page as a file and opening it in an editor shows the attribute.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.