Add ability to output HTML report of differences found between two versions.
[cfb.git] / prod / net / jaekl / cfb / CfbBundle.java
index a643c6edc5a6b4f00bf728487579119d2658f303..8ea3c68f669d8306f6e43027251f47aa22e46ed8 100644 (file)
@@ -1,5 +1,8 @@
 package net.jaekl.cfb;
 
+// Copyright (C) 2015 Christian Jaekl
+
+import java.text.MessageFormat;
 import java.util.Locale;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
@@ -8,10 +11,24 @@ import java.util.concurrent.ConcurrentHashMap;
 import net.jaekl.qd.QDBundleFactory;
 
 public class CfbBundle {
+       public static final String ANALYSIS_FAILED = "analysis.failed";
+       public static final String ANALYZED_AT = "analyzed.at";
        public static final String CANNOT_CONNECT = "cannot.connect.to.db";
        public static final String CANNOT_EXEC = "cannot.exec";
+       public static final String CFB = "cfb";
+       public static final String CFB_REPORT = "cfb.report";
+       public static final String COMPARING_RUNS = "comparing.runs";
+       public static final String COMPARING_VERSIONS = "comparing.versions";
+       public static final String FIXED_BUGS = "fixed.bugs";
+       public static final String NEW_BUGS = "new.bugs";
+       public static final String NEW_VERSION = "new.version";
+       public static final String NUM_BUGS = "num.bugs";
+       public static final String NUM_BUGS_OLD = "num.bugs.old";
+       public static final String OLD_BUGS = "old.bugs";
+       public static final String OLD_VERSION = "old.version";
        public static final String STDERR_WAS = "stderr.was";
        public static final String STDOUT_WAS = "stdout.was";
+       public static final String VERSION_NUM = "version.num";
        
        final static String BUNDLE_NAME = "cfb";
        
@@ -37,10 +54,11 @@ public class CfbBundle {
                m_bundle = QDBundleFactory.getInst().getBundle(BUNDLE_NAME, locale); 
        }
        
-       public String get(String key) {
+       public String get(String key, Object... arguments) {
                try {
                        if (null != m_bundle) {
-                               return m_bundle.getString(key);
+                               String pattern = m_bundle.getString(key);
+                               return MessageFormat.format(pattern, arguments);
                        }
                }
                catch (MissingResourceException exc) {
@@ -48,6 +66,11 @@ public class CfbBundle {
                        exc.printStackTrace();  
                        // Fall through to the fallback behaviour below
                }
-               return "[" + key + "]";
+               
+               StringBuilder sb = new StringBuilder("[" + key + "]");
+               for (Object obj : arguments) {
+                       sb.append("[" + obj + "]");
+               }
+               return sb.toString();
        }
 }