Add ability to output HTML report of differences found between two versions.
[cfb.git] / prod / net / jaekl / cfb / CfbBundle.java
index 335a68dfbbb761c914b5523fee10115bba5e75e9..8ea3c68f669d8306f6e43027251f47aa22e46ed8 100644 (file)
@@ -2,6 +2,7 @@ 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;
@@ -11,10 +12,23 @@ 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";
        
@@ -40,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) {
@@ -51,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();
        }
 }