diff options
Diffstat (limited to 'BKUCommonGUI/src/main/java/at')
3 files changed, 24 insertions, 7 deletions
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java index 27841d1c..9f733a14 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java @@ -92,10 +92,10 @@ public class BKUGUI implements BKUGUIFacade { * @param localeString may be null */ @Override - public void init(final Container contentPane, String localeString, final URL background, ActionListener helpListener) { + public void init(final Container contentPane, Locale locale, final URL background, ActionListener helpListener) { - if (localeString != null) { - messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, new Locale(localeString)); + if (locale != null) { + messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, locale); } else { messages = ResourceBundle.getBundle(MESSAGES_BUNDLE); } @@ -249,6 +249,11 @@ public class BKUGUI implements BKUGUIFacade { } @Override + public Locale getLocale() { + return messages.getLocale(); + } + + @Override public void showLoginDialog(ActionListener loginListener, String actionCommand) { log.debug("scheduling login dialog"); diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java index 4ef1b7d9..6655cf64 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java @@ -24,6 +24,7 @@ import java.awt.Container; import java.awt.event.ActionListener; import java.net.URL; import java.util.List; +import java.util.Locale; public interface BKUGUIFacade { @@ -85,7 +86,13 @@ public interface BKUGUIFacade { public static final String SAVE_HASHDATAINPUT_PREFIX = "save.hashdatainput.prefix"; - public void init(Container contentPane, String localeString, URL background, ActionListener helpListener); + public void init(Container contentPane, Locale locale, URL background, ActionListener helpListener); + + /** + * + * @return the locale of the message bundle (what if no message bundle could be loaded for the requested locale?) + */ + public Locale getLocale(); public void showWelcomeDialog(); diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java index 195db27a..a005292e 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java @@ -90,10 +90,10 @@ public class SimpleGUI implements BKUGUIFacade { * @param localeString may be null */ @Override - public void init(final Container contentPane, String localeString, final URL background, ActionListener helpListener) { + public void init(final Container contentPane, Locale locale, final URL background, ActionListener helpListener) { - if (localeString != null) { - messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, new Locale(localeString)); + if (locale != null) { + messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, locale); } else { messages = ResourceBundle.getBundle(MESSAGES_BUNDLE); } @@ -244,6 +244,11 @@ public class SimpleGUI implements BKUGUIFacade { } @Override + public Locale getLocale() { + return messages.getLocale(); + } + + @Override public void showLoginDialog(ActionListener loginListener, String actionCommand) { log.debug("scheduling login dialog"); |