]> git.mxchange.org Git - jfinancials-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>
Thu, 12 Oct 2017 20:24:38 +0000 (22:24 +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/jfinancials/beans/BaseFinancialsBean.java
src/java/org/mxchange/jfinancials/beans/business/department/FinancialsAdminDepartmentWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebRequestHelperBean.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 97348929dd4e6a2854dbcc3cbce5d44db462f386..e28f2bd5366a73c00dd2c2605201df19d0bb01ca 100644 (file)
@@ -27,11 +27,6 @@ import org.mxchange.jcoreee.bean.faces.BaseFacesBean;
  */
 public abstract class BaseFinancialsBean extends BaseFacesBean {
 
-       /**
-        * Loaded resource bundle ("cached")
-        */
-       private static ResourceBundle RESOURCE_BUNDLE;
-
        /**
         * Serial number
         */
@@ -46,15 +41,18 @@ public abstract class BaseFinancialsBean 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 a71d89b55ae7946f1d4a99e5fe8f97b0a8058912..5d248a35aeb90aade3377132b275135e717442a3 100644 (file)
@@ -93,7 +93,7 @@ public class FinancialsAdminDepartmentWebRequestBean extends BaseFinancialsBean
        /**
         * Department name
         */
-       private String departmentName;
+       private String departmentI18nKey;
 
        /**
         * Owning user instance (which this department is assigned to)
@@ -134,7 +134,7 @@ public class FinancialsAdminDepartmentWebRequestBean extends BaseFinancialsBean
                        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 FinancialsAdminDepartmentWebRequestBean extends BaseFinancialsBean
         * <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 FinancialsAdminDepartmentWebRequestBean extends BaseFinancialsBean
         */
        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 912cb454cb251a6be2cb378e144b69fbac014ad8..776b24a1cfff749429fc6e6af8c75ec037bcb050 100644 (file)
@@ -510,7 +510,7 @@ public class FinancialsWebRequestHelperBean extends BaseFinancialsBean implement
                // 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 eeec7603612d19cdca5edcc7e69de2fd9db0d36e..32313a5c3a5312fc960442b970f417b8cc045229 100644 (file)
@@ -1026,21 +1026,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 ce3f66a44b66af5e29342b8c32d0d1d6710d7e18..b46c2c18ba3233e465375e0025db6d26b0c6ac3a 100644 (file)
@@ -954,21 +954,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">