You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by dk...@apache.org on 2018/02/15 22:26:30 UTC

[sling-whiteboard] branch master updated: Fixing issues with the i18n editor, adding langage as a parameter for sites and adding support to retrieve the i18n locale for all content pages

This is an automated email from the ASF dual-hosted git repository.

dklco pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git


The following commit(s) were added to refs/heads/master by this push:
     new 43213cd  Fixing issues with the i18n editor, adding langage as a parameter for sites and adding support to retrieve the i18n locale for all content pages
43213cd is described below

commit 43213cdd52f2bf73d6688b1bb52217d4aef36dbd
Author: Dan Klco <da...@gmail.com>
AuthorDate: Thu Feb 15 17:26:09 2018 -0500

    Fixing issues with the i18n editor, adding langage as a parameter for
    sites and adding support to retrieve the i18n locale for all content
    pages
---
 cms/core/pom.xml                                   | 39 +++++----
 .../java/org/apache/sling/cms/CMSConstants.java    | 13 ++-
 .../{PublishFilter.java => LocaleFilter.java}      | 56 +++++--------
 .../sling/cms/core/filters/PublishFilter.java      |  4 +
 .../apache/sling/cms/core/models/LocaleList.java   | 48 +++++++++++
 .../org/apache/sling/cms/core/models/Site.java     | 94 ++++++++++++++++++----
 .../apache/sling/cms/reference/models/Search.java  |  5 +-
 .../resources/SLING-INF/nodetypes/nodetypes.cnd    |  1 +
 .../resources/jcr_root/apps/reference/i18n.json    | 32 ++++++++
 .../libs/sling-cms/components/cms/blank/blank.jsp  | 18 +++++
 .../sling-cms/components/cms/i18ntable/config.json |  3 -
 .../components/cms/i18ntable/i18ntable.jsp         |  3 +-
 .../components/editor/scripts/localeOptions.jsp    | 27 +++++++
 .../libs/sling-cms/content/i18n/dictionaries.json  |  2 +-
 .../sling-cms/content/i18n/language/create.json    | 12 +--
 .../libs/sling-cms/content/site/create.json        |  8 ++
 .../jcr_root/libs/sling-cms/content/site/edit.json | 17 ++++
 17 files changed, 297 insertions(+), 85 deletions(-)

diff --git a/cms/core/pom.xml b/cms/core/pom.xml
index b1f77d6..c38370c 100644
--- a/cms/core/pom.xml
+++ b/cms/core/pom.xml
@@ -1,27 +1,26 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-        Licensed to the Apache Software Foundation (ASF) under one or more contributor license
-        agreements. See the NOTICE file distributed with this work for additional information
-        regarding copyright ownership. The ASF licenses this file to you under the Apache License,
-        Version 2.0 (the "License"); you may not use this file except in compliance with the
-        License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-        Unless required by applicable law or agreed to in writing, software distributed under the
-        License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
-        either express or implied. See the License for the specific language governing permissions
-        and limitations under the License.
-    -->
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
+	license agreements. See the NOTICE file distributed with this work for additional 
+	information regarding copyright ownership. The ASF licenses this file to 
+	you under the Apache License, Version 2.0 (the "License"); you may not use 
+	this file except in compliance with the License. You may obtain a copy of 
+	the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
+	by applicable law or agreed to in writing, software distributed under the 
+	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
+	OF ANY KIND, either express or implied. See the License for the specific 
+	language governing permissions and limitations under the License. -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 	<modelVersion>4.0.0</modelVersion>
-    <parent>
-        <artifactId>org.apache.sling.cms</artifactId>
-        <groupId>org.apache.sling</groupId>
-        <version>1.0.0-SNAPSHOT</version>
-    </parent>
+	<parent>
+		<artifactId>org.apache.sling.cms</artifactId>
+		<groupId>org.apache.sling</groupId>
+		<version>1.0.0-SNAPSHOT</version>
+	</parent>
 	<artifactId>org.apache.sling.cms.core</artifactId>
 	<packaging>bundle</packaging>
 	<name>Apache Sling - CMS Core</name>
-	
+
 	<build>
 		<plugins>
 			<plugin>
@@ -257,6 +256,12 @@
 			<version>1.0.2</version>
 			<scope>provided</scope>
 		</dependency>
+		<dependency>
+			<artifactId>jstl</artifactId>
+			<version>1.2_1</version>
+			<groupId>org.apache.geronimo.bundles</groupId>
+			<scope>provided</scope>
+		</dependency>
 
 	</dependencies>
 
diff --git a/cms/core/src/main/java/org/apache/sling/cms/CMSConstants.java b/cms/core/src/main/java/org/apache/sling/cms/CMSConstants.java
index 76e814d..616c63d 100644
--- a/cms/core/src/main/java/org/apache/sling/cms/CMSConstants.java
+++ b/cms/core/src/main/java/org/apache/sling/cms/CMSConstants.java
@@ -27,6 +27,11 @@ public class CMSConstants {
 	public static final String ATTR_EDIT_ENABLED = "cmsEditEnabled";
 
 	/**
+	 * The Component type for pages
+	 */
+	public static final String COMPONENT_TYPE_PAGE = "Page";
+
+	/**
 	 * Content path.
 	 */
 	public static final String CONTENT_PATH = "/content";
@@ -57,14 +62,14 @@ public class CMSConstants {
 	public static final String NT_SITE = NAMESPACE + ":Site";
 
 	/**
-	 * The Component type for pages
+	 * Description attribute name
 	 */
-	public static final String COMPONENT_TYPE_PAGE = "Page";
+	public static final String PN_DESCRIPTION = "jcr:description";
 
 	/**
-	 * Description attribute name
+	 * i18n Locale property
 	 */
-	public static final String PN_DESCRIPTION = "jcr:description";
+	public static final String PN_LANGUAGE =  "jcr:language";
 
 	/**
 	 * Published flag property
diff --git a/cms/core/src/main/java/org/apache/sling/cms/core/filters/PublishFilter.java b/cms/core/src/main/java/org/apache/sling/cms/core/filters/LocaleFilter.java
similarity index 51%
copy from cms/core/src/main/java/org/apache/sling/cms/core/filters/PublishFilter.java
copy to cms/core/src/main/java/org/apache/sling/cms/core/filters/LocaleFilter.java
index b34cce2..38744d9 100644
--- a/cms/core/src/main/java/org/apache/sling/cms/core/filters/PublishFilter.java
+++ b/cms/core/src/main/java/org/apache/sling/cms/core/filters/LocaleFilter.java
@@ -17,6 +17,7 @@
 package org.apache.sling.cms.core.filters;
 
 import java.io.IOException;
+import java.util.ResourceBundle;
 
 import javax.servlet.Filter;
 import javax.servlet.FilterChain;
@@ -24,23 +25,22 @@ import javax.servlet.FilterConfig;
 import javax.servlet.ServletException;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.lang.ArrayUtils;
+import javax.servlet.jsp.jstl.core.Config;
+import javax.servlet.jsp.jstl.fmt.LocalizationContext;
 import org.apache.felix.scr.annotations.sling.SlingFilter;
-import org.apache.jackrabbit.JcrConstants;
 import org.apache.sling.api.SlingHttpServletRequest;
-import org.apache.sling.api.resource.Resource;
-import org.apache.sling.cms.CMSConstants;
-import org.apache.sling.jcr.resource.JcrResourceConstants;
-
-@SlingFilter(order = Integer.MAX_VALUE)
-public class PublishFilter implements Filter {
+import org.apache.sling.cms.core.models.Site;
+import org.apache.sling.cms.core.models.SiteManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
-	public static final String[] PUBLISHABLE_TYPES = new String[] { CMSConstants.NT_FILE, CMSConstants.NT_PAGE,
-			JcrResourceConstants.NT_SLING_FOLDER, JcrResourceConstants.NT_SLING_ORDERED_FOLDER };
+/**
+ * Sets the locale for the request based on the containing site.
+ */
+@SlingFilter(order = 0)
+public class LocaleFilter implements Filter {
 
-	public static final String[] VALID_METHODS = new String[] { "GET", "HEAD" };
+	private static final Logger log = LoggerFactory.getLogger(LocaleFilter.class);
 
 	@Override
 	public void init(FilterConfig filterConfig) throws ServletException {
@@ -49,33 +49,19 @@ public class PublishFilter implements Filter {
 	@Override
 	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
 			throws IOException, ServletException {
+
 		if (request instanceof SlingHttpServletRequest) {
 			SlingHttpServletRequest slingRequest = (SlingHttpServletRequest) request;
-			if (ArrayUtils.contains(VALID_METHODS, slingRequest.getMethod())) {
-				Object editEnabled = slingRequest.getAttribute(CMSConstants.ATTR_EDIT_ENABLED);
-				if (!"true".equals(editEnabled)) {
-					Resource publishable = findPublishableParent(slingRequest.getResource());
-					if (publishable != null && publishable.getChild(JcrConstants.JCR_CONTENT) != null) {
-						if (!(publishable.getChild(JcrConstants.JCR_CONTENT).getValueMap()
-								.get(CMSConstants.PN_PUBLISHED, true))) {
-							((HttpServletResponse) response).sendError(404);
-							return;
-						}
-					}
-				}
+			Site site = slingRequest.getResource().adaptTo(SiteManager.class).getSite();
+			if (site != null) {
+				log.debug("Setting bundle for {}", site.getLocaleString());
+				ResourceBundle bundle = slingRequest.getResourceBundle(site.getLocale());
+				Config.set(slingRequest, "javax.servlet.jsp.jstl.fmt.localizationContext",
+						new LocalizationContext(bundle, slingRequest.getLocale()));
 			}
 		}
-		chain.doFilter(request, response);
-	}
 
-	private Resource findPublishableParent(Resource resource) {
-		String type = resource.getValueMap().get(JcrConstants.JCR_PRIMARYTYPE, String.class);
-		if (ArrayUtils.contains(PUBLISHABLE_TYPES, type)) {
-			return resource;
-		} else if (resource.getParent() != null) {
-			return findPublishableParent(resource.getParent());
-		}
-		return null;
+		chain.doFilter(request, response);
 	}
 
 	@Override
diff --git a/cms/core/src/main/java/org/apache/sling/cms/core/filters/PublishFilter.java b/cms/core/src/main/java/org/apache/sling/cms/core/filters/PublishFilter.java
index b34cce2..f58ee5f 100644
--- a/cms/core/src/main/java/org/apache/sling/cms/core/filters/PublishFilter.java
+++ b/cms/core/src/main/java/org/apache/sling/cms/core/filters/PublishFilter.java
@@ -34,6 +34,10 @@ import org.apache.sling.api.resource.Resource;
 import org.apache.sling.cms.CMSConstants;
 import org.apache.sling.jcr.resource.JcrResourceConstants;
 
+/**
+ * Denies requests to sling:Page and sling:File resources and children which are
+ * not set to publish=true
+ */
 @SlingFilter(order = Integer.MAX_VALUE)
 public class PublishFilter implements Filter {
 
diff --git a/cms/core/src/main/java/org/apache/sling/cms/core/models/LocaleList.java b/cms/core/src/main/java/org/apache/sling/cms/core/models/LocaleList.java
new file mode 100644
index 0000000..c83f481
--- /dev/null
+++ b/cms/core/src/main/java/org/apache/sling/cms/core/models/LocaleList.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.cms.core.models;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Locale;
+
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.models.annotations.Model;
+
+/**
+ * A model for representing a site.
+ */
+@Model(adaptables = SlingHttpServletRequest.class)
+public class LocaleList {
+
+	public List<Locale> getLocales() {
+		List<Locale> locales = new ArrayList<Locale>();
+		for (Locale locale : SimpleDateFormat.getAvailableLocales()) {
+			locales.add(locale);
+		}
+		Collections.sort(locales, new Comparator<Locale>() {
+			public int compare(Locale o1, Locale o2) {
+				return o1.toString().compareTo(o2.toString());
+			}
+		});
+		return locales;
+	}
+
+}
diff --git a/cms/core/src/main/java/org/apache/sling/cms/core/models/Site.java b/cms/core/src/main/java/org/apache/sling/cms/core/models/Site.java
index b3839bd..84e377d 100644
--- a/cms/core/src/main/java/org/apache/sling/cms/core/models/Site.java
+++ b/cms/core/src/main/java/org/apache/sling/cms/core/models/Site.java
@@ -16,6 +16,8 @@
  */
 package org.apache.sling.cms.core.models;
 
+import java.util.Locale;
+
 import javax.inject.Inject;
 import javax.inject.Named;
 
@@ -52,42 +54,74 @@ public class Site {
 	}
 
 	@Inject
+	@Named(PN_CONFIG)
+	private String config;
+
+	@Inject
 	@Named(CMSConstants.PN_DESCRIPTION)
 	@Optional
 	private String description;
 
 	@Inject
-	@Named(CMSConstants.PN_TITLE)
-	private String title;
-
-	@Inject
-	@Named(PN_CONFIG)
-	private String config;
+	@Named(CMSConstants.PN_LANGUAGE)
+	private String locale;
 
 	private Resource resource;
 
+	@Inject
+	@Named(CMSConstants.PN_TITLE)
+	private String title;
+
 	public Site(Resource resource) {
 		this.resource = resource;
 	}
 
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Object#equals(java.lang.Object)
+	 */
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		Site other = (Site) obj;
+		if (resource == null) {
+			if (other.resource != null)
+				return false;
+		} else if (!resource.getPath().equals(other.resource.getPath()))
+			return false;
+		return true;
+	}
+
 	public String getDescription() {
 		return description;
 	}
 
-	public String getPath() {
-		return resource.getPath();
+	public String getLocaleString() {
+		return locale;
 	}
 
-	public Resource getResource() {
-		return resource;
+	public Locale getLocale() {
+		String[] segments = locale.split("_");
+		if (segments.length == 3) {
+			return new Locale(segments[0], segments[1], segments[2]);
+		} else if (segments.length == 2) {
+			return new Locale(segments[0], segments[1]);
+		}
+		return new Locale(segments[0]);
 	}
 
-	public String getTitle() {
-		return title;
+	public String getPath() {
+		return resource.getPath();
 	}
 
-	public String getSiteConfigPath() {
-		return config;
+	public Resource getResource() {
+		return resource;
 	}
 
 	public SiteConfig getSiteConfig() {
@@ -98,4 +132,36 @@ public class Site {
 		return null;
 	}
 
+	public String getSiteConfigPath() {
+		return config;
+	}
+
+	public String getTitle() {
+		return title;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Object#hashCode()
+	 */
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result + ((resource.getPath() == null) ? 0 : resource.getPath().hashCode());
+		return result;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return "Site [config=" + config + ", description=" + description + ", locale=" + locale + ", resource="
+				+ resource + ", title=" + title + "]";
+	}
+
 }
diff --git a/cms/core/src/main/java/org/apache/sling/cms/reference/models/Search.java b/cms/core/src/main/java/org/apache/sling/cms/reference/models/Search.java
index 6bb1a77..494fb31 100644
--- a/cms/core/src/main/java/org/apache/sling/cms/reference/models/Search.java
+++ b/cms/core/src/main/java/org/apache/sling/cms/reference/models/Search.java
@@ -154,6 +154,9 @@ public class Search {
 	}
 
 	public boolean isLast() {
-		return page + 1 == pages[pages.length - 1];
+		if(pages.length > 0) {
+			return page + 1 == pages[pages.length - 1];			
+		}
+		return true;
 	}
 }
diff --git a/cms/ui/src/main/resources/SLING-INF/nodetypes/nodetypes.cnd b/cms/ui/src/main/resources/SLING-INF/nodetypes/nodetypes.cnd
index c70284b..308cba8 100644
--- a/cms/ui/src/main/resources/SLING-INF/nodetypes/nodetypes.cnd
+++ b/cms/ui/src/main/resources/SLING-INF/nodetypes/nodetypes.cnd
@@ -57,6 +57,7 @@
 	- sling:config (string)
 	- sling:created (date)
 	- sling:createdBy (string)
+	- jcr:language (string)
 	- jcr:lastModified (date)
 	- jcr:lastModifiedBy (string)
 	- jcr:title (string)
diff --git a/cms/ui/src/main/resources/jcr_root/apps/reference/i18n.json b/cms/ui/src/main/resources/jcr_root/apps/reference/i18n.json
new file mode 100644
index 0000000..8e5b6d8
--- /dev/null
+++ b/cms/ui/src/main/resources/jcr_root/apps/reference/i18n.json
@@ -0,0 +1,32 @@
+{
+	"jcr:primaryType": "sling:OrderedFolder",
+	"jcr:content": {
+		"jcr:title": "CMS"
+	},
+	"en_US": {
+		"jcr:primaryType": "sling:Folder",
+		"jcr:mixinTypes": [
+			"mix:language"
+		],
+		"jcr:language": "en_US",
+		"sling:resourceType": "sling-cms/components/cms/blank",
+		"entry": {
+			"jcr:primaryType": "sling:MessageEntry",
+			"sling:message": "Found {1} results for \"{0}\". Showing results {2} - {3}.",
+			"sling:key": "slingcms.search.header"
+		}
+	},
+	"de_DE": {
+		"jcr:primaryType": "sling:Folder",
+		"jcr:mixinTypes": [
+			"mix:language"
+		],
+		"jcr:language": "de_DE",
+		"sling:resourceType": "sling-cms/components/cms/blank",
+		"entry_493865649": {
+			"jcr:primaryType": "sling:MessageEntry",
+			"sling:message": "Gefunden {1} Ergebnisse für \"{0}\". Zeige Ergebnisse {2} - {3}.",
+			"sling:key": "slingcms.search.header"
+		}
+	}
+}
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/blank/blank.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/blank/blank.jsp
new file mode 100644
index 0000000..43f8d04
--- /dev/null
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/blank/blank.jsp
@@ -0,0 +1,18 @@
+<%-- /*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */ --%>
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/i18ntable/config.json b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/i18ntable/config.json
deleted file mode 100644
index 87a0fc2..0000000
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/i18ntable/config.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
-	"jcr:primaryType": "sling:Component"
-}
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/i18ntable/i18ntable.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/i18ntable/i18ntable.jsp
index 4f574d7..3794fd6 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/i18ntable/i18ntable.jsp
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/i18ntable/i18ntable.jsp
@@ -25,6 +25,7 @@
 </c:forEach>
 <a class="Button Fetch-Modal" data-title="Add Entry" data-path=".Main-Content form" href="/cms/i18n/entry/create.html${firstChild.path}">+ Entry</a>
 <form method="post" action="${slingRequest.requestPathInfo.suffix}" enctype="multipart/form-data" class="Form-Ajax" data-add-date="false">
+	<input type="hidden" name="_charset_" value="utf-8" />
 	<table>
 		<thead>
 			<tr>
@@ -56,7 +57,7 @@
 								<c:forEach var="entry" items="${sling:listChildren(language)}">
 									<c:if test="${entry.valueMap['sling:key'] == key}">
 										<c:set var="keyfound" value="true" />
-										<input name="${language.name}/${entry.name}/sling:message" type="text" value="${entry.valueMap['sling:message']}" />
+										<input name="${language.name}/${entry.name}/sling:message" type="text" value="${sling:encode(entry.valueMap['sling:message'],'HTML_ATTR')}" />
 										<input name="${language.name}/${entry.name}/sling:key" type="hidden" value="${key}" />
 									</c:if>
 								</c:forEach>
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/scripts/localeOptions.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/scripts/localeOptions.jsp
new file mode 100644
index 0000000..21c925f
--- /dev/null
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/scripts/localeOptions.jsp
@@ -0,0 +1,27 @@
+<%-- /*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */ --%>
+ <%@include file="/libs/sling-cms/global.jsp"%>
+<option value="">Select Locale</option>
+<c:forEach var="locale" items="${sling:adaptTo(slingRequest,'org.apache.sling.cms.core.models.LocaleList').locales}">
+	<c:if test="${not empty locale.language}">
+		<option value="${locale}" ${rt == editProperties['sling:locale'] ? 'selected' : ''}>
+			${locale.displayLanguage} ${locale.displayCountry} (${locale})
+		</option>
+	</c:if>
+</c:forEach>
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/i18n/dictionaries.json b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/i18n/dictionaries.json
index d7b6c44..ac27a37 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/i18n/dictionaries.json
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/i18n/dictionaries.json
@@ -64,7 +64,7 @@
 							},
 							"lastModified": {
 								"jcr:primaryType": "nt:unstructured",
-								"sling:resourceType": "sling-cms/components/cms/columns/lastModified",
+								"sling:resourceType": "sling-cms/components/cms/columns/lastmodified",
 								"subPath": "jcr:content/"
 							},
 							"actions": {
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/i18n/language/create.json b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/i18n/language/create.json
index e010b62..dd552d2 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/i18n/language/create.json
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/i18n/language/create.json
@@ -21,18 +21,12 @@
 				"fields": {
 					"jcr:primaryType": "nt:unstructured",
 					"sling:resourceType": "sling-cms/components/general/container",
-					"title": {
-						"jcr:primaryType": "nt:unstructured",
-						"sling:resourceType": "sling-cms/components/editor/fields/text",
-						"label": "Title",
-						"name": "jcr:content/jcr:title",
-						"required": true
-					},
 					"language": {
 						"jcr:primaryType": "nt:unstructured",
-						"sling:resourceType": "sling-cms/components/editor/fields/text",
+						"sling:resourceType": "sling-cms/components/editor/fields/select",
 						"label": "Language",
 						"name": "jcr:language",
+						"optionsScript": "/libs/sling-cms/components/editor/scripts/localeOptions.jsp",
 						"required": true
 					},
 					"name": {
@@ -57,7 +51,7 @@
 					"contentResourceType": {
 						"jcr:primaryType": "nt:unstructured",
 						"sling:resourceType": "sling-cms/components/editor/fields/hidden",
-						"name": "jcr:content/sling:resourceType",
+						"name": "sling:resourceType",
 						"value": "sling-cms/components/cms/blank"
 					},
 					"mixin": {
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/site/create.json b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/site/create.json
index 67f6cf1..4b0ddf8 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/site/create.json
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/site/create.json
@@ -35,6 +35,14 @@
 						"name": ":name",
 						"required": true
 					},
+					"locale": {
+						"jcr:primaryType": "nt:unstructured",
+						"sling:resourceType": "sling-cms/components/editor/fields/select",
+						"label": "Language",
+						"name": "jcr:language",
+						"optionsScript": "/libs/sling-cms/components/editor/scripts/localeOptions.jsp",
+						"required": true
+					},
 					"config": {
 						"jcr:primaryType": "nt:unstructured",
 						"sling:resourceType": "sling-cms/components/editor/fields/path",
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/site/edit.json b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/site/edit.json
index 8249dfc..b7da6cb 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/site/edit.json
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/site/edit.json
@@ -32,6 +32,23 @@
 						"label": "Description",
 						"name": "jcr:description",
 						"required": false
+					},
+					"locale": {
+						"jcr:primaryType": "nt:unstructured",
+						"sling:resourceType": "sling-cms/components/editor/fields/select",
+						"label": "Language",
+						"name": "jcr:language",
+						"optionsScript": "/libs/sling-cms/components/editor/scripts/localeOptions.jsp",
+						"required": true
+					},
+					"config": {
+						"jcr:primaryType": "nt:unstructured",
+						"sling:resourceType": "sling-cms/components/editor/fields/path",
+						"basePath": "/etc/config",
+						"type": "sling:Config",
+						"label": "Site Config",
+						"name": "sling:config",
+						"titleProperty": "jcr:title"
 					}
 				}
 			}

-- 
To stop receiving notification emails like this one, please contact
dklco@apache.org.