]> git.mxchange.org Git - jjobs-war.git/commitdiff
fixed copyright and added stuff for localization support (unfinished)
authorRoland Haeder <roland@mxchange.org>
Fri, 1 Apr 2016 19:04:36 +0000 (21:04 +0200)
committerRoland Haeder <roland@mxchange.org>
Fri, 1 Apr 2016 19:04:36 +0000 (21:04 +0200)
src/java/org/mxchange/jjobs/beans/email_address/EmailChangeWebSessionBean.java
src/java/org/mxchange/jjobs/beans/email_address/EmailChangeWebSessionController.java
src/java/org/mxchange/jjobs/beans/localization/JobsLocalizationSessionBean.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/beans/localization/LocalizationSessionController.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/validators/password/UserPasswordValidator.java
web/WEB-INF/templates/base.tpl

index 2d0e546506321aac51ae0d519452d81acc023677..1e79c650eaa0fda56f1872899354099917ccd0a2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 quix0r
+ * Copyright (C) 2016 Roland Haeder
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
index 3631e9d90d487266797b8bd95544b025d6476d47..15609e0423d5c9cfc839c3fa6a507022d55edcf2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 quix0r
+ * Copyright (C) 2016 Roland Haeder
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/src/java/org/mxchange/jjobs/beans/localization/JobsLocalizationSessionBean.java b/src/java/org/mxchange/jjobs/beans/localization/JobsLocalizationSessionBean.java
new file mode 100644 (file)
index 0000000..5deb38b
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jjobs.beans.localization;
+
+import java.util.Locale;
+import javax.annotation.PostConstruct;
+import javax.faces.bean.SessionScoped;
+import javax.faces.context.FacesContext;
+import javax.inject.Named;
+import org.mxchange.jcoreee.database.BaseDatabaseBean;
+
+/**
+ * A session bean for handling localization/internationalization changes. This
+ * class is based on an example at [1] from mkyong.
+ * <p>
+ * 1: http://www.mkyong.com/jsf2/jsf-2-internationalization-example/
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+@Named ("localization")
+@SessionScoped
+public class JobsLocalizationSessionBean extends BaseDatabaseBean implements LocalizationSessionController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 1_867_671_657_629_601_528L;
+
+       /**
+        * Current Locale
+        */
+       private Locale locale;
+
+       @Override
+       public Locale getLocale () {
+               return this.locale;
+       }
+
+       @Override
+       public void setLocale (final Locale locale) {
+               this.locale = locale;
+       }
+
+       /**
+        * Initializer for this bean
+        */
+       @PostConstruct
+       public void init () {
+               // Create locale instance from context
+               Locale loc = FacesContext.getCurrentInstance().getExternalContext().getRequestLocale();
+
+               // Set it here
+               this.setLocale(loc);
+       }
+
+}
diff --git a/src/java/org/mxchange/jjobs/beans/localization/LocalizationSessionController.java b/src/java/org/mxchange/jjobs/beans/localization/LocalizationSessionController.java
new file mode 100644 (file)
index 0000000..c271e3c
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jjobs.beans.localization;
+
+import java.io.Serializable;
+import java.util.Locale;
+
+/**
+ * An interface for localization change beans
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+public interface LocalizationSessionController extends Serializable {
+
+       /**
+        * Getter for locale
+        * <p>
+        * @return Locale
+        */
+       Locale getLocale ();
+
+       /**
+        * Setter for locale
+        * <p>
+        * @param locale Locale
+        */
+       void setLocale (final Locale locale);
+
+}
index d1a90c05d1c418d949e6db84a7b96f2695381617..e73e7ce5aef9bedebb18d11d2e5da0ccc1b34816 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 quix0r
+ * Copyright (C) 2016 Roland Haeder
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
index 3df247f9a5e54d8a25ccf4a4b58edf35d86372ef..1507b407003e4b0dbc215abca4f08a6b79d5ef86 100644 (file)
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <html
+       lang="#{localization.locale.language}" xml:lang="#{localization.locale.language}"
        xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:ui="http://java.sun.com/jsf/facelets"
@@ -9,6 +10,7 @@
                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 
                <f:loadBundle var="msg" basename="org.mxchange.localization.bundle" />
+               <f:view locale="#{localization.locale}" />
 
                <h:outputStylesheet name="/css/default.css" />
                <h:outputStylesheet name="/css/cssLayout.css" />