summaryrefslogtreecommitdiff
path: root/trunk
diff options
context:
space:
mode:
Diffstat (limited to 'trunk')
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java2
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Messages.java17
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java8
3 files changed, 21 insertions, 6 deletions
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java
index e570a773..3879e79e 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java
+++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java
@@ -29,7 +29,7 @@ public class Constants {
private static Display display = Display.getCurrent();
/** Supported locales */
- public static final Locale[] SUPPORTED_LOCALES = { Locale.ENGLISH, Locale.GERMAN };
+ public static final Locale[] SUPPORTED_LOCALES = { Locale.GERMAN, Locale.ENGLISH };
/** Main window height */
public static final int MAINWINDOW_HEIGHT = 780;
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Messages.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Messages.java
index 77e2f764..b17e168a 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Messages.java
+++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Messages.java
@@ -41,12 +41,25 @@ public class Messages {
//private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
// .getBundle(BUNDLE_NAME);
- private static Locale currentLocale = Locale.getDefault();
+ private static Locale currentLocale = getDefaultLocale();
private Messages() {
}
/**
+ * Get the closest match to the system default Locale out of the supported locales
+ * @return the default locale
+ */
+ public static Locale getDefaultLocale() {
+ Locale ld = Locale.getDefault();
+ for (Locale l : Constants.SUPPORTED_LOCALES) {
+ if (l.equals(ld) || l.getLanguage().equals(ld.getLanguage()))
+ return l;
+ }
+ return Constants.SUPPORTED_LOCALES[0];
+ }
+
+ /**
* Sets the currently used locals
* @param locale
*/
@@ -56,9 +69,11 @@ public class Messages {
private static ResourceBundle getBundle(Locale locale) {
if(!bundles.containsKey(locale)) {
+ log.debug("Loading resource bundle for " + locale); //$NON-NLS-1$
ResourceBundle tmp = null;
try {
tmp = ResourceBundle.getBundle(BUNDLE_NAME, locale);
+ log.debug("Received bundle for " + tmp.getLocale()); //$NON-NLS-1$
} catch(Exception e) {
log.error("NO RESOURCE BUNDLE FOR " + locale.toString(), e); //$NON-NLS-1$
tmp = ResourceBundle.getBundle(BUNDLE_NAME);
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java
index 1e628342..ee44dad2 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java
+++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java
@@ -66,8 +66,8 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
private String defaultPassword = STRING_EMPTY;
- private Locale locale = Locale.getDefault();
- private Locale signLocale = Locale.getDefault();
+ private Locale locale = Messages.getDefaultLocale();
+ private Locale signLocale = this.locale;
private String emblem = STRING_EMPTY;
@@ -593,7 +593,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
@Override
public void setLocale(Locale locale) {
if(locale == null) {
- this.locale = Locale.getDefault();
+ this.locale = Messages.getDefaultLocale();
} else {
this.locale = locale;
Locale.setDefault(locale);
@@ -607,7 +607,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
@Override
public void setSignLocale(Locale locale) {
if(locale == null) {
- this.signLocale = Locale.getDefault();
+ this.signLocale = Messages.getDefaultLocale();
} else {
this.signLocale = locale;
}