diff dwtx/jface/internal/text/html/HTMLMessages.d @ 150:5cf141e43417

...
author Frank Benoit <benoit@tionex.de>
date Sun, 24 Aug 2008 23:05:26 +0200
parents 000f9136b8f7
children 77b70cbb4c8d
line wrap: on
line diff
--- a/dwtx/jface/internal/text/html/HTMLMessages.d	Sun Aug 24 22:41:48 2008 +0200
+++ b/dwtx/jface/internal/text/html/HTMLMessages.d	Sun Aug 24 23:05:26 2008 +0200
@@ -37,9 +37,14 @@
  */
 class HTMLMessages {
 
-    private static const String RESOURCE_BUNDLE= HTMLMessages.class.getName();
+//     private static const String RESOURCE_BUNDLE= HTMLMessages.class.getName();
+
+    private static ResourceBundle fgResourceBundle;//= ResourceBundle.getBundle(RESOURCE_BUNDLE);
 
-    private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
+    static this() {
+        fgResourceBundle = ResourceBundle.getBundle(
+            getImportData!("dwtx.jface.internal.text.html.HTMLMessages.properties"));
+    }
 
     private this() {
     }
@@ -54,7 +59,7 @@
         try {
             return fgResourceBundle.getString(key);
         } catch (MissingResourceException e) {
-            return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
+            return "!" ~ key ~ "!";//$NON-NLS-2$ //$NON-NLS-1$
         }
     }
 
@@ -65,32 +70,14 @@
      * @param args the arguments used to format the string
      * @return the formatted string
      */
-    public static String getFormattedString(String key, Object[] args) {
+    public static String getFormattedString(String key, Object[] args...) {
         String format= null;
         try {
             format= fgResourceBundle.getString(key);
         } catch (MissingResourceException e) {
-            return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
+            return "!" ~ key ~ "!";//$NON-NLS-2$ //$NON-NLS-1$
         }
         return MessageFormat.format(format, args);
     }
 
-    /**
-     * Gets a string from the resource bundle and formats it with the given argument.
-     *
-     * @param key the string used to get the bundle value, must not be null
-     * @param arg the argument used to format the string
-     * @return the formatted string
-     */
-    public static String getFormattedString(String key, Object arg) {
-        String format= null;
-        try {
-            format= fgResourceBundle.getString(key);
-        } catch (MissingResourceException e) {
-            return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
-        }
-        if (arg is null)
-            arg= ""; //$NON-NLS-1$
-        return MessageFormat.format(format, new Object[] { arg });
-    }
 }