aboutsummaryrefslogtreecommitdiff
path: root/id/ConfigWebTool/src/main/java/at/gv/egovernment
diff options
context:
space:
mode:
authorBojan Suzic <bojan.suzic@iaik.tugraz.at>2014-03-20 15:49:19 +0100
committerBojan Suzic <bojan.suzic@iaik.tugraz.at>2014-03-20 15:49:19 +0100
commit3920c2fcb879320dff1c20de125e62b41bd750b3 (patch)
treecc3b3192e280cd1e030728c295a55fd74f09b629 /id/ConfigWebTool/src/main/java/at/gv/egovernment
parenta112ca8f0c8cd4a0620c55e430004b28b9fe1dfb (diff)
downloadmoa-id-spss-3920c2fcb879320dff1c20de125e62b41bd750b3.tar.gz
moa-id-spss-3920c2fcb879320dff1c20de125e62b41bd750b3.tar.bz2
moa-id-spss-3920c2fcb879320dff1c20de125e62b41bd750b3.zip
initial language changes for gui and errors
Diffstat (limited to 'id/ConfigWebTool/src/main/java/at/gv/egovernment')
-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) {