]> git.mxchange.org Git - jjobs-war.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Thu, 12 Oct 2017 20:13:09 +0000 (22:13 +0200)
committerRoland Häder <roland@mxchange.org>
Fri, 19 Jul 2019 22:47:13 +0000 (00:47 +0200)
- loading of both i18n (resource) bundles is now possible
- departmentName has been transformed into departmentI18nKey to allow
  localization of the department's name
- also rewrote i18n key for entering department's i18n key
- splitted header line and "enter bla" for department i18n key, was to long

Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/jjobs/beans/BaseJobsBean.java
src/java/org/mxchange/jjobs/beans/business/department/JobsAdminDepartmentWebRequestBean.java
src/java/org/mxchange/jjobs/beans/helper/JobsWebRequestHelperBean.java
src/java/org/mxchange/localization/bundle_de_DE.properties
src/java/org/mxchange/localization/bundle_en_US.properties
web/WEB-INF/templates/admin/department/admin_form_department_data.tpl
web/admin/department/admin_department_list.xhtml

index 369842c4fb85ec5bd9723a41d555b7e0081ef768..ad1e3daea010746b7528c245795863012537feaf 100644 (file)
@@ -27,11 +27,6 @@ import org.mxchange.jcoreee.bean.faces.BaseFacesBean;
  */
 public abstract class BaseJobsBean extends BaseFacesBean {
 
-       /**
-        * Loaded resource bundle ("cached")
-        */
-       private static ResourceBundle RESOURCE_BUNDLE;
-
        /**
         * Serial number
         */
@@ -46,15 +41,18 @@ public abstract class BaseJobsBean extends BaseFacesBean {
        }
 
        @Override
-       protected ResourceBundle loadResourceBundle (final Locale locale) {
-               // Is the instance there?
-               if (null == RESOURCE_BUNDLE) {
-                       // Load resource bundle, so it will be loaded from this JAR
-                       RESOURCE_BUNDLE = ResourceBundle.getBundle("org.mxchange.localization.bundle", locale);
+       protected void loadResourceBundles (final Locale locale) {
+               // Is any locale loaded? (Will be 2)
+               if (BaseFacesBean.getBundles().isEmpty()) {
+                       // Load resource bundles, so it will be loaded from this JAR"
+                       // 1) Generic
+                       ResourceBundle bundle = ResourceBundle.getBundle("org.mxchange.localization.bundle", locale);
+                       BaseFacesBean.getBundles().add(bundle);
+
+                       // 2) Project-specific
+                       bundle = ResourceBundle.getBundle("org.mxchange.localization.project", locale);
+                       BaseFacesBean.getBundles().add(bundle);
                }
-
-               // Return cache instance
-               return RESOURCE_BUNDLE;
        }
 
 }
index 76eb5d2ceb6a9f0a8fefb98d80bbb306bc826702..1df4c2b3fbafdc8bc6bab649173829abd7a14ef9 100644 (file)
@@ -93,7 +93,7 @@ public class JobsAdminDepartmentWebRequestBean extends BaseJobsBean implements J
        /**
         * Department name
         */
-       private String departmentName;
+       private String departmentI18nKey;
 
        /**
         * Owning user instance (which this department is assigned to)
@@ -134,7 +134,7 @@ public class JobsAdminDepartmentWebRequestBean extends BaseJobsBean implements J
                        updatedDepartment = this.adminDepartmentBean.addDepartment(department);
                } catch (final DepartmentAlreadyAddedException ex) {
                        // Output message
-                       this.showFacesMessage("form-admin-add-department:departmentName", "ADMIN_DEPARTMENT_ALREADY_CREATED"); //NOI18N
+                       this.showFacesMessage("form-admin-add-department:departmentI18nKey", "ADMIN_DEPARTMENT_ALREADY_CREATED"); //NOI18N
                        return ""; //NOI18N
                }
 
@@ -222,17 +222,17 @@ public class JobsAdminDepartmentWebRequestBean extends BaseJobsBean implements J
         * <p>
         * @return Department name
         */
-       public String getDepartmentName () {
-               return this.departmentName;
+       public String getDepartmentI18nKey () {
+               return this.departmentI18nKey;
        }
 
        /**
         * Setter for department name
         * <p>
-        * @param departmentName Department name
+        * @param departmentI18nKey Department name
         */
-       public void setDepartmentName (final String departmentName) {
-               this.departmentName = departmentName;
+       public void setDepartmentI18nKey (final String departmentI18nKey) {
+               this.departmentI18nKey = departmentI18nKey;
        }
 
        /**
@@ -262,7 +262,7 @@ public class JobsAdminDepartmentWebRequestBean extends BaseJobsBean implements J
         */
        private Department createDepartment () {
                // Create new department instance
-               final Department department = new CompanyDepartment(this.getDepartmentCompany(), this.getDepartmentName());
+               final Department department = new CompanyDepartment(this.getDepartmentCompany(), this.getDepartmentI18nKey());
 
                // Add all optional fields
                department.setDepartmentHeadquarters(this.getDepartmentHeadquarters());
index b334ecdab4e845c84a201c1ec26ecce02e689cf3..f73152a714e0262916a118010a9bbf5514eddaa9 100644 (file)
@@ -510,7 +510,7 @@ public class JobsWebRequestHelperBean extends BaseJobsBean implements JobsWebReq
                // Is a department set?
                if (department instanceof Department) {
                        // Then create name
-                       sb.append(department.getDepartmentName());
+                       sb.append(this.getMessageFromBundle(department.getDepartmentI18nKey()));
                        sb.append(" ("); //NOI18N
                        sb.append(department.getDepartmentCompany().getCompanyName());
                        sb.append(")"); //NOI18N
index b2241bf7adbb98ed1b6c1afb9ee5cf7a2c43ac34..f565b2617925132e40f349c76de4212f83c3f093 100644 (file)
@@ -1033,21 +1033,23 @@ ADMIN_LINK_DELETE_DEPARTMENT_TITLE=Loescht die Abteilung
 #@TODO Please fix German umlauts!
 ADMIN_DEPARTMENT_ALREADY_CREATED=Die Abteilung existiert bereits im ausgewaehlten Unternehmen.
 ADMIN_LIST_DEPARTMENTS_HEADER=Alle Abteilungen auflisten
-ADMIN_DEPARTMENT_NAME=Abteilung:
+#@TODO Please fix German umlauts!
+ADMIN_DEPARTMENT_I18N_KEY=Sprachschluessel:
+ADMIN_ENTER_DEPARTMENT_I18N_KEY=Sprachschluessel fuer Abteilung:
 ADMIN_DEPARTMENT_LEAD_EMPLOYEE=Abteilungsleiter:
 ADMIN_ADD_DEPARTMENT_TITLE=Neue Abteilung hinzuf\u00fcgen
 ADMIN_DEPARTMENT_LEGEND=Daten der Abteilung eingeben:
 ADMIN_DEPARTMENT_LEGEND_TITLE=Geben Sie hier die Daten der Abteilung ein.
 #@TODO Please fix German umlauts!
 ADMIN_ADD_DEPARTMENT_MINIMUM_DATA=Bitte geben Sie mindestens den Namen der Abteilung (z.B. Verkauf) ein und waehlen Sie mindestens das Unternehmen aus. Wenn bekannt, waehlen Sie entweder eine Filiale oder eine Hauptniederlassung aus.
-ADMIN_ENTER_DEPARTMENT_NAME=Name der Abteilung eingeben:
 ADMIN_ASSIGN_DEPARTMENT_BRANCH_OFFICE=Filiale der Abteilung zuweisen:
 ADMIN_ASSIGN_DEPARTMENT_HEADQUARTERS=Hauptsitz der Abteilung zuweisen:
 ADMIN_ASSIGN_DEPARTMENT_COMPANY=Unternehmen der Abteilung zuweisen:
 ADMIN_ASSIGN_DEPARTMENT_LEAD_EMPLOYEE=Leitender Mitarbeiter der Abteilung zuweisen:
 ADMIN_ASSIGN_DEPARTMENT_USER_OWNER=Benutzer als Besitzer der Abteilung zuweisen:
 ADMIN_DEPARTMENT_COMPANY_REQUIRED=Bitte weisen Sie ein Unternehmen der Abteilung zu.
-ADMIN_DEPARTMENT_NAME_REQUIRED=Bitte geben Sie der Abteilung einen Namen. Zum Beispiel: Verkauf, Personalwesen
+#@TODO Please fix German umlauts!
+ADMIN_DEPARTMENT_I18N_KEY_REQUIRED=Bitte geben Sie den Sprachschluessel der Abteilung ein. Zum Beispiel: DEPARTMENT_NAME_SALES
 BUTTON_ADMIN_ADD_DEPARTMENT_DATA=Abteilung hinzuf\u00fcgen
 #@TODO Please fix German umlauts!
 PAGE_TITLE_ADMIN_LIST_OPENING_TIMES=Oeffnungszeiten auflisten
index 3c1b261aa2abb253f80304a0d9b811e1b217fa4c..1af50fccee025191324ef5a919e0c2c9e11a53d4 100644 (file)
@@ -967,21 +967,21 @@ ADMIN_LINK_EDIT_DEPARTMENT_TITLE=Edit of a department
 ADMIN_LINK_DELETE_DEPARTMENT_TITLE=Deletes a department.
 ADMIN_DEPARTMENT_ALREADY_CREATED=The department already exists in selected company.
 ADMIN_LIST_DEPARTMENTS_HEADER=List all departments
-ADMIN_DEPARTMENT_NAME=Department:
+ADMIN_DEPARTMENT_I18N_KEY=I18n key:
+ADMIN_ENTER_DEPARTMENT_I18N_KEY=I18n key for department:
 ADMIN_DEPARTMENT_LEAD_EMPLOYEE=Department leader:
 ADMIN_ADD_DEPARTMENT_TITLE=Add new department
 ADMIN_DEPARTMENT_LEGEND=Enter data of department:
 ADMIN_DEPARTMENT_LEGEND_TITLE=Here you can enter data of the new department.
 #Bitte geben Sie mindestens den Namen der Abteilung (z.B. Verkauf) ein und waehlen Sie mindestens das Unternehmen aus. Wenn bekannt, waehlen Sie entweder eine Filiale oder eine Hauptniederlassung aus.
 ADMIN_ADD_DEPARTMENT_MINIMUM_DATA=Please enter at least name of department (e.g. Sales) and choose assigned company. If known, choose a branch office or headquarters.
-ADMIN_ENTER_DEPARTMENT_NAME=Enter name of department:
 ADMIN_ASSIGN_DEPARTMENT_BRANCH_OFFICE=Assign branch office to department:
 ADMIN_ASSIGN_DEPARTMENT_HEADQUARTERS=Assign headquarters to department:
 ADMIN_ASSIGN_DEPARTMENT_COMPANY=Assign company to department:
 ADMIN_ASSIGN_DEPARTMENT_LEAD_EMPLOYEE=Assign leading employee to department:
 ADMIN_ASSIGN_DEPARTMENT_USER_OWNER=Assign owning user to department:
 ADMIN_DEPARTMENT_COMPANY_REQUIRED=Please assign a company to this department.
-ADMIN_DEPARTMENT_NAME_REQUIRED=Please enter a name for the department. Examples: Sales, Human Resources
+ADMIN_DEPARTMENT_I18N_KEY_REQUIRED=Please enter an i18n key for the department. Example: DEPARTMENT_NAME_SALES
 BUTTON_ADMIN_ADD_DEPARTMENT_DATA=Add department
 PAGE_TITLE_ADMIN_LIST_OPENING_TIMES=List opening times
 CONTENT_TITLE_ADMIN_LIST_OPENING_TIMES=List opening times:
index 838c2a91c8fd4317a634754fbf6060d3e0ce8279..e10b19579798d23fdc8e5c71792c40311de31663 100644 (file)
@@ -12,8 +12,8 @@
        -->
        <p:fieldset legend="#{msg.ADMIN_DEPARTMENT_LEGEND}">
                <p:panelGrid layout="grid" columns="2" columnClasses="ui-grid-col-4, ui-grid-col-8" styleClass="table table-full ui-noborder">
-                       <p:outputLabel for="departmentName" value="#{msg.ADMIN_ENTER_DEPARTMENT_NAME}" />
-                       <p:inputText styleClass="input" id="departmentName" size="2" maxlength="10" value="#{adminDepartmentController.departmentName}" required="true" requiredMessage="#{msg.ADMIN_DEPARTMENT_NAME_REQUIRED}" />
+                       <p:outputLabel for="departmentI18nKey" value="#{msg.ADMIN_ENTER_DEPARTMENT_I18N_KEY}" />
+                       <p:inputText styleClass="input" id="departmentI18nKey" size="2" maxlength="10" value="#{adminDepartmentController.departmentI18nKey}" required="true" requiredMessage="#{msg.ADMIN_DEPARTMENT_I18N_KEY_REQUIRED}" />
 
                        <p:outputLabel for="departmentCompany" value="#{msg.ADMIN_ASSIGN_DEPARTMENT_COMPANY}" />
                        <p:selectOneMenu
index d131c45ba5bd67112b102cdfb4cac324e5c3bdc9..992a6acc15576c1dd53a9bd810b2011433c02c52 100644 (file)
@@ -53,8 +53,8 @@
                                        </p:link>
                                </p:column>
 
-                               <p:column headerText="#{msg.ADMIN_DEPARTMENT_NAME}" sortBy="#{department.departmentName}" filterBy="#{department.departmentName}" filterMatchMode="contains">
-                                       <h:outputText value="#{department.departmentName}" />
+                               <p:column headerText="#{msg.ADMIN_DEPARTMENT_I18N_KEY}" sortBy="#{department.departmentI18nKey}" filterBy="#{department.departmentI18nKey}" filterMatchMode="contains">
+                                       <h:outputText value="#{project[department.departmentI18nKey]}" />
                                </p:column>
 
                                <p:column headerText="#{msg.ADMIN_BASIC_COMPANY_DATA_COMPANY_NAME}" sortBy="#{department.departmentCompany}" filterBy="#{department.departmentCompany}" filterMatchMode="in">