From: Roland Häder Date: Thu, 12 Oct 2017 20:13:09 +0000 (+0200) Subject: Please cherry-pick: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=020b01201cdad7d309a510edbd08ab2912a7bb42;p=jjobs-war.git Please cherry-pick: - 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 --- diff --git a/src/java/org/mxchange/jjobs/beans/BaseJobsBean.java b/src/java/org/mxchange/jjobs/beans/BaseJobsBean.java index 369842c4..ad1e3dae 100644 --- a/src/java/org/mxchange/jjobs/beans/BaseJobsBean.java +++ b/src/java/org/mxchange/jjobs/beans/BaseJobsBean.java @@ -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; } } diff --git a/src/java/org/mxchange/jjobs/beans/business/department/JobsAdminDepartmentWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/business/department/JobsAdminDepartmentWebRequestBean.java index 76eb5d2c..1df4c2b3 100644 --- a/src/java/org/mxchange/jjobs/beans/business/department/JobsAdminDepartmentWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/business/department/JobsAdminDepartmentWebRequestBean.java @@ -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 *

* @return Department name */ - public String getDepartmentName () { - return this.departmentName; + public String getDepartmentI18nKey () { + return this.departmentI18nKey; } /** * Setter for department name *

- * @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()); diff --git a/src/java/org/mxchange/jjobs/beans/helper/JobsWebRequestHelperBean.java b/src/java/org/mxchange/jjobs/beans/helper/JobsWebRequestHelperBean.java index b334ecda..f73152a7 100644 --- a/src/java/org/mxchange/jjobs/beans/helper/JobsWebRequestHelperBean.java +++ b/src/java/org/mxchange/jjobs/beans/helper/JobsWebRequestHelperBean.java @@ -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 diff --git a/src/java/org/mxchange/localization/bundle_de_DE.properties b/src/java/org/mxchange/localization/bundle_de_DE.properties index b2241bf7..f565b261 100644 --- a/src/java/org/mxchange/localization/bundle_de_DE.properties +++ b/src/java/org/mxchange/localization/bundle_de_DE.properties @@ -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 diff --git a/src/java/org/mxchange/localization/bundle_en_US.properties b/src/java/org/mxchange/localization/bundle_en_US.properties index 3c1b261a..1af50fcc 100644 --- a/src/java/org/mxchange/localization/bundle_en_US.properties +++ b/src/java/org/mxchange/localization/bundle_en_US.properties @@ -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: diff --git a/web/WEB-INF/templates/admin/department/admin_form_department_data.tpl b/web/WEB-INF/templates/admin/department/admin_form_department_data.tpl index 838c2a91..e10b1957 100644 --- a/web/WEB-INF/templates/admin/department/admin_form_department_data.tpl +++ b/web/WEB-INF/templates/admin/department/admin_form_department_data.tpl @@ -12,8 +12,8 @@ --> - - + + - - + +