diff options
author | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-07-06 12:33:33 +0200 |
---|---|---|
committer | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-07-06 12:33:33 +0200 |
commit | e4767bccc7324d4b61a334bf6c0558d0080045e2 (patch) | |
tree | 728a5df44f02ca10f760b979873c990cd4c0d265 /pdf-over-commons/src/main/java/at/asit/pdfover/commons/Messages.java | |
parent | 3422e5eb2819f5de304f25dc622f5284813bb9b4 (diff) | |
download | pdf-over-e4767bccc7324d4b61a334bf6c0558d0080045e2.tar.gz pdf-over-e4767bccc7324d4b61a334bf6c0558d0080045e2.tar.bz2 pdf-over-e4767bccc7324d4b61a334bf6c0558d0080045e2.zip |
remove NON-NLS comments, cleanup whitespace
Diffstat (limited to 'pdf-over-commons/src/main/java/at/asit/pdfover/commons/Messages.java')
-rw-r--r-- | pdf-over-commons/src/main/java/at/asit/pdfover/commons/Messages.java | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/pdf-over-commons/src/main/java/at/asit/pdfover/commons/Messages.java b/pdf-over-commons/src/main/java/at/asit/pdfover/commons/Messages.java index 36cc921d..0d2f2295 100644 --- a/pdf-over-commons/src/main/java/at/asit/pdfover/commons/Messages.java +++ b/pdf-over-commons/src/main/java/at/asit/pdfover/commons/Messages.java @@ -30,18 +30,18 @@ import org.slf4j.LoggerFactory; * Localizes string messages for PDFOver GUI */ public class Messages { - + /** * SLF4J Logger instance **/ static final Logger log = LoggerFactory.getLogger(Messages.class); - - private static final String BUNDLE_NAME = "at.asit.pdfover.gui.messages"; //$NON-NLS-1$ + + private static final String BUNDLE_NAME = "at.asit.pdfover.gui.messages"; // private static HashMap<Locale, ResourceBundle> bundles = new HashMap<>(); private static Locale currentLocale = getDefaultLocale(); - + private Messages() { } @@ -65,20 +65,20 @@ public class Messages { public static void setLocale(Locale locale) { currentLocale = locale; } - + private static ResourceBundle getBundle(Locale locale) { if(!bundles.containsKey(locale)) { - log.debug("Loading resource bundle for {}", locale); //$NON-NLS-1$ + log.debug("Loading resource bundle for {}", locale); // ResourceBundle tmp = null; try { tmp = ResourceBundle.getBundle(BUNDLE_NAME, locale); - log.debug("Received bundle for {}", tmp.getLocale()); //$NON-NLS-1$ + log.debug("Received bundle for {}", tmp.getLocale()); // } catch(Exception e) { - log.error("NO RESOURCE BUNDLE FOR {} {}", locale, e); //$NON-NLS-1$ + log.error("NO RESOURCE BUNDLE FOR {} {}", locale, e); // tmp = ResourceBundle.getBundle(BUNDLE_NAME); } if(tmp == null) { - log.error("NO RESOURCE BUNDLE FOR {}", locale); //$NON-NLS-1$ + log.error("NO RESOURCE BUNDLE FOR {}", locale); // tmp = ResourceBundle.getBundle(BUNDLE_NAME); } bundles.put(locale, tmp); @@ -86,7 +86,7 @@ public class Messages { } return bundles.get(locale); } - + /** * Gets the localized message * @param key @@ -95,7 +95,7 @@ public class Messages { public static String getString(String key) { return getString(key, currentLocale); } - + /** * Gets the localized message * @param key the key @@ -105,7 +105,7 @@ public class Messages { public static String getString(String key, Locale locale) { try { String value = getBundle(locale).getString(key); - + /* DIRTY HACK: this recognizes java 8 ("1.8") and older; these versions read .properties files as ISO-8859-1 instead of UTF-8 */ if (System.getProperty("java.version").startsWith("1.")) try { value = new String(value.getBytes("ISO-8859-1"), "UTF-8"); } catch (UnsupportedEncodingException e) {} |