From 6211ed7f96c4ee6e1616a7c1e44477b9f3e8117f Mon Sep 17 00:00:00 2001 From: clemenso Date: Mon, 3 Nov 2008 12:36:42 +0000 Subject: localization git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@140 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java | 11 ++++++++--- .../src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 9 ++++++++- BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java | 11 ++++++++--- 3 files changed, 24 insertions(+), 7 deletions(-) (limited to 'BKUCommonGUI/src/main/java/at/gv') 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); } @@ -248,6 +248,11 @@ public class BKUGUI implements BKUGUIFacade { .addContainerGap()); } + @Override + public Locale getLocale() { + return messages.getLocale(); + } + @Override public void showLoginDialog(ActionListener loginListener, String actionCommand) { 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); } @@ -243,6 +243,11 @@ public class SimpleGUI implements BKUGUIFacade { .addContainerGap()); } + @Override + public Locale getLocale() { + return messages.getLocale(); + } + @Override public void showLoginDialog(ActionListener loginListener, String actionCommand) { -- cgit v1.2.3