Author: nextgens
Date: 2008-01-18 23:10:40 +0000 (Fri, 18 Jan 2008)
New Revision: 17158

Modified:
   trunk/apps/Thaw/src/thaw/core/I18n.java
Log:
Thaw: simplify the l18n api, spare some memory

Modified: trunk/apps/Thaw/src/thaw/core/I18n.java
===================================================================
--- trunk/apps/Thaw/src/thaw/core/I18n.java     2008-01-18 22:55:56 UTC (rev 
17157)
+++ trunk/apps/Thaw/src/thaw/core/I18n.java     2008-01-18 23:10:40 UTC (rev 
17158)
@@ -40,33 +40,26 @@
        };

        private static Locale currentLocale;
+       private static ResourceBundle currentResourceBundle;

-       public I18n() {
-
+       static {
+               currentResourceBundle = 
ResourceBundle.getBundle("thaw.i18n.thaw", I18n.getLocale());
+               currentLocale = Locale.getDefault();
        }

        public static Locale getLocale() {
-               if (I18n.currentLocale == null)
-                       I18n.currentLocale = Locale.getDefault();
-               return I18n.currentLocale;
+               return currentLocale;
        }

        public static void setLocale(final Locale locale) {
-               I18n.currentLocale = locale;
+               currentLocale = locale;
                Locale.setDefault(locale);
+               currentResourceBundle = 
ResourceBundle.getBundle("thaw.i18n.thaw", locale);
        }

-       public static ResourceBundle getResourceBundle() {
-               return I18n.getResourceBundle(I18n.getLocale());
-       }
-
-       public static ResourceBundle getResourceBundle(final Locale locale) {
-               return ResourceBundle.getBundle("thaw.i18n.thaw", 
I18n.getLocale());
-       }
-
        public static String getMessage(final String key) {
                try {
-                       return I18n.getResourceBundle().getString(key);
+                       return currentResourceBundle.getString(key);
                } catch(final Exception e) {
                        Logger.warning(new I18n(),
                                       "Unable to find translation for 
'"+key+"'");


Reply via email to