You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2016/11/11 16:35:49 UTC
svn commit: r1769311 - in /myfaces/tobago/trunk: ./
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/
tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/
tobago-core/src/test/java/org/apache/myfaces/tobago/webapp/ tob...
Author: lofwyr
Date: Fri Nov 11 16:35:49 2016
New Revision: 1769311
URL: http://svn.apache.org/viewvc?rev=1769311&view=rev
Log:
TOBAGO-1618: Render lang-Attribute in <html>-Root
Modified:
myfaces/tobago/trunk/pom.xml
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/HtmlResponseWriter.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java
myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterUnitTest.java
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/6000-event/event.xhtml
Modified: myfaces/tobago/trunk/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/pom.xml?rev=1769311&r1=1769310&r2=1769311&view=diff
==============================================================================
--- myfaces/tobago/trunk/pom.xml (original)
+++ myfaces/tobago/trunk/pom.xml Fri Nov 11 16:35:49 2016
@@ -798,6 +798,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
+ <argLine>-Duser.language=en -Duser.region=US</argLine>
<!--
<childDelegation>false</childDelegation>
<forkMode>perTest</forkMode>
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/HtmlResponseWriter.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/HtmlResponseWriter.java?rev=1769311&r1=1769310&r2=1769311&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/HtmlResponseWriter.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/HtmlResponseWriter.java Fri Nov 11 16:35:49 2016
@@ -27,10 +27,12 @@ import org.apache.myfaces.tobago.interna
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
+import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.Arrays;
+import java.util.Locale;
public class HtmlResponseWriter extends TobagoResponseWriterBase {
@@ -145,6 +147,13 @@ public class HtmlResponseWriter extends
getWriter().write(HTML_DOCTYPE);
getWriter().write('\n');
startElement(HtmlElements.HTML);
+ final Locale locale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
+ if (locale != null) {
+ final String language = locale.getLanguage();
+ if (language != null) {
+ writeAttribute(HtmlAttributes.LANG, language, false);
+ }
+ }
}
@Override
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java?rev=1769311&r1=1769310&r2=1769311&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java Fri Nov 11 16:35:49 2016
@@ -46,6 +46,7 @@ public enum HtmlAttributes implements Ma
HTTP_EQUIV("http-equiv"),
ID("id"),
LABEL("label"),
+ LANG("lang"),
MAX("max"),
MAXLENGTH("maxlength"),
MEDIA("media"),
Modified: myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterUnitTest.java?rev=1769311&r1=1769310&r2=1769311&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterUnitTest.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterUnitTest.java Fri Nov 11 16:35:49 2016
@@ -48,7 +48,7 @@ public class TobagoResponseWriterUnitTes
writer.startDocument();
writer.endDocument();
Assert.assertEquals("content expected",
- "<!DOCTYPE html>\n\n<html>\n</html>", stringWriter.toString());
+ "<!DOCTYPE html>\n\n<html lang='en'>\n</html>", stringWriter.toString());
}
@Test
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/6000-event/event.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/6000-event/event.xhtml?rev=1769311&r1=1769310&r2=1769311&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/6000-event/event.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/6000-event/event.xhtml Fri Nov 11 16:35:49 2016
@@ -167,7 +167,7 @@
<tc:out value="#{planet.name}" labelLayout="skip"/>
</tc:column>
<tc:row>
- <f:ajax render=":::metrics" listener="#{eventController.ajaxListener}"/>
+ <f:ajax render="::metrics" listener="#{eventController.ajaxListener}"/>
</tc:row>
</tc:sheet>
<p>Not implemented yet</p>
@@ -179,7 +179,7 @@
<tc:out value="#{planet.name}" labelLayout="skip"/>
</tc:column>
<tc:row>
- <f:ajax event="dblclick" render=":::metrics" listener="#{eventController.ajaxListener}"/>
+ <f:ajax event="dblclick" render="::metrics" listener="#{eventController.ajaxListener}"/>
</tc:row>
</tc:sheet>-->
<p>Not implemented yet!</p>