Bug#714394: pdfsam: fix support for system default locale (patch included)
Ronny Standtke
ronny.standtke at fhnw.ch
Fri Jun 28 18:57:01 UTC 2013
Package: pdfsam
Version: 1.1.4-2
Severity: normal
pdfsam uses Locale.UK per default, even when it supports the current system
locale. This way a user outside the UK always has to know about this and
change
the language settings of pdfsam manually. The current locale handling also
does not allow pdfsam to simply follow the system locale settings, instead a
user always has to reconfigure pdfsam manually every time after changing
the system locale.
The attached patch fixes this issue. If you approve the patch, feel free to
send the changes upstream.
-- System Information:
Debian Release: 7.1
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: i386 (i686)
Kernel: Linux 3.9-1-486
Locale: LANG=de_CH.UTF-8, LC_CTYPE=de_CH.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages pdfsam depends on:
ii default-jre [java2-runtime] 1:1.7-48~bpo70+1
ii java-wrappers 0.1.25
ii libcommons-httpclient-java 3.1-10.2
ii libdom4j-java 1.6.1+dfsg.2-6
ii libhttpclient-java 4.1.1-2
ii libitext-java 2.1.7-3+deb7u1
ii libjaxen-java 1.1.3-1
ii libjgoodies-looks-java 2.5.0-2
ii liblog4j1.2-java 1.2.16-3
ii openjdk-7-jre [java2-runtime] 7u21-2.3.9-1~bpo70+1
pdfsam recommends no packages.
pdfsam suggests no packages.
-- no debconf information
-------------- next part --------------
Description: fixed system locale handling
This patch adds support for system default locale handling so that pdfsam
starts with the system language per default and uses "Locale.UK" only as
the fallback locale if the system locale is not supported by pdfsam.
.
pdfsam (1.1.4-3) unstable; urgency=low
.
* fixed system locale handling
Author: Ronny Standtke <ronny.standtke at fhnw.ch>
--- pdfsam-1.1.4.orig/pdfsam-maine-br1/src/java/org/pdfsam/guiclient/l10n/LanguageLoader.java
+++ pdfsam-1.1.4/pdfsam-maine-br1/src/java/org/pdfsam/guiclient/l10n/LanguageLoader.java
@@ -23,8 +23,9 @@ import java.util.ResourceBundle;
public class LanguageLoader {
//const
- public static final String DEFAULT_LANGUAGE = "en_GB";
- public final Locale DEFAULT_LOCALE = Locale.UK;
+ public static final Locale DEFAULT_LOCALE = Locale.getDefault();
+ public static final Locale FALLBACK_LOCALE = Locale.UK;
+ public static final String DEFAULT_LANGUAGE = DEFAULT_LOCALE.getLanguage();
//vars
private String bundleName;
private Locale currentLocale;
@@ -45,7 +46,7 @@ public class LanguageLoader {
currentLocale = new Locale (i18nInfos[0].toLowerCase());
}
}catch(Exception ex){
- currentLocale = DEFAULT_LOCALE;
+ currentLocale = FALLBACK_LOCALE;
}
}
@@ -57,7 +58,7 @@ public class LanguageLoader {
try{
return ResourceBundle.getBundle(bundleName, currentLocale);
}catch(Exception exc){
- return ResourceBundle.getBundle(bundleName, DEFAULT_LOCALE);
+ return ResourceBundle.getBundle(bundleName, FALLBACK_LOCALE);
}
}
@@ -69,7 +70,7 @@ public class LanguageLoader {
try{
return ResourceBundle.getBundle(bundleName, currentLocale, cl);
}catch(Exception exc){
- return ResourceBundle.getBundle(bundleName, DEFAULT_LOCALE, cl);
+ return ResourceBundle.getBundle(bundleName, FALLBACK_LOCALE, cl);
}
}
--- pdfsam-1.1.4.orig/pdfsam-maine-br1/src/java/org/pdfsam/guiclient/configuration/Configuration.java
+++ pdfsam-1.1.4/pdfsam-maine-br1/src/java/org/pdfsam/guiclient/configuration/Configuration.java
@@ -206,6 +206,7 @@ public class Configuration{
log.warn("Unable to get language ResourceBudle, setting the default language.", e);
language = LanguageLoader.DEFAULT_LANGUAGE;
}
+ log.info("Language: " + language);
//get bundle
i18nMessages = (new LanguageLoader(language, "org.pdfsam.i18n.resources.Messages").getBundle());
--- pdfsam-1.1.4.orig/pdfsam-langpack-br1/src/java/org/pdfsam/i18n/languages.xml
+++ pdfsam-1.1.4/pdfsam-langpack-br1/src/java/org/pdfsam/i18n/languages.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<languages>
+ <language value="" description="System default" />
<language value="bs" description="Bosnian" />
<language value="pt_BR" description="Brazilian Portuguese" />
<language value="bg" description="Bulgarian" />
--- pdfsam-1.1.4.orig/template-basic-1/config.xml
+++ pdfsam-1.1.4/template-basic-1/config.xml
@@ -12,7 +12,6 @@
<LAF>5</LAF>
<theme>14</theme>
</lookAndfeel>
- <i18n>en_GB</i18n>
<plugs_absolute_dir/>
<defaultjob></defaultjob>
<loglevel>10000</loglevel>
More information about the pkg-java-maintainers
mailing list