Mercurial > dive4elements > gnv-client
diff gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/ressource/RessourceFactory.java @ 118:5ebc059064a6
Adding Languagetransfer to the ArtifactDatabase to the GNV-Client
gnv-artifacts/trunk@181 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Mon, 05 Oct 2009 07:52:13 +0000 |
parents | ef157bd2fa92 |
children | 6b9a07f758cf |
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/ressource/RessourceFactory.java Fri Oct 02 14:24:47 2009 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/ressource/RessourceFactory.java Mon Oct 05 07:52:13 2009 +0000 @@ -3,11 +3,12 @@ */ package de.intevation.gnv.artifacts.ressource; -import java.util.Locale; import java.util.ResourceBundle; import org.apache.log4j.Logger; +import de.intevation.artifacts.PreferredLocale; + /** * @author Tim Englich <tim.englich@intevation.de> * @@ -29,8 +30,7 @@ private static String ressourceName = "artifactMessages"; private String ressourceDir = null; - - private Locale[] supportedLocales = null; + /** * Basic-Constructor of this Class */ @@ -40,8 +40,6 @@ if (ressourceDir == null){ ressourceDir = "de/intevation/gnv/artifacts/ressource"; } - supportedLocales = new Locale[1]; - supportedLocales[0] = Locale.GERMAN; } /** @@ -62,8 +60,8 @@ * @param defaultValue the Value that should be returned. * @return the translated Value */ - public String getRessource(Locale locale, String key, String defaultValue){ - ResourceBundle rb = ResourceBundle.getBundle(ressourceDir+"/"+ressourceName, locale); + public String getRessource(PreferredLocale[] preferredLocales, String key, String defaultValue){ + ResourceBundle rb = ResourceBundle.getBundle(ressourceDir+"/"+ressourceName, preferredLocales[0].getLocale()); try { return rb.getString(key); } catch (Exception e) { @@ -71,8 +69,4 @@ return defaultValue; } } - - public Locale[] getSupportedLocales(){ - return supportedLocales; - } }