- added form template for localization support (still static, maybe can be output over bean's method?)
- added missing methods (not classical getter/setter)
*/
private Locale locale;
+ @Override
+ public String getLanguage () {
+ return this.getLocale().getLanguage();
+ }
+
+ @Override
+ public void setLanguage (final String language) {
+ this.setLocale(new Locale(language));
+ FacesContext.getCurrentInstance().getViewRoot().setLocale(this.getLocale());
+ }
+
@Override
public Locale getLocale () {
return this.locale;
*/
void setLocale (final Locale locale);
+ /**
+ * Getter for language code
+ * <p>
+ * @return Language code
+ */
+ String getLanguage ();
+
+ /**
+ * Setter for language code
+ * <p>
+ * @param language Language code
+ */
+ void setLanguage (final String language);
+
}
<div id="menu_content">
<div id="left">
<ui:insert name="menu">Default menu</ui:insert>
+ <ui:include src="/WEB-INF/templates/generic/locale_selection_box.tpl" />
</div>
<div id="content_outer" class="left_content">
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<ui:composition
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+ <h:form id="locale_selection">
+ <h:selectOneMenu value="#{localization.locale.language}" onchange="submit()">
+ <f:selectItem itemValue="de" itemLabel="Deutsch" />
+ <f:selectItem itemValue="en" itemLabel="English" />
+ </h:selectOneMenu>
+ </h:form>
+</ui:composition>