From e4669868c8c3bf0744ebb9deac1f1c3fe3664835 Mon Sep 17 00:00:00 2001 From: Bojan Suzic Date: Wed, 2 Apr 2014 15:14:49 +0200 Subject: language --- .../id/configuration/helper/LanguageHelper.java | 87 ++++++++++++---------- 1 file changed, 48 insertions(+), 39 deletions(-) (limited to 'id/ConfigWebTool/src/main/java/at/gv/egovernment/moa') 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 73b2708ae..b207e7118 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 @@ -27,81 +27,90 @@ 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 javax.servlet.http.HttpServletRequest; import java.text.MessageFormat; import java.util.Locale; import java.util.ResourceBundle; -import javax.servlet.http.HttpServletRequest; - public class LanguageHelper { - private static ResourceBundle errorRes_DE = ResourceBundle.getBundle("applicationResources", Locale.GERMAN); - private static ResourceBundle guiRes_DE = ResourceBundle.getBundle("applicationResources", Locale.GERMAN); + private static ResourceBundle errorRes_DE = ResourceBundle.getBundle("applicationResources_de", Locale.GERMAN); + private static ResourceBundle guiRes_DE = ResourceBundle.getBundle("applicationResources_de", Locale.GERMAN); 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() { + private static String errorLanguage(String code) { Logger.setHierarchy("moa.id.configuration"); try { ConfigurationProvider configurationProvider = ConfigurationProvider.getInstance(); if (configurationProvider.getDefaultLanguage().equals("en")) { - return errorRes_EN; + Logger.trace("Returning EN error message"); + return errorRes_EN.getString(code); } else { - return errorRes_DE; + Logger.trace("Returning DE error message"); } } catch (ConfigurationException e) { Logger.error("Configuration exception while getting ConfigurationProvider instance"); e.printStackTrace(); - return errorRes_DE; + return errorRes_DE.getString(code); + } catch (Exception ex) { + Logger.error("General exception while returning translated message"); + return errorRes_DE.getString(code); } + return errorRes_DE.getString(code); } - private static ResourceBundle guiLanguage() { + private static String guiLanguage(String code) { Logger.setHierarchy("moa.id.configuration"); try { ConfigurationProvider configurationProvider = ConfigurationProvider.getInstance(); if (configurationProvider.getDefaultLanguage().equals("en")) { - return guiRes_EN; + Logger.trace("Returning EN gui message: " + guiRes_EN.getString(code)); + return guiRes_EN.getString(code); } else { - return guiRes_DE; + Logger.trace("Returning DE gui message: " + guiRes_DE.getString(code) + " /en>" + guiRes_EN.getString(code)); + return guiRes_DE.getString(code); } } catch (ConfigurationException e) { Logger.error("Configuration exception while getting ConfigurationProvider instance"); e.printStackTrace(); - return guiRes_DE; + return guiRes_DE.getString(code); + } catch (Exception ex) { + Logger.error("General exception while returning translated message"); + return guiRes_DE.getString(code); } } public static String getGUIString(String code, HttpServletRequest request) { - return guiRes_DE.getString(code); - } - - public static String getGUIString(String code) { - return guiRes_DE.getString(code); - } - - public static String getErrorString(String code, HttpServletRequest request) { - return errorLanguage().getString(code); - } - - public static String getErrorString(String code) { - return errorLanguage().getString(code); - } - - public static String getGUIString(String code, String parameter, HttpServletRequest request) { + return guiLanguage(code); + } + + public static String getGUIString(String code) { + return guiLanguage(code); + } + + public static String getErrorString(String code, HttpServletRequest request) { + return errorLanguage(code); + } + + public static String getErrorString(String code) { + return errorLanguage(code); + } + + public static String getGUIString(String code, String parameter, HttpServletRequest request) { + return MessageFormat.format(getGUIString(code, request), parameter); + } + + public static String getErrorString(String code, Object[] parameter, HttpServletRequest request) { + return MessageFormat.format(getGUIString(code, request), parameter); - } - - public static String getErrorString(String code, Object[] parameter, HttpServletRequest request) { - - return MessageFormat.format(getGUIString(code, request), parameter); - } - - public static String getErrorString(String code, Object[] parameter) { - - return MessageFormat.format(getGUIString(code), parameter); - } + } + + public static String getErrorString(String code, Object[] parameter) { + + return MessageFormat.format(getGUIString(code), parameter); + } } -- cgit v1.2.3 From f6b93dda9852534fe672cad65e978191d3aff5e3 Mon Sep 17 00:00:00 2001 From: Bojan Suzic Date: Wed, 2 Apr 2014 15:15:14 +0200 Subject: language --- .../at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'id/ConfigWebTool/src/main/java/at/gv/egovernment/moa') diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java index 3354fd708..9e5ba684c 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java @@ -41,7 +41,7 @@ public class GeneralStorkConfig { private static final Logger log = Logger.getLogger(GeneralStorkConfig.class); public void parse(MOAIDConfiguration config) { - log.error("STARTED STORK CONFIG"); + log.info("Initializing general Stork config"); if (config != null) { -- cgit v1.2.3 From 5d1bbe135b0d8d9ff0d8934f9d0a4311b61f46fb Mon Sep 17 00:00:00 2001 From: Bojan Suzic Date: Wed, 2 Apr 2014 15:22:18 +0200 Subject: language+ --- .../gv/egovernment/moa/id/configuration/helper/LanguageHelper.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'id/ConfigWebTool/src/main/java/at/gv/egovernment/moa') 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 b207e7118..c743036aa 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 @@ -46,10 +46,9 @@ public class LanguageHelper { try { ConfigurationProvider configurationProvider = ConfigurationProvider.getInstance(); if (configurationProvider.getDefaultLanguage().equals("en")) { - Logger.trace("Returning EN error message"); return errorRes_EN.getString(code); } else { - Logger.trace("Returning DE error message"); + return errorRes_DE.getString(code); } } catch (ConfigurationException e) { Logger.error("Configuration exception while getting ConfigurationProvider instance"); @@ -59,7 +58,6 @@ public class LanguageHelper { Logger.error("General exception while returning translated message"); return errorRes_DE.getString(code); } - return errorRes_DE.getString(code); } private static String guiLanguage(String code) { @@ -67,10 +65,8 @@ public class LanguageHelper { try { ConfigurationProvider configurationProvider = ConfigurationProvider.getInstance(); if (configurationProvider.getDefaultLanguage().equals("en")) { - Logger.trace("Returning EN gui message: " + guiRes_EN.getString(code)); return guiRes_EN.getString(code); } else { - Logger.trace("Returning DE gui message: " + guiRes_DE.getString(code) + " /en>" + guiRes_EN.getString(code)); return guiRes_DE.getString(code); } } catch (ConfigurationException e) { -- cgit v1.2.3