aboutsummaryrefslogtreecommitdiff
path: root/id/ConfigWebTool/src/main/java/at
diff options
context:
space:
mode:
Diffstat (limited to 'id/ConfigWebTool/src/main/java/at')
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java8
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/helper/LanguageHelper.java52
2 files changed, 53 insertions, 7 deletions
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java
index fdd566888..2dce3534f 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java
@@ -377,6 +377,14 @@ public class ConfigurationProvider {
public String getMailOAActivationSubject() {
return props.getProperty("general.mail.createOArequest.isactive.subject");
}
+
+ public String getDefaultLanguage() {
+ try {
+ return props.getProperty("general.defaultlanguage").toLowerCase();
+ } catch (Exception ex) {
+ return "de";
+ }
+ }
public String getMailOAActivationTemplate() throws ConfigurationException {
String url = props.getProperty("general.mail.createOArequest.isactive.template");
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/helper/LanguageHelper.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/helper/LanguageHelper.java
index a2f0628eb..73b2708ae 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/helper/LanguageHelper.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/helper/LanguageHelper.java
@@ -23,6 +23,10 @@
package at.gv.egovernment.moa.id.configuration.helper;
+import at.gv.egovernment.moa.id.configuration.config.ConfigurationProvider;
+import at.gv.egovernment.moa.id.configuration.exception.ConfigurationException;
+import at.gv.egovernment.moa.logging.Logger;
+
import java.text.MessageFormat;
import java.util.Locale;
import java.util.ResourceBundle;
@@ -34,9 +38,44 @@ public class LanguageHelper {
private static ResourceBundle errorRes_DE = ResourceBundle.getBundle("applicationResources", Locale.GERMAN);
private static ResourceBundle guiRes_DE = ResourceBundle.getBundle("applicationResources", Locale.GERMAN);
-
- public static String getGUIString(String code, HttpServletRequest request) {
- return guiRes_DE.getString(code);
+
+ private static ResourceBundle errorRes_EN = ResourceBundle.getBundle("applicationResources_en", Locale.ENGLISH);
+ private static ResourceBundle guiRes_EN = ResourceBundle.getBundle("applicationResources_en", Locale.ENGLISH);
+
+ private static ResourceBundle errorLanguage() {
+ Logger.setHierarchy("moa.id.configuration");
+ try {
+ ConfigurationProvider configurationProvider = ConfigurationProvider.getInstance();
+ if (configurationProvider.getDefaultLanguage().equals("en")) {
+ return errorRes_EN;
+ } else {
+ return errorRes_DE;
+ }
+ } catch (ConfigurationException e) {
+ Logger.error("Configuration exception while getting ConfigurationProvider instance");
+ e.printStackTrace();
+ return errorRes_DE;
+ }
+ }
+
+ private static ResourceBundle guiLanguage() {
+ Logger.setHierarchy("moa.id.configuration");
+ try {
+ ConfigurationProvider configurationProvider = ConfigurationProvider.getInstance();
+ if (configurationProvider.getDefaultLanguage().equals("en")) {
+ return guiRes_EN;
+ } else {
+ return guiRes_DE;
+ }
+ } catch (ConfigurationException e) {
+ Logger.error("Configuration exception while getting ConfigurationProvider instance");
+ e.printStackTrace();
+ return guiRes_DE;
+ }
+ }
+
+ public static String getGUIString(String code, HttpServletRequest request) {
+ return guiRes_DE.getString(code);
}
public static String getGUIString(String code) {
@@ -44,16 +83,15 @@ public class LanguageHelper {
}
public static String getErrorString(String code, HttpServletRequest request) {
- return errorRes_DE.getString(code);
+ return errorLanguage().getString(code);
}
public static String getErrorString(String code) {
- return errorRes_DE.getString(code);
+ return errorLanguage().getString(code);
}
public static String getGUIString(String code, String parameter, HttpServletRequest request) {
-
- return MessageFormat.format(getGUIString(code, request), parameter);
+ return MessageFormat.format(getGUIString(code, request), parameter);
}
public static String getErrorString(String code, Object[] parameter, HttpServletRequest request) {