diff options
author | Bojan Suzic <bojan.suzic@iaik.tugraz.at> | 2014-04-02 15:14:49 +0200 |
---|---|---|
committer | Bojan Suzic <bojan.suzic@iaik.tugraz.at> | 2014-04-02 15:14:49 +0200 |
commit | e4669868c8c3bf0744ebb9deac1f1c3fe3664835 (patch) | |
tree | bef58125cd27e5c7796ca27122a28b6608b7b3a9 /id/ConfigWebTool/src/main | |
parent | 4b890232cc2ef904ede71663abb4fb5f3d8be7e8 (diff) | |
download | moa-id-spss-e4669868c8c3bf0744ebb9deac1f1c3fe3664835.tar.gz moa-id-spss-e4669868c8c3bf0744ebb9deac1f1c3fe3664835.tar.bz2 moa-id-spss-e4669868c8c3bf0744ebb9deac1f1c3fe3664835.zip |
language
Diffstat (limited to 'id/ConfigWebTool/src/main')
-rw-r--r-- | id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/helper/LanguageHelper.java | 87 | ||||
-rw-r--r-- | id/ConfigWebTool/src/main/resources/applicationResources_de.properties (renamed from id/ConfigWebTool/src/main/resources/applicationResources.properties) | 4 |
2 files changed, 50 insertions, 41 deletions
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); + } } diff --git a/id/ConfigWebTool/src/main/resources/applicationResources.properties b/id/ConfigWebTool/src/main/resources/applicationResources_de.properties index f48cac0c8..916206cf1 100644 --- a/id/ConfigWebTool/src/main/resources/applicationResources.properties +++ b/id/ConfigWebTool/src/main/resources/applicationResources_de.properties @@ -99,7 +99,7 @@ webpages.moaconfig.save.success=Die MOA-ID Konfiguration wurde erfolgreich gespe webpages.moaconfig.header=Allgemeine Konfiguration webpages.oaconfig.general.publicURLPreFix=Public URL Prefix webpages.moaconfig.defaultbkus.header=Default BKUs -webpages.moaconfig.slrequesttemplates.header=SecurtiyLayer Request Templates +webpages.moaconfig.slrequesttemplates.header=SecurityLayer Request Templates webpages.moaconfig.slrequesttemplates.local=Locale BKU webpages.moaconfig.slrequesttemplates.handy=Handy BKU webpages.moaconfig.slrequesttemplates.online=Online BKU @@ -402,7 +402,7 @@ validation.general.target.valid=Der Target f\u00FCr die Online-Applikation hat k validation.general.target.subsector.valid=Der Target-Subsektor hat kein g\u00FCltiges Format. validation.general.target.admin.valid=Der Admin-Target f\u00FCr die Online-Applikation hat kein g\u00FCltiges Format. validation.general.target.publicserviceurl=Die Domain des eindeutigen Identifiers f\u00FCr die Online-Applikation erlaubt nur Applikationen aus dem privatwirtschaftlichen Bereich. -validation.general.slversion=Die SecurtiyLayer Version ist kein Zahlenformat. +validation.general.slversion=Die SecurityLayer Version ist kein Zahlenformat. validation.general.slversion.business=Im privatwirtschaftlichen Bereich muss die SecurityLayerversion mindestes 1.2 betragen. Die SLVersion wurde auf 1.2 ge\u00E4ndert. validation.general.targetfriendlyname=Der Name des Bereichs (Target) enth\u00E4lt nicht erlaubte Zeichen. Folgende Zeichen sind nicht erlaubt\: {0} validation.general.identificationtype.valid=Der Identifikationstype wird nicht unterst\u00FCtzt. |