changeset 99:bedc94997add

Use Enums rather than hardcoding Strings for Resource Bundles. Reviewed-by: rkennke Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2012-March/000201.html
author Mario Torre <neugens.limasoftware@gmail.com>
date Fri, 02 Mar 2012 15:15:59 +0100
parents 05695193442d
children abed8154068a
files client/src/main/java/com/redhat/thermostat/client/ApplicationInfo.java client/src/main/java/com/redhat/thermostat/client/HostPanelFacadeImpl.java client/src/main/java/com/redhat/thermostat/client/Main.java client/src/main/java/com/redhat/thermostat/client/MainWindowFacadeImpl.java client/src/main/java/com/redhat/thermostat/client/MemoryType.java client/src/main/java/com/redhat/thermostat/client/Translate.java client/src/main/java/com/redhat/thermostat/client/VmPanelFacadeImpl.java client/src/main/java/com/redhat/thermostat/client/locale/LocaleResources.java client/src/main/java/com/redhat/thermostat/client/locale/Translate.java client/src/main/java/com/redhat/thermostat/client/ui/AboutDialog.java client/src/main/java/com/redhat/thermostat/client/ui/ConnectionSelectionDialog.java client/src/main/java/com/redhat/thermostat/client/ui/HostPanel.java client/src/main/java/com/redhat/thermostat/client/ui/MainWindow.java client/src/main/java/com/redhat/thermostat/client/ui/SummaryPanel.java client/src/main/java/com/redhat/thermostat/client/ui/VmPanel.java client/src/main/resources/com/redhat/thermostat/client/locale/strings.properties client/src/main/resources/com/redhat/thermostat/client/strings.properties client/src/test/java/com/redhat/thermostat/client/locale/TranslateTest.java common/src/main/resources/com/redhat/thermostat/app-info.properties
diffstat 19 files changed, 510 insertions(+), 318 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/main/java/com/redhat/thermostat/client/ApplicationInfo.java	Fri Mar 02 11:18:29 2012 +0100
+++ b/client/src/main/java/com/redhat/thermostat/client/ApplicationInfo.java	Fri Mar 02 15:15:59 2012 +0100
@@ -36,7 +36,8 @@
 
 package com.redhat.thermostat.client;
 
-import static com.redhat.thermostat.client.Translate.localize;
+import static com.redhat.thermostat.client.locale.Translate.localize;
+
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
@@ -46,6 +47,7 @@
 
 import javax.swing.Icon;
 
+import com.redhat.thermostat.client.locale.LocaleResources;
 import com.redhat.thermostat.client.ui.IconResource;
 import com.redhat.thermostat.common.utils.LoggingUtils;
 
@@ -71,15 +73,15 @@
     }
 
     public String getName() {
-        return appInfo.getProperty("APP_NAME", localize("MISSING_INFO"));
+        return appInfo.getProperty("APP_NAME", localize(LocaleResources.MISSING_INFO));
     }
 
     public String getVersion() {
-        return appInfo.getProperty("APP_VERSION", localize("MISSING_INFO"));
+        return appInfo.getProperty("APP_VERSION", localize(LocaleResources.MISSING_INFO));
     }
 
     public String getDescription() {
-        return appInfo.getProperty("APP_DESCRIPTION", localize("MISSING_INFO"));
+        return appInfo.getProperty("APP_DESCRIPTION", localize(LocaleResources.MISSING_INFO));
     }
 
     public Icon getIcon() {
@@ -91,23 +93,23 @@
     }
 
     public String getReleaseDate() {
-        return appInfo.getProperty("APP_RELEASE_DATE", localize("MISSING_INFO"));
+        return appInfo.getProperty("APP_RELEASE_DATE", localize(LocaleResources.MISSING_INFO));
     }
 
     public String getCopyright() {
-        return appInfo.getProperty("APP_COPYRIGHT", localize("MISSING_INFO"));
+        return appInfo.getProperty("APP_COPYRIGHT", localize(LocaleResources.MISSING_INFO));
     }
 
     public String getLicenseSummary() {
-        return appInfo.getProperty("APP_LICENSE_SUMMARY", localize("MISSING_INFO"));
+        return appInfo.getProperty("APP_LICENSE_SUMMARY", localize(LocaleResources.MISSING_INFO));
     }
 
     public String getEmail() {
-        return appInfo.getProperty("APP_EMAIL", localize("MISSING_INFO"));
+        return appInfo.getProperty("APP_EMAIL", localize(LocaleResources.MISSING_INFO));
     }
 
     public String getWebsite() {
-        return appInfo.getProperty("APP_WEBSITE", localize("MISSING_INFO"));
+        return appInfo.getProperty("APP_WEBSITE", localize(LocaleResources.MISSING_INFO));
     }
 
 }
--- a/client/src/main/java/com/redhat/thermostat/client/HostPanelFacadeImpl.java	Fri Mar 02 11:18:29 2012 +0100
+++ b/client/src/main/java/com/redhat/thermostat/client/HostPanelFacadeImpl.java	Fri Mar 02 15:15:59 2012 +0100
@@ -36,12 +36,11 @@
 
 package com.redhat.thermostat.client;
 
-import static com.redhat.thermostat.client.Translate.localize;
+import static com.redhat.thermostat.client.locale.Translate.localize;
 
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 import java.util.Timer;
@@ -63,6 +62,7 @@
 import com.mongodb.DBCollection;
 import com.mongodb.DBCursor;
 import com.mongodb.DBObject;
+import com.redhat.thermostat.client.locale.LocaleResources;
 import com.redhat.thermostat.common.NetworkInfo;
 import com.redhat.thermostat.common.NetworkInterfaceInfo;
 
@@ -100,9 +100,9 @@
         memoryStatsCollection = db.getCollection("memory-stats");
 
         networkTableColumnVector = new Vector<String>();
-        networkTableColumnVector.add(localize("NETWORK_INTERFACE_COLUMN"));
-        networkTableColumnVector.add(localize("NETWORK_IPV4_COLUMN"));
-        networkTableColumnVector.add(localize("NETWORK_IPV6_COLUMN"));
+        networkTableColumnVector.add(localize(LocaleResources.NETWORK_INTERFACE_COLUMN));
+        networkTableColumnVector.add(localize(LocaleResources.NETWORK_IPV4_COLUMN));
+        networkTableColumnVector.add(localize(LocaleResources.NETWORK_IPV6_COLUMN));
 
         cpuLoadTimeSeriesCollection.addSeries(cpuLoadSeries);
 
--- a/client/src/main/java/com/redhat/thermostat/client/Main.java	Fri Mar 02 11:18:29 2012 +0100
+++ b/client/src/main/java/com/redhat/thermostat/client/Main.java	Fri Mar 02 15:15:59 2012 +0100
@@ -36,7 +36,8 @@
 
 package com.redhat.thermostat.client;
 
-import static com.redhat.thermostat.client.Translate.localize;
+import static com.redhat.thermostat.client.locale.Translate.localize;
+
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -47,6 +48,7 @@
 
 import com.redhat.thermostat.client.Connection.ConnectionListener;
 import com.redhat.thermostat.client.Connection.ConnectionStatus;
+import com.redhat.thermostat.client.locale.LocaleResources;
 import com.redhat.thermostat.client.ui.ConnectionSelectionDialog;
 import com.redhat.thermostat.client.ui.MainWindow;
 import com.redhat.thermostat.common.Constants;
@@ -89,8 +91,8 @@
                 if (newStatus == ConnectionStatus.FAILED_TO_CONNECT) {
                     JOptionPane.showMessageDialog(
                             null,
-                            localize("CONNECTION_FAILED_TO_CONNECT_DESCRIPTION"),
-                            localize("CONNECTION_FAILED_TO_CONNECT_TITLE"),
+                            localize(LocaleResources.CONNECTION_FAILED_TO_CONNECT_DESCRIPTION),
+                            localize(LocaleResources.CONNECTION_FAILED_TO_CONNECT_TITLE),
                             JOptionPane.ERROR_MESSAGE);
                     System.exit(Constants.EXIT_UNABLE_TO_CONNECT_TO_DATABASE);
                 }
--- a/client/src/main/java/com/redhat/thermostat/client/MainWindowFacadeImpl.java	Fri Mar 02 11:18:29 2012 +0100
+++ b/client/src/main/java/com/redhat/thermostat/client/MainWindowFacadeImpl.java	Fri Mar 02 15:15:59 2012 +0100
@@ -36,7 +36,7 @@
 
 package com.redhat.thermostat.client;
 
-import static com.redhat.thermostat.client.Translate.localize;
+import static com.redhat.thermostat.client.locale.Translate.localize;
 
 import java.io.PrintStream;
 import java.util.ArrayList;
@@ -61,6 +61,7 @@
 import com.mongodb.DBCollection;
 import com.mongodb.DBCursor;
 import com.mongodb.DBObject;
+import com.redhat.thermostat.client.locale.LocaleResources;
 import com.redhat.thermostat.common.utils.LoggingUtils;
 import com.redhat.thermostat.common.utils.StringUtils;
 
@@ -72,7 +73,8 @@
     private final DBCollection hostInfoCollection;
     private final DBCollection vmInfoCollection;
 
-    private final DefaultMutableTreeNode publishedRoot = new DefaultMutableTreeNode(localize("MAIN_WINDOW_TREE_ROOT_NAME"));
+    private final DefaultMutableTreeNode publishedRoot = 
+            new DefaultMutableTreeNode(localize(LocaleResources.MAIN_WINDOW_TREE_ROOT_NAME));
     private final DefaultTreeModel publishedTreeModel = new DefaultTreeModel(publishedRoot);
 
     private String filterText;
--- a/client/src/main/java/com/redhat/thermostat/client/MemoryType.java	Fri Mar 02 11:18:29 2012 +0100
+++ b/client/src/main/java/com/redhat/thermostat/client/MemoryType.java	Fri Mar 02 15:15:59 2012 +0100
@@ -36,15 +36,17 @@
 
 package com.redhat.thermostat.client;
 
-import static com.redhat.thermostat.client.Translate.localize;
+import static com.redhat.thermostat.client.locale.Translate.localize;
+
+import com.redhat.thermostat.client.locale.LocaleResources;
 
 public enum MemoryType {
-    MEMORY_TOTAL("total", localize("HOST_MEMORY_TOTAL")),
-    MEMORY_FREE("free", localize("HOST_MEMORY_FREE")),
-    MEMORY_USED("used", localize("HOST_MEMORY_USED")),
-    SWAP_TOTAL("swap-total", localize("HOST_SWAP_TOTAL")),
-    SWAP_FREE("swap-free", localize("HOST_SWAP_FREE")),
-    SWAP_BUFFERS("buffers", localize("HOST_BUFFERS"));
+    MEMORY_TOTAL("total", localize(LocaleResources.HOST_MEMORY_TOTAL)),
+    MEMORY_FREE("free", localize(LocaleResources.HOST_MEMORY_FREE)),
+    MEMORY_USED("used", localize(LocaleResources.HOST_MEMORY_USED)),
+    SWAP_TOTAL("swap-total", localize(LocaleResources.HOST_SWAP_TOTAL)),
+    SWAP_FREE("swap-free", localize(LocaleResources.HOST_SWAP_FREE)),
+    SWAP_BUFFERS("buffers", localize(LocaleResources.HOST_BUFFERS));
 
     private String humanReadable;
     private String internalName;
--- a/client/src/main/java/com/redhat/thermostat/client/Translate.java	Fri Mar 02 11:18:29 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * Copyright 2012 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.client;
-
-import java.text.MessageFormat;
-import java.util.ResourceBundle;
-
-public class Translate {
-
-    private static ResourceBundle resourceBundle = null;
-
-    static {
-        resourceBundle = ResourceBundle.getBundle("com.redhat.thermostat.client.strings");
-    }
-
-    public static String localize(String toTranslate) {
-        return resourceBundle.getString(toTranslate);
-    }
-
-    public static String localize(String toTranslate, String... params) {
-        return MessageFormat.format(localize(toTranslate), (Object[]) params);
-    }
-}
--- a/client/src/main/java/com/redhat/thermostat/client/VmPanelFacadeImpl.java	Fri Mar 02 11:18:29 2012 +0100
+++ b/client/src/main/java/com/redhat/thermostat/client/VmPanelFacadeImpl.java	Fri Mar 02 15:15:59 2012 +0100
@@ -36,7 +36,7 @@
 
 package com.redhat.thermostat.client;
 
-import static com.redhat.thermostat.client.Translate.localize;
+import static com.redhat.thermostat.client.locale.Translate.localize;
 
 import java.text.DateFormat;
 import java.util.ArrayList;
@@ -61,6 +61,7 @@
 import com.mongodb.DBCollection;
 import com.mongodb.DBCursor;
 import com.mongodb.DBObject;
+import com.redhat.thermostat.client.locale.LocaleResources;
 import com.redhat.thermostat.common.VmMemoryStat;
 import com.redhat.thermostat.common.VmMemoryStat.Generation;
 import com.redhat.thermostat.common.VmMemoryStat.Space;
@@ -123,7 +124,7 @@
                     // Only show a stop time if we have actually stopped.
                     stopTime.setText(vmRunningTimeFormat.format(new Date(actualStopTime)));
                 } else {
-                    stopTime.setText(localize("VM_INFO_RUNNING"));
+                    stopTime.setText(localize(LocaleResources.VM_INFO_RUNNING));
                 }
                 javaVersion.setText((String) vmInfoObject.get("runtime-version"));
                 javaHome.setText((String) vmInfoObject.get("java-home"));
@@ -135,7 +136,8 @@
                 String actualVmVersion = (String) vmInfoObject.get("vm-version");
                 vmVersion.setText(actualVmVersion);
                 vmArguments.setText((String) vmInfoObject.get("vm-arguments"));
-                vmNameAndVersion.setText(localize("VM_INFO_VM_NAME_AND_VERSION", actualVmName, actualVmVersion));
+                vmNameAndVersion.setText(localize(LocaleResources.VM_INFO_VM_NAME_AND_VERSION,
+                                                  actualVmName, actualVmVersion));
 
                 String[] collectorNames = getCollectorNames();
                 for (String collectorName: collectorNames) {
@@ -348,7 +350,7 @@
                 return g.name;
             }
         }
-        return localize("UNKNOWN_GEN");
+        return localize(LocaleResources.UNKNOWN_GEN);
     }
 
     private void doUpdateCurrentMemoryChartAsync() {
@@ -378,9 +380,11 @@
                 for (Generation generation: generations) {
                     List<Space> spaces = generation.spaces;
                     for (Space space: spaces) {
-                        dataset.addValue(space.used, localize("VM_CURRENT_MEMORY_CHART_USED"), space.name);
-                        dataset.addValue(space.capacity - space.used, localize("VM_CURRENT_MEMORY_CHART_CAPACITY"), space.name);
-                        dataset.addValue(space.maxCapacity - space.capacity, localize("VM_CURRENT_MEMORY_CHART_MAX_CAPACITY"), space.name);
+                        dataset.addValue(space.used, localize(LocaleResources.VM_CURRENT_MEMORY_CHART_USED), space.name);
+                        dataset.addValue(space.capacity - space.used,
+                                         localize(LocaleResources.VM_CURRENT_MEMORY_CHART_CAPACITY), space.name);
+                        dataset.addValue(space.maxCapacity - space.capacity,
+                                         localize(LocaleResources.VM_CURRENT_MEMORY_CHART_MAX_CAPACITY), space.name);
                     }
                 }
             } catch (InterruptedException ie) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/src/main/java/com/redhat/thermostat/client/locale/LocaleResources.java	Fri Mar 02 15:15:59 2012 +0100
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2012 Red Hat, Inc.
+ *
+ * This file is part of Thermostat.
+ *
+ * Thermostat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Thermostat is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Thermostat; see the file COPYING.  If not see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Linking this code with other modules is making a combined work
+ * based on this code.  Thus, the terms and conditions of the GNU
+ * General Public License cover the whole combination.
+ *
+ * As a special exception, the copyright holders of this code give
+ * you permission to link this code with independent modules to
+ * produce an executable, regardless of the license terms of these
+ * independent modules, and to copy and distribute the resulting
+ * executable under terms of your choice, provided that you also
+ * meet, for each linked independent module, the terms and conditions
+ * of the license of that module.  An independent module is a module
+ * which is not derived from or based on this code.  If you modify
+ * this code, you may extend this exception to your version of the
+ * library, but you are not obligated to do so.  If you do not wish
+ * to do so, delete this exception statement from your version.
+ */
+
+package com.redhat.thermostat.client.locale;
+
+public enum LocaleResources {
+    
+    MISSING_INFO,
+    
+    MAIN_WINDOW_TREE_ROOT_NAME,
+    
+    CONNECTION_FAILED_TO_CONNECT_TITLE,
+    CONNECTION_FAILED_TO_CONNECT_DESCRIPTION,
+    
+    BUTTON_CLOSE,
+    BUTTON_NEXT,
+    BUTTON_CANCEL,
+    BUTTON_OK,
+    
+    MENU_FILE,
+    MENU_FILE_CONNECT,
+    MENU_FILE_IMPORT,
+    MENU_FILE_EXPORT,
+    MENU_FILE_EXIT,
+    MENU_HELP,
+    MENU_HELP_ABOUT,
+    
+    GARBAGE_COLLECTION,
+    YOUNG_GEN,
+    EDEN_GEN,
+    S0_GEN,
+    S1_GEN,
+    OLD_GEN,
+    PERM_GEN,
+    UNKNOWN_GEN,
+    SOME_GENERATION,
+    
+    SECONDS,
+    MINUTES,
+    HOURS,
+    DAYS,
+
+    STARTUP_MODE_SELECTION_DIALOG_TITLE,
+    STARTUP_MODE_SELECTION_INTRO,
+    STARTUP_MODE_SELECTION_TYPE_LOCAL,
+    STARTUP_MODE_SELECTION_TYPE_REMOTE,
+    STARTUP_MODE_SELECTION_TYPE_CLUSTER,
+    STARTUP_MODE_SELECTION_URL_LABEL,
+
+    TREE_HOST_TOOLTIP_HOST_NAME,
+    TREE_HOST_TOOLTIP_AGENT_ID,
+    TREE_HOST_TOOLTIP_VM_NAME,
+    TREE_HOST_TOOLTIP_VM_ID,
+
+    ABOUT_DIALOG_LICENSE,
+    ABOUT_DIALOG_EMAIL,
+    ABOUT_DIALOG_WEBSITE,
+
+    APPLICATION_INFO_VERSION,
+    APPLICATION_INFO_DESCRIPTION,
+    APPLICATION_INFO_LICENSE,
+
+    HOME_PANEL_SECTION_SUMMARY,
+    HOME_PANEL_TOTAL_MACHINES,
+    HOME_PANEL_TOTAL_JVMS,
+    HOME_PANEL_SECTION_ISSUES,
+    HOME_PANEL_NO_ISSUES,
+    
+    HOST_INFO_TAB_OVERVIEW,
+    HOST_INFO_TAB_MEMORY,
+    HOST_INFO_TAB_CPU,
+    HOST_INFO_TAB_IO,
+
+    HOST_OVERVIEW_SECTION_BASICS,
+    HOST_OVERVIEW_SECTION_HARDWARE,
+    HOST_OVERVIEW_SECTION_SOFTWARE,
+
+    HOST_INFO_HOSTNAME,
+    HOST_INFO_CPU_COUNT,
+    HOST_INFO_CPU_MODEL,
+    HOST_INFO_OS_NAME,
+    HOST_INFO_OS_KERNEL,
+    
+    HOST_INFO_MEMORY_TOTAL,
+    HOST_INFO_NETWORK,
+
+    NETWORK_INTERFACE_COLUMN,
+    NETWORK_IPV4_COLUMN,
+    NETWORK_IPV6_COLUMN,
+    
+    HOST_CPU_SECTION_OVERVIEW,
+    HOST_CPU_USAGE_CHART_TIME_LABEL,
+    HOST_CPU_USAGE_CHART_VALUE_LABEL,
+    HOST_MEMORY_SECTION_OVERVIEW,
+    HOST_MEMORY_CHART_TITLE,
+    HOST_MEMORY_CHART_TIME_LABEL,
+    HOST_MEMORY_CHART_SIZE_LABEL,
+    HOST_MEMORY_TOTAL,
+    HOST_MEMORY_FREE,
+    HOST_MEMORY_USED,
+    HOST_SWAP_TOTAL,
+    HOST_SWAP_FREE,
+    HOST_BUFFERS,
+
+    VM_INFO_TAB_OVERVIEW,
+    VM_INFO_TAB_MEMORY,
+    VM_INFO_TAB_GC,
+    VM_INFO_SECTION_PROCESS,
+    VM_INFO_SECTION_JAVA,
+    VM_INFO_PROCESS_ID,
+    VM_INFO_START_TIME,
+    VM_INFO_STOP_TIME,
+    VM_INFO_RUNNING,
+    VM_INFO_MAIN_CLASS,
+    VM_INFO_COMMAND_LINE,
+    VM_INFO_JAVA_VERSION,
+    VM_INFO_VM,
+    VM_INFO_VM_ARGUMENTS,
+    VM_INFO_VM_NAME_AND_VERSION,
+    VM_INFO_PROPERTIES,
+    VM_INFO_ENVIRONMENT,
+    VM_INFO_LIBRARIES,
+    
+    VM_CURRENT_MEMORY_CHART_USED,
+    VM_CURRENT_MEMORY_CHART_CAPACITY,
+    VM_CURRENT_MEMORY_CHART_MAX_CAPACITY,
+    VM_CURRENT_MEMORY_CHART_SPACE,
+    VM_CURRENT_MEMORY_CHART_SIZE,
+
+    VM_GC_COLLECTOR_OVER_GENERATION,
+    VM_GC_COLLECTOR_CHART_REAL_TIME_LABEL,
+    VM_GC_COLLECTOR_CHART_GC_TIME_LABEL;
+    
+    static final String RESOURCE_BUNDLE =
+            "com.redhat.thermostat.client.locale.strings";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/src/main/java/com/redhat/thermostat/client/locale/Translate.java	Fri Mar 02 15:15:59 2012 +0100
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2012 Red Hat, Inc.
+ *
+ * This file is part of Thermostat.
+ *
+ * Thermostat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Thermostat is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Thermostat; see the file COPYING.  If not see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Linking this code with other modules is making a combined work
+ * based on this code.  Thus, the terms and conditions of the GNU
+ * General Public License cover the whole combination.
+ *
+ * As a special exception, the copyright holders of this code give
+ * you permission to link this code with independent modules to
+ * produce an executable, regardless of the license terms of these
+ * independent modules, and to copy and distribute the resulting
+ * executable under terms of your choice, provided that you also
+ * meet, for each linked independent module, the terms and conditions
+ * of the license of that module.  An independent module is a module
+ * which is not derived from or based on this code.  If you modify
+ * this code, you may extend this exception to your version of the
+ * library, but you are not obligated to do so.  If you do not wish
+ * to do so, delete this exception statement from your version.
+ */
+
+package com.redhat.thermostat.client.locale;
+
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+
+public class Translate {
+
+    private static ResourceBundle resourceBundle = null;
+
+    static {
+        resourceBundle = ResourceBundle.getBundle(LocaleResources.RESOURCE_BUNDLE);
+    }
+
+    public static String localize(LocaleResources toTranslate) {
+        return resourceBundle.getString(toTranslate.name());
+    }
+
+    public static String localize(LocaleResources toTranslate, String... params) {
+        return MessageFormat.format(localize(toTranslate), (Object[]) params);
+    }
+}
--- a/client/src/main/java/com/redhat/thermostat/client/ui/AboutDialog.java	Fri Mar 02 11:18:29 2012 +0100
+++ b/client/src/main/java/com/redhat/thermostat/client/ui/AboutDialog.java	Fri Mar 02 15:15:59 2012 +0100
@@ -36,7 +36,7 @@
 
 package com.redhat.thermostat.client.ui;
 
-import static com.redhat.thermostat.client.Translate.localize;
+import static com.redhat.thermostat.client.locale.Translate.localize;
 
 import java.awt.BorderLayout;
 import java.awt.event.ActionEvent;
@@ -53,6 +53,7 @@
 import javax.swing.border.Border;
 
 import com.redhat.thermostat.client.ApplicationInfo;
+import com.redhat.thermostat.client.locale.LocaleResources;
 
 public class AboutDialog extends JDialog {
 
@@ -73,7 +74,6 @@
         String description = appInfo.getDescription();
         String version = appInfo.getVersion();
         Icon icon = IconResource.QUESTION.getIcon(); // TODO appInfo.getIcon();
-        String releaseDate = appInfo.getReleaseDate();
         String copyright = appInfo.getCopyright();
         String license = appInfo.getLicenseSummary();
         String email = appInfo.getEmail();
@@ -92,19 +92,19 @@
 
         descriptionContainer.add(Box.createGlue());
         descriptionContainer.add(new JLabel(new HtmlTextBuilder().larger(name).toHtml()));
-        descriptionContainer.add(new JLabel(localize("ABOUT_DIALOG_VERSION_AND_RELEASE", version, releaseDate)));
+        descriptionContainer.add(new JLabel(localize(LocaleResources.APPLICATION_INFO_VERSION, version)));
         descriptionContainer.add(new JLabel(description));
         descriptionContainer.add(new JLabel(copyright));
-        descriptionContainer.add(new JLabel(localize("ABOUT_DIALOG_LICENSE", license)));
-        descriptionContainer.add(new JLabel(localize("ABOUT_DIALOG_EMAIL", email)));
-        JLabel websiteLink = new JLabel(localize("ABOUT_DIALOG_WEBSITE", website));
+        descriptionContainer.add(new JLabel(localize(LocaleResources.APPLICATION_INFO_LICENSE, license)));
+        descriptionContainer.add(new JLabel(localize(LocaleResources.ABOUT_DIALOG_EMAIL, email)));
+        JLabel websiteLink = new JLabel(localize(LocaleResources.ABOUT_DIALOG_WEBSITE, website));
         descriptionContainer.add(websiteLink);
         descriptionContainer.add(Box.createGlue());
 
         add(descriptionContainer, BorderLayout.CENTER);
 
         JPanel buttonContainer = new JPanel();
-        JButton closeButton = new JButton(localize("BUTTON_CLOSE"));
+        JButton closeButton = new JButton(localize(LocaleResources.BUTTON_CLOSE));
         closeButton.addActionListener(new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent e) {
--- a/client/src/main/java/com/redhat/thermostat/client/ui/ConnectionSelectionDialog.java	Fri Mar 02 11:18:29 2012 +0100
+++ b/client/src/main/java/com/redhat/thermostat/client/ui/ConnectionSelectionDialog.java	Fri Mar 02 15:15:59 2012 +0100
@@ -36,7 +36,7 @@
 
 package com.redhat.thermostat.client.ui;
 
-import static com.redhat.thermostat.client.Translate.localize;
+import static com.redhat.thermostat.client.locale.Translate.localize;
 
 import java.awt.BorderLayout;
 import java.awt.FlowLayout;
@@ -59,6 +59,7 @@
 
 import com.redhat.thermostat.client.Connection;
 import com.redhat.thermostat.client.Connection.ConnectionType;
+import com.redhat.thermostat.client.locale.LocaleResources;
 
 public class ConnectionSelectionDialog extends JDialog {
 
@@ -71,7 +72,7 @@
 
     public ConnectionSelectionDialog(JFrame owner, Connection model) {
         super(owner);
-        setTitle(localize("STARTUP_MODE_SELECTION_DIALOG_TITLE"));
+        setTitle(localize(LocaleResources.STARTUP_MODE_SELECTION_DIALOG_TITLE));
         this.model = model;
         setupUi();
         setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
@@ -94,7 +95,7 @@
         buttonsPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
         bottomPanel.add(buttonsPanel);
 
-        JButton cancelButton = new JButton(localize("BUTTON_CANCEL"));
+        JButton cancelButton = new JButton(localize(LocaleResources.BUTTON_CANCEL));
         cancelButton.setMargin(new Insets(0, 15, 0, 15));
         cancelButton.addActionListener(new CancelListener(this));
         buttonsPanel.add(cancelButton);
@@ -115,21 +116,24 @@
         c.gridwidth = GridBagConstraints.REMAINDER;
         c.weighty = 0;
 
-        JLabel info = new JLabel(localize("STARTUP_MODE_SELECTION_INTRO"));
+        JLabel info = new JLabel(localize(LocaleResources.STARTUP_MODE_SELECTION_INTRO));
         container.add(info, c);
 
         c.gridy++;
-        String localButtonHtml = buildHtml(localize("STARTUP_MODE_SELECTION_TYPE_LOCAL"), IconResource.COMPUTER.getUrl());
+        String localButtonHtml = buildHtml(localize(LocaleResources.STARTUP_MODE_SELECTION_TYPE_LOCAL),
+                                           IconResource.COMPUTER.getUrl());
         JButton localButton = new JButton(localButtonHtml);
         container.add(localButton, c);
 
         c.gridy++;
-        String remoteButtonHtml = buildHtml(localize("STARTUP_MODE_SELECTION_TYPE_REMOTE"), IconResource.NETWORK_SERVER.getUrl());
+        String remoteButtonHtml = buildHtml(localize(LocaleResources.STARTUP_MODE_SELECTION_TYPE_REMOTE),
+                                            IconResource.NETWORK_SERVER.getUrl());
         JButton remoteButton = new JButton(remoteButtonHtml);
         container.add(remoteButton, c);
 
         c.gridy++;
-        String clusterButtonHtml = buildHtml(localize("STARTUP_MODE_SELECTION_TYPE_CLUSTER"), IconResource.NETWORK_GROUP.getUrl());
+        String clusterButtonHtml = buildHtml(localize(LocaleResources.STARTUP_MODE_SELECTION_TYPE_CLUSTER),
+                                             IconResource.NETWORK_GROUP.getUrl());
         JButton clusterButton = new JButton(clusterButtonHtml);
         container.add(clusterButton, c);
 
--- a/client/src/main/java/com/redhat/thermostat/client/ui/HostPanel.java	Fri Mar 02 11:18:29 2012 +0100
+++ b/client/src/main/java/com/redhat/thermostat/client/ui/HostPanel.java	Fri Mar 02 15:15:59 2012 +0100
@@ -36,7 +36,7 @@
 
 package com.redhat.thermostat.client.ui;
 
-import static com.redhat.thermostat.client.Translate.localize;
+import static com.redhat.thermostat.client.locale.Translate.localize;
 
 import java.awt.BorderLayout;
 import java.awt.FlowLayout;
@@ -63,6 +63,7 @@
 import com.redhat.thermostat.client.DiscreteTimeData;
 import com.redhat.thermostat.client.HostPanelFacade;
 import com.redhat.thermostat.client.MemoryType;
+import com.redhat.thermostat.client.locale.LocaleResources;
 import com.redhat.thermostat.client.ui.SimpleTable.Key;
 import com.redhat.thermostat.client.ui.SimpleTable.Section;
 import com.redhat.thermostat.client.ui.SimpleTable.TableEntry;
@@ -91,9 +92,9 @@
 
         JTabbedPane tabPane = new JTabbedPane();
 
-        tabPane.insertTab(localize("HOST_INFO_TAB_OVERVIEW"), null, createOverviewPanel(), null, 0);
-        tabPane.insertTab(localize("HOST_INFO_TAB_CPU"), null, createCpuStatisticsPanel(), null, 1);
-        tabPane.insertTab(localize("HOST_INFO_TAB_MEMORY"), null, createMemoryStatisticsPanel(), null, 2);
+        tabPane.insertTab(localize(LocaleResources.HOST_INFO_TAB_OVERVIEW), null, createOverviewPanel(), null, 0);
+        tabPane.insertTab(localize(LocaleResources.HOST_INFO_TAB_CPU), null, createCpuStatisticsPanel(), null, 1);
+        tabPane.insertTab(localize(LocaleResources.HOST_INFO_TAB_MEMORY), null, createMemoryStatisticsPanel(), null, 2);
 
         // TODO additional tabs provided by plugins
         // tabPane.insertTab(title, icon, component, tip, 3)
@@ -107,20 +108,20 @@
         TableEntry entry;
         List<Section> allSections = new ArrayList<Section>();
 
-        Section basics = new Section(localize("HOST_OVERVIEW_SECTION_BASICS"));
+        Section basics = new Section(localize(LocaleResources.HOST_OVERVIEW_SECTION_BASICS));
         allSections.add(basics);
 
-        entry = new TableEntry(localize("HOST_INFO_HOSTNAME"), facade.getHostName());
+        entry = new TableEntry(localize(LocaleResources.HOST_INFO_HOSTNAME), facade.getHostName());
         basics.add(entry);
 
-        Section hardware = new Section(localize("HOST_OVERVIEW_SECTION_HARDWARE"));
+        Section hardware = new Section(localize(LocaleResources.HOST_OVERVIEW_SECTION_HARDWARE));
         allSections.add(hardware);
 
-        entry = new TableEntry(localize("HOST_INFO_CPU_MODEL"), facade.getCpuModel());
+        entry = new TableEntry(localize(LocaleResources.HOST_INFO_CPU_MODEL), facade.getCpuModel());
         hardware.add(entry);
-        entry = new TableEntry(localize("HOST_INFO_CPU_COUNT"), facade.getCpuCount());
+        entry = new TableEntry(localize(LocaleResources.HOST_INFO_CPU_COUNT), facade.getCpuCount());
         hardware.add(entry);
-        entry = new TableEntry(localize("HOST_INFO_MEMORY_TOTAL"), facade.getTotalMemory());
+        entry = new TableEntry(localize(LocaleResources.HOST_INFO_MEMORY_TOTAL), facade.getTotalMemory());
         hardware.add(entry);
 
         JTable networkTable = new JTable(facade.getNetworkTableModel());
@@ -129,15 +130,15 @@
         networkPanel.add(networkTable.getTableHeader(), BorderLayout.PAGE_START);
         networkPanel.add(networkTable, BorderLayout.CENTER);
 
-        Key key = new Key(localize("HOST_INFO_NETWORK"));
+        Key key = new Key(localize(LocaleResources.HOST_INFO_NETWORK));
         hardware.add(new TableEntry(key, new Value(networkPanel)));
 
-        Section software = new Section(localize("HOST_OVERVIEW_SECTION_SOFTWARE"));
+        Section software = new Section(localize(LocaleResources.HOST_OVERVIEW_SECTION_SOFTWARE));
         allSections.add(software);
 
-        entry = new TableEntry(localize("HOST_INFO_OS_NAME"), facade.getOsName());
+        entry = new TableEntry(localize(LocaleResources.HOST_INFO_OS_NAME), facade.getOsName());
         software.add(entry);
-        entry = new TableEntry(localize("HOST_INFO_OS_KERNEL"), facade.getOsKernel());
+        entry = new TableEntry(localize(LocaleResources.HOST_INFO_OS_KERNEL), facade.getOsKernel());
         software.add(entry);
 
         SimpleTable simpleTable = new SimpleTable();
@@ -158,13 +159,13 @@
 
         List<Section> allSections = new ArrayList<Section>();
 
-        Section cpuBasics = new Section(localize("HOST_CPU_SECTION_OVERVIEW"));
+        Section cpuBasics = new Section(localize(LocaleResources.HOST_CPU_SECTION_OVERVIEW));
         allSections.add(cpuBasics);
 
         TableEntry entry;
-        entry = new TableEntry(localize("HOST_INFO_CPU_MODEL"), facade.getCpuModel());
+        entry = new TableEntry(localize(LocaleResources.HOST_INFO_CPU_MODEL), facade.getCpuModel());
         cpuBasics.add(entry);
-        entry = new TableEntry(localize("HOST_INFO_CPU_COUNT"), facade.getCpuCount());
+        entry = new TableEntry(localize(LocaleResources.HOST_INFO_CPU_COUNT), facade.getCpuCount());
         cpuBasics.add(entry);
 
         final SimpleTable simpleTable = new SimpleTable();
@@ -175,8 +176,8 @@
         TimeSeriesCollection dataset = facade.getCpuLoadDataSet();
         JFreeChart chart = ChartFactory.createTimeSeriesChart(
                 null,
-                localize("HOST_CPU_USAGE_CHART_TIME_LABEL"),
-                localize("HOST_CPU_USAGE_CHART_VALUE_LABEL"),
+                localize(LocaleResources.HOST_CPU_USAGE_CHART_TIME_LABEL),
+                localize(LocaleResources.HOST_CPU_USAGE_CHART_VALUE_LABEL),
                 dataset,
                 false, false, false);
 
@@ -203,11 +204,11 @@
 
         List<Section> allSections = new ArrayList<Section>();
 
-        Section memoryBasics = new Section(localize("HOST_MEMORY_SECTION_OVERVIEW"));
+        Section memoryBasics = new Section(localize(LocaleResources.HOST_MEMORY_SECTION_OVERVIEW));
         allSections.add(memoryBasics);
 
         TableEntry entry;
-        entry = new TableEntry(localize("HOST_INFO_MEMORY_TOTAL"), facade.getTotalMemory());
+        entry = new TableEntry(localize(LocaleResources.HOST_INFO_MEMORY_TOTAL), facade.getTotalMemory());
         memoryBasics.add(entry);
 
         SimpleTable simpleTable = new SimpleTable();
@@ -258,9 +259,9 @@
         }
 
         JFreeChart chart = ChartFactory.createTimeSeriesChart(
-                localize("HOST_MEMORY_CHART_TITLE"), // Title
-                localize("HOST_MEMORY_CHART_TIME_LABEL"), // x-axis Label
-                localize("HOST_MEMORY_CHART_SIZE_LABEL"), // y-axis Label
+                localize(LocaleResources.HOST_MEMORY_CHART_TITLE), // Title
+                localize(LocaleResources.HOST_MEMORY_CHART_TIME_LABEL), // x-axis Label
+                localize(LocaleResources.HOST_MEMORY_CHART_SIZE_LABEL), // y-axis Label
                 dataset, // Dataset
                 false, // Show Legend
                 false, // Use tooltips
--- a/client/src/main/java/com/redhat/thermostat/client/ui/MainWindow.java	Fri Mar 02 11:18:29 2012 +0100
+++ b/client/src/main/java/com/redhat/thermostat/client/ui/MainWindow.java	Fri Mar 02 15:15:59 2012 +0100
@@ -36,7 +36,7 @@
 
 package com.redhat.thermostat.client.ui;
 
-import static com.redhat.thermostat.client.Translate.localize;
+import static com.redhat.thermostat.client.locale.Translate.localize;
 
 import java.awt.BorderLayout;
 import java.awt.Color;
@@ -84,6 +84,7 @@
 import com.redhat.thermostat.client.MainWindowFacade;
 import com.redhat.thermostat.client.UiFacadeFactory;
 import com.redhat.thermostat.client.VmRef;
+import com.redhat.thermostat.client.locale.LocaleResources;
 
 public class MainWindow extends JFrame {
 
@@ -99,9 +100,13 @@
 
     private final ShutdownClient shutdownAction;
 
+    private ApplicationInfo appInfo; 
+    
     public MainWindow(UiFacadeFactory facadeFactory) {
         super();
-        setTitle(localize("MAIN_WINDOW_TITLE"));
+        
+        appInfo = new ApplicationInfo();
+        setTitle(appInfo.getName());
 
         this.facadeFactory = facadeFactory;
         this.facade = facadeFactory.getMainWindow();
@@ -133,11 +138,11 @@
     private void setupMenus() {
         JMenuBar mainMenuBar = new JMenuBar();
 
-        JMenu fileMenu = new JMenu(localize("MENU_FILE"));
+        JMenu fileMenu = new JMenu(localize(LocaleResources.MENU_FILE));
         fileMenu.getPopupMenu().setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1));
         mainMenuBar.add(fileMenu);
 
-        JMenuItem fileConnectMenu = new JMenuItem(localize("MENU_FILE_CONNECT"));
+        JMenuItem fileConnectMenu = new JMenuItem(localize(LocaleResources.MENU_FILE_CONNECT));
         fileConnectMenu.addActionListener(new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent e) {
@@ -148,28 +153,28 @@
 
         fileMenu.add(new Separator());
 
-        JMenuItem fileImportMenu = new JMenuItem(localize("MENU_FILE_IMPORT"));
+        JMenuItem fileImportMenu = new JMenuItem(localize(LocaleResources.MENU_FILE_IMPORT));
         fileMenu.add(fileImportMenu);
 
-        JMenuItem fileExportMenu = new JMenuItem(localize("MENU_FILE_EXPORT"));
+        JMenuItem fileExportMenu = new JMenuItem(localize(LocaleResources.MENU_FILE_EXPORT));
         fileMenu.add(fileExportMenu);
 
         fileMenu.add(new Separator());
 
-        JMenuItem fileExitMenu = new JMenuItem(localize("MENU_FILE_EXIT"));
+        JMenuItem fileExitMenu = new JMenuItem(localize(LocaleResources.MENU_FILE_EXIT));
         fileExitMenu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, InputEvent.CTRL_DOWN_MASK));
         fileExitMenu.addActionListener(shutdownAction);
         fileMenu.add(fileExitMenu);
 
-        JMenu helpMenu = new JMenu(localize("MENU_HELP"));
+        JMenu helpMenu = new JMenu(localize(LocaleResources.MENU_HELP));
         helpMenu.getPopupMenu().setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1));
         mainMenuBar.add(helpMenu);
 
-        JMenuItem helpAboutMenu = new JMenuItem(localize("MENU_HELP_ABOUT"));
+        JMenuItem helpAboutMenu = new JMenuItem(localize(LocaleResources.MENU_HELP_ABOUT));
         helpAboutMenu.addActionListener(new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent e) {
-                AboutDialog aboutDialog = new AboutDialog(new ApplicationInfo());
+                AboutDialog aboutDialog = new AboutDialog(appInfo);
                 aboutDialog.setModal(true);
                 aboutDialog.pack();
                 aboutDialog.setVisible(true);
@@ -344,18 +349,18 @@
                 String hostNameHtml = new HtmlTextBuilder().bold(hostRef.getHostName()).toPartialHtml();
                 String agentIdHtml = new HtmlTextBuilder().bold(hostRef.getAgentId()).toPartialHtml();
                 HtmlTextBuilder builder = new HtmlTextBuilder()
-                    .appendRaw(localize("TREE_HOST_TOOLTIP_HOST_NAME", hostNameHtml))
+                    .appendRaw(localize(LocaleResources.TREE_HOST_TOOLTIP_HOST_NAME, hostNameHtml))
                     .newLine()
-                    .appendRaw(localize("TREE_HOST_TOOLTIP_AGENT_ID", agentIdHtml));
+                    .appendRaw(localize(LocaleResources.TREE_HOST_TOOLTIP_AGENT_ID, agentIdHtml));
                 return builder.toHtml();
             } else if (value instanceof VmRef) {
                 VmRef vmRef = (VmRef) value;
                 String vmNameHtml= new HtmlTextBuilder().bold(vmRef.getName()).toPartialHtml();
                 String vmIdHtml = new HtmlTextBuilder().bold(vmRef.getId()).toPartialHtml();
                 HtmlTextBuilder builder = new HtmlTextBuilder()
-                    .appendRaw(localize("TREE_HOST_TOOLTIP_VM_NAME", vmNameHtml))
+                    .appendRaw(localize(LocaleResources.TREE_HOST_TOOLTIP_VM_NAME, vmNameHtml))
                     .newLine()
-                    .appendRaw(localize("TREE_HOST_TOOLTIP_VM_ID", vmIdHtml));
+                    .appendRaw(localize(LocaleResources.TREE_HOST_TOOLTIP_VM_ID, vmIdHtml));
                 return builder.toHtml();
             } else {
                 return null;
--- a/client/src/main/java/com/redhat/thermostat/client/ui/SummaryPanel.java	Fri Mar 02 11:18:29 2012 +0100
+++ b/client/src/main/java/com/redhat/thermostat/client/ui/SummaryPanel.java	Fri Mar 02 15:15:59 2012 +0100
@@ -36,7 +36,7 @@
 
 package com.redhat.thermostat.client.ui;
 
-import static com.redhat.thermostat.client.Translate.localize;
+import static com.redhat.thermostat.client.locale.Translate.localize;
 
 import java.awt.BorderLayout;
 import java.util.ArrayList;
@@ -49,6 +49,7 @@
 import javax.swing.ListModel;
 
 import com.redhat.thermostat.client.SummaryPanelFacade;
+import com.redhat.thermostat.client.locale.LocaleResources;
 import com.redhat.thermostat.client.ui.SimpleTable.Section;
 import com.redhat.thermostat.client.ui.SimpleTable.TableEntry;
 
@@ -66,12 +67,12 @@
         List<Section> sections = new ArrayList<Section>();
         TableEntry entry;
 
-        Section summarySection = new Section(localize("HOME_PANEL_SECTION_SUMMARY"));
+        Section summarySection = new Section(localize(LocaleResources.HOME_PANEL_SECTION_SUMMARY));
         sections.add(summarySection);
 
-        entry = new TableEntry(localize("HOME_PANEL_TOTAL_MACHINES"), facade.getTotalConnectedAgents());
+        entry = new TableEntry(localize(LocaleResources.HOME_PANEL_TOTAL_MACHINES), facade.getTotalConnectedAgents());
         summarySection.add(entry);
-        entry = new TableEntry(localize("HOME_PANEL_TOTAL_JVMS"), facade.getTotalConnectedVms());
+        entry = new TableEntry(localize(LocaleResources.HOME_PANEL_TOTAL_JVMS), facade.getTotalConnectedVms());
         summarySection.add(entry);
 
         SimpleTable simpleTable = new SimpleTable();
@@ -89,7 +90,7 @@
     public JPanel createIssuesPanel() {
         JPanel result = new JPanel(new BorderLayout());
 
-        result.add(Components.header(localize("HOME_PANEL_SECTION_ISSUES")), BorderLayout.PAGE_START);
+        result.add(Components.header(localize(LocaleResources.HOME_PANEL_SECTION_ISSUES)), BorderLayout.PAGE_START);
 
         ListModel model = new IssuesListModel(new ArrayList<Object>());
 
@@ -105,7 +106,7 @@
 
         private List<? extends Object> delegate;
 
-        private String emptyElement = new String(localize("HOME_PANEL_NO_ISSUES"));
+        private String emptyElement = new String(localize(LocaleResources.HOME_PANEL_NO_ISSUES));
 
         public IssuesListModel(List<? extends Object> actualList) {
             this.delegate = actualList;
--- a/client/src/main/java/com/redhat/thermostat/client/ui/VmPanel.java	Fri Mar 02 11:18:29 2012 +0100
+++ b/client/src/main/java/com/redhat/thermostat/client/ui/VmPanel.java	Fri Mar 02 15:15:59 2012 +0100
@@ -36,7 +36,7 @@
 
 package com.redhat.thermostat.client.ui;
 
-import static com.redhat.thermostat.client.Translate.localize;
+import static com.redhat.thermostat.client.locale.Translate.localize;
 
 import java.awt.BorderLayout;
 import java.awt.Component;
@@ -56,6 +56,7 @@
 import org.jfree.data.time.TimeSeriesCollection;
 
 import com.redhat.thermostat.client.VmPanelFacade;
+import com.redhat.thermostat.client.locale.LocaleResources;
 import com.redhat.thermostat.client.ui.SimpleTable.Section;
 import com.redhat.thermostat.client.ui.SimpleTable.TableEntry;
 
@@ -77,9 +78,10 @@
 
         JTabbedPane tabPane = new JTabbedPane();
 
-        tabPane.insertTab(localize("VM_INFO_TAB_OVERVIEW"), null, createOverviewPanel(), null, 0);
-        tabPane.insertTab(localize("VM_INFO_TAB_MEMORY"), null, createMemoryPanel(), null, 1);
-        tabPane.insertTab(localize("VM_INFO_TAB_GC"), null, createGcPanel(), localize("GARBAGE_COLLECTION"), 2);
+        tabPane.insertTab(localize(LocaleResources.VM_INFO_TAB_OVERVIEW), null, createOverviewPanel(), null, 0);
+        tabPane.insertTab(localize(LocaleResources.VM_INFO_TAB_MEMORY), null, createMemoryPanel(), null, 1);
+        tabPane.insertTab(localize(LocaleResources.VM_INFO_TAB_GC), null, createGcPanel(),
+                          localize(LocaleResources.GARBAGE_COLLECTION), 2);
 
         // TODO additional tabs provided by plugins
         // tabPane.insertTab(title, icon, component, tip, 3)
@@ -95,28 +97,28 @@
         TableEntry entry;
         List<Section> allSections = new ArrayList<Section>();
 
-        Section processSection = new Section(localize("VM_INFO_SECTION_PROCESS"));
+        Section processSection = new Section(localize(LocaleResources.VM_INFO_SECTION_PROCESS));
         allSections.add(processSection);
 
-        entry = new TableEntry(localize("VM_INFO_PROCESS_ID"), facade.getVmPid());
+        entry = new TableEntry(localize(LocaleResources.VM_INFO_PROCESS_ID), facade.getVmPid());
         processSection.add(entry);
-        entry = new TableEntry(localize("VM_INFO_START_TIME"), facade.getStartTimeStamp());
+        entry = new TableEntry(localize(LocaleResources.VM_INFO_START_TIME), facade.getStartTimeStamp());
         processSection.add(entry);
-        entry = new TableEntry(localize("VM_INFO_STOP_TIME"), facade.getStopTimeStamp());
+        entry = new TableEntry(localize(LocaleResources.VM_INFO_STOP_TIME), facade.getStopTimeStamp());
         processSection.add(entry);
 
-        Section javaSection = new Section(localize("VM_INFO_SECTION_JAVA"));
+        Section javaSection = new Section(localize(LocaleResources.VM_INFO_SECTION_JAVA));
         allSections.add(javaSection);
 
-        entry = new TableEntry(localize("VM_INFO_MAIN_CLASS"), facade.getMainClass());
+        entry = new TableEntry(localize(LocaleResources.VM_INFO_MAIN_CLASS), facade.getMainClass());
         javaSection.add(entry);
-        entry = new TableEntry(localize("VM_INFO_COMMAND_LINE"), facade.getJavaCommandLine());
+        entry = new TableEntry(localize(LocaleResources.VM_INFO_COMMAND_LINE), facade.getJavaCommandLine());
         javaSection.add(entry);
-        entry = new TableEntry(localize("VM_INFO_JAVA_VERSION"), facade.getJavaVersion());
+        entry = new TableEntry(localize(LocaleResources.VM_INFO_JAVA_VERSION), facade.getJavaVersion());
         javaSection.add(entry);
-        entry = new TableEntry(localize("VM_INFO_VM"), facade.getVmNameAndVersion());
+        entry = new TableEntry(localize(LocaleResources.VM_INFO_VM), facade.getVmNameAndVersion());
         javaSection.add(entry);
-        entry = new TableEntry(localize("VM_INFO_VM_ARGUMENTS"), facade.getVmArguments());
+        entry = new TableEntry(localize(LocaleResources.VM_INFO_VM_ARGUMENTS), facade.getVmArguments());
         javaSection.add(entry);
 
         SimpleTable simpleTable = new SimpleTable();
@@ -147,8 +149,8 @@
 
         JFreeChart chart = ChartFactory.createStackedBarChart(
                 null,
-                localize("VM_CURRENT_MEMORY_CHART_SPACE"),
-                localize("VM_CURRENT_MEMORY_CHART_SIZE"),
+                localize(LocaleResources.VM_CURRENT_MEMORY_CHART_SPACE),
+                localize(LocaleResources.VM_CURRENT_MEMORY_CHART_SIZE),
                 data,
                 PlotOrientation.HORIZONTAL, true, false, false);
 
@@ -198,13 +200,14 @@
         c.gridx = 0;
         c.fill = GridBagConstraints.BOTH;
 
-        detailsPanel.add(Components.header(localize("VM_GC_COLLECTOR_OVER_GENERATION", collectorName, facade.getCollectorGeneration(collectorName))), BorderLayout.NORTH);
+        detailsPanel.add(Components.header(localize(LocaleResources.VM_GC_COLLECTOR_OVER_GENERATION,
+                         collectorName, facade.getCollectorGeneration(collectorName))), BorderLayout.NORTH);
 
         TimeSeriesCollection dataset = facade.getCollectorDataSet(collectorName);
         JFreeChart chart = ChartFactory.createTimeSeriesChart(
                 null,
-                localize("VM_GC_COLLECTOR_CHART_REAL_TIME_LABEL"),
-                localize("VM_GC_COLLECTOR_CHART_GC_TIME_LABEL"),
+                localize(LocaleResources.VM_GC_COLLECTOR_CHART_REAL_TIME_LABEL),
+                localize(LocaleResources.VM_GC_COLLECTOR_CHART_GC_TIME_LABEL),
                 dataset,
                 false, false, false);
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/src/main/resources/com/redhat/thermostat/client/locale/strings.properties	Fri Mar 02 15:15:59 2012 +0100
@@ -0,0 +1,128 @@
+MISSING_INFO = Missing Information
+
+CONNECTION_FAILED_TO_CONNECT_TITLE = Failed to connect to data collector
+CONNECTION_FAILED_TO_CONNECT_DESCRIPTION = Thermostat failed to connect to the data collector.
+
+MAIN_WINDOW_TREE_ROOT_NAME = Thermostat
+
+BUTTON_CLOSE = Close
+BUTTON_NEXT = Next
+BUTTON_CANCEL = Cancel
+BUTTON_OK = OK
+
+MENU_FILE = File
+MENU_FILE_CONNECT = Connect
+MENU_FILE_IMPORT = Import
+MENU_FILE_EXPORT = Export
+MENU_FILE_EXIT = Exit
+MENU_HELP = Help
+MENU_HELP_ABOUT = About
+
+GARBAGE_COLLECTION = Garbage Collection
+YOUNG_GEN = Young
+EDEN_GEN = Eden
+S0_GEN = Survivor 0
+S1_GEN = Survivor 1
+OLD_GEN = Tenured
+PERM_GEN = Permanent
+UNKNOWN_GEN = Unknown
+SOME_GENERATION = {0} Generation
+
+SECONDS = Seconds
+MINUTES = Minutes
+HOURS = Hours
+DAYS = Days
+
+STARTUP_MODE_SELECTION_DIALOG_TITLE = Welcome to Thermostat!
+STARTUP_MODE_SELECTION_INTRO = Which JVMs to do you want to monitor?
+STARTUP_MODE_SELECTION_TYPE_LOCAL = Local
+STARTUP_MODE_SELECTION_TYPE_REMOTE = Remote
+STARTUP_MODE_SELECTION_TYPE_CLUSTER = Cluster
+STARTUP_MODE_SELECTION_URL_LABEL = Host Location
+
+TREE_HOST_TOOLTIP_HOST_NAME = Host Name: {0}
+TREE_HOST_TOOLTIP_AGENT_ID = Agent Id: {0}
+TREE_HOST_TOOLTIP_VM_NAME = Vm Name: {0}
+TREE_HOST_TOOLTIP_VM_ID = Vm Id: {0}
+
+ABOUT_DIALOG_LICENSE = Licensed under the {0} license.
+ABOUT_DIALOG_EMAIL = Email: {0}
+ABOUT_DIALOG_WEBSITE = Website: {0}
+
+APPLICATION_INFO_VERSION = Version {0}
+APPLICATION_INFO_DESCRIPTION = A monitoring and serviceability tool for OpenJDK
+APPLICATION_INFO_LICENSE = Licensed under GPLv2+ with Classpath exception
+
+HOME_PANEL_SECTION_SUMMARY = Summary
+HOME_PANEL_TOTAL_MACHINES = Total Machines
+HOME_PANEL_TOTAL_JVMS = Total Java Virtual Machines
+HOME_PANEL_SECTION_ISSUES = Issues
+HOME_PANEL_NO_ISSUES = No Issues
+
+HOST_INFO_TAB_OVERVIEW = Overview
+HOST_INFO_TAB_MEMORY = Memory
+HOST_INFO_TAB_CPU = Processor
+HOST_INFO_TAB_IO = IO
+
+HOST_OVERVIEW_SECTION_BASICS = Basics
+HOST_OVERVIEW_SECTION_HARDWARE = Hardware
+HOST_OVERVIEW_SECTION_SOFTWARE = Software
+
+HOST_INFO_HOSTNAME = Host
+HOST_INFO_CPU_COUNT = Processor Count
+HOST_INFO_CPU_MODEL = Processor Model
+HOST_INFO_OS_NAME = OS Name
+HOST_INFO_OS_KERNEL = OS Kernel
+HOST_INFO_MEMORY_TOTAL = Total Memory
+HOST_INFO_NETWORK = Network
+
+NETWORK_INTERFACE_COLUMN = Interface
+NETWORK_IPV4_COLUMN = IPv4 Address
+NETWORK_IPV6_COLUMN = IPv6 Address
+
+HOST_CPU_SECTION_OVERVIEW = Processor
+HOST_CPU_USAGE_CHART_TIME_LABEL = Time
+HOST_CPU_USAGE_CHART_VALUE_LABEL = Avg Load
+
+HOST_MEMORY_SECTION_OVERVIEW = Memory
+HOST_MEMORY_CHART_TITLE = Memory
+HOST_MEMORY_CHART_TIME_LABEL = Time
+HOST_MEMORY_CHART_SIZE_LABEL = Size (bytes)
+
+HOST_MEMORY_TOTAL = Total Memory
+HOST_MEMORY_FREE = Free Memory
+HOST_MEMORY_USED = Used Memory
+HOST_SWAP_TOTAL = Total Swap
+HOST_SWAP_FREE = Free Swap
+HOST_BUFFERS = Buffers
+
+VM_INFO_TAB_OVERVIEW = Overview
+VM_INFO_TAB_MEMORY = Memory
+VM_INFO_TAB_GC = GC
+
+VM_INFO_SECTION_PROCESS = Process Information
+VM_INFO_SECTION_JAVA = Java Information
+
+VM_INFO_PROCESS_ID = Process Id
+VM_INFO_START_TIME = Start time
+VM_INFO_STOP_TIME = Stop time
+VM_INFO_RUNNING = Running
+VM_INFO_MAIN_CLASS = Main Class
+VM_INFO_COMMAND_LINE = Command Line
+VM_INFO_JAVA_VERSION = Java Version
+VM_INFO_VM = Virtual Machine
+VM_INFO_VM_ARGUMENTS = VM arguments
+VM_INFO_VM_NAME_AND_VERSION = {0} version {1}
+VM_INFO_PROPERTIES = Properties
+VM_INFO_ENVIRONMENT = Environment
+VM_INFO_LIBRARIES = Native Libraries
+
+VM_CURRENT_MEMORY_CHART_USED = Used
+VM_CURRENT_MEMORY_CHART_CAPACITY = Capacity
+VM_CURRENT_MEMORY_CHART_MAX_CAPACITY = Max Capacity
+VM_CURRENT_MEMORY_CHART_SPACE = Memory Region
+VM_CURRENT_MEMORY_CHART_SIZE = Size
+
+VM_GC_COLLECTOR_OVER_GENERATION = Collector {0} running on {1}
+VM_GC_COLLECTOR_CHART_REAL_TIME_LABEL = Time
+VM_GC_COLLECTOR_CHART_GC_TIME_LABEL = Total Time Spent on GC (s)
--- a/client/src/main/resources/com/redhat/thermostat/client/strings.properties	Fri Mar 02 11:18:29 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-MISSING_INFO = Missing Information
-
-CONNECTION_FAILED_TO_CONNECT_TITLE = Failed to connect to data collector
-CONNECTION_FAILED_TO_CONNECT_DESCRIPTION = Thermostat failed to connect to the data collector.
-
-MAIN_WINDOW_TITLE = Thermostat
-
-MAIN_WINDOW_TREE_ROOT_NAME = Thermostat
-
-BUTTON_CLOSE = Close
-BUTTON_NEXT = Next
-BUTTON_CANCEL = Cancel
-BUTTON_OK = OK
-
-MENU_FILE = File
-MENU_FILE_CONNECT = Connect
-MENU_FILE_IMPORT = Import
-MENU_FILE_EXPORT = Export
-MENU_FILE_EXIT = Exit
-MENU_HELP = Help
-MENU_HELP_ABOUT = About
-
-GARBAGE_COLLECTION = Garbage Collection
-YOUNG_GEN = Young
-EDEN_GEN = Eden
-S0_GEN = Survivor 0
-S1_GEN = Survivor 1
-OLD_GEN = Tenured
-PERM_GEN = Permanent
-UNKNOWN_GEN = Unknown
-SOME_GENERATION = {0} Generation
-
-SECONDS = Seconds
-MINUTES = Minutes
-HOURS = Hours
-DAYS = Days
-
-STARTUP_MODE_SELECTION_DIALOG_TITLE = Welcome to Thermostat!
-STARTUP_MODE_SELECTION_INTRO = Which JVMs to do you want to monitor?
-STARTUP_MODE_SELECTION_TYPE_LOCAL = Local
-STARTUP_MODE_SELECTION_TYPE_REMOTE = Remote
-STARTUP_MODE_SELECTION_TYPE_CLUSTER = Cluster
-STARTUP_MODE_SELECTION_URL_LABEL = Host Location
-
-TREE_HOST_TOOLTIP_HOST_NAME = Host Name: {0}
-TREE_HOST_TOOLTIP_AGENT_ID = Agent Id: {0}
-TREE_HOST_TOOLTIP_VM_NAME = Vm Name: {0}
-TREE_HOST_TOOLTIP_VM_ID = Vm Id: {0}
-
-ABOUT_DIALOG_VERSION_AND_RELEASE = Version {0} (released {1})
-ABOUT_DIALOG_LICENSE = Licensed under the {0} license.
-ABOUT_DIALOG_EMAIL = Email: {0}
-ABOUT_DIALOG_WEBSITE = Website: {0}
-
-APPLICATION_INFO_VERSION = Version {0}
-APPLICATION_INFO_DESCRIPTION = A monitoring and serviceability tool for OpenJDK
-APPLICATION_INFO_LICENSE = Licensed under GPLv2+ with Classpath exception
-
-HOME_PANEL_SECTION_SUMMARY = Summary
-HOME_PANEL_TOTAL_MACHINES = Total Machines
-HOME_PANEL_TOTAL_JVMS = Total Java Virtual Machines
-HOME_PANEL_SECTION_ISSUES = Issues
-HOME_PANEL_NO_ISSUES = No Issues
-
-HOST_INFO_TAB_OVERVIEW = Overview
-HOST_INFO_TAB_MEMORY = Memory
-HOST_INFO_TAB_CPU = Processor
-HOST_INFO_TAB_IO = IO
-
-HOST_OVERVIEW_SECTION_BASICS = Basics
-HOST_OVERVIEW_SECTION_HARDWARE = Hardware
-HOST_OVERVIEW_SECTION_SOFTWARE = Software
-
-HOST_INFO_HOSTNAME = Host
-HOST_INFO_CPU_COUNT = Processor Count
-HOST_INFO_CPU_MODEL = Processor Model
-HOST_INFO_OS_NAME = OS Name
-HOST_INFO_OS_KERNEL = OS Kernel
-HOST_INFO_MEMORY_TOTAL = Total Memory
-HOST_INFO_NETWORK = Network
-
-NETWORK_INTERFACE_COLUMN = Interface
-NETWORK_IPV4_COLUMN = IPv4 Address
-NETWORK_IPV6_COLUMN = IPv6 Address
-
-HOST_CPU_SECTION_OVERVIEW = Processor
-HOST_CPU_USAGE_CHART_TIME_LABEL = Time
-HOST_CPU_USAGE_CHART_VALUE_LABEL = Avg Load
-
-HOST_MEMORY_SECTION_OVERVIEW = Memory
-HOST_MEMORY_CHART_TITLE = Memory
-HOST_MEMORY_CHART_TIME_LABEL = Time
-HOST_MEMORY_CHART_SIZE_LABEL = Size (bytes)
-
-HOST_MEMORY_TOTAL = Total Memory
-HOST_MEMORY_FREE = Free Memory
-HOST_MEMORY_USED = Used Memory
-HOST_SWAP_TOTAL = Total Swap
-HOST_SWAP_FREE = Free Swap
-HOST_BUFFERS = Buffers
-
-VM_INFO_TAB_OVERVIEW = Overview
-VM_INFO_TAB_MEMORY = Memory
-VM_INFO_TAB_GC = GC
-
-VM_INFO_SECTION_PROCESS = Process Information
-VM_INFO_SECTION_JAVA = Java Information
-
-VM_INFO_PROCESS_ID = Process Id
-VM_INFO_START_TIME = Start time
-VM_INFO_STOP_TIME = Stop time
-VM_INFO_RUNNING = Running
-VM_INFO_MAIN_CLASS = Main Class
-VM_INFO_COMMAND_LINE = Command Line
-VM_INFO_JAVA_VERSION = Java Version
-VM_INFO_VM = Virtual Machine
-VM_INFO_VM_ARGUMENTS = VM arguments
-VM_INFO_VM_NAME_AND_VERSION = {0} version {1}
-VM_INFO_PROPERTIES = Properties
-VM_INFO_ENVIRONMENT = Environment
-VM_INFO_LIBRARIES = Native Libraries
-
-VM_CURRENT_MEMORY_CHART_USED = Used
-VM_CURRENT_MEMORY_CHART_CAPACITY = Capacity
-VM_CURRENT_MEMORY_CHART_MAX_CAPACITY = Max Capacity
-VM_CURRENT_MEMORY_CHART_SPACE = Memory Region
-VM_CURRENT_MEMORY_CHART_SIZE = Size
-
-VM_GC_COLLECTOR_OVER_GENERATION = Collector {0} running on {1}
-VM_GC_COLLECTOR_CHART_REAL_TIME_LABEL = Time
-VM_GC_COLLECTOR_CHART_GC_TIME_LABEL = Total Time Spent on GC (s)
--- a/client/src/test/java/com/redhat/thermostat/client/locale/TranslateTest.java	Fri Mar 02 11:18:29 2012 +0100
+++ b/client/src/test/java/com/redhat/thermostat/client/locale/TranslateTest.java	Fri Mar 02 15:15:59 2012 +0100
@@ -36,8 +36,9 @@
 
 package com.redhat.thermostat.client.locale;
 
+import java.io.IOException;
 import java.util.Locale;
-import java.util.MissingResourceException;
+import java.util.Properties;
 
 import junit.framework.Assert;
 
@@ -45,7 +46,7 @@
 import org.junit.Before;
 import org.junit.Test;
 
-import static com.redhat.thermostat.client.Translate.localize;
+import static com.redhat.thermostat.client.locale.Translate.localize;
 
 public class TranslateTest {
 
@@ -63,32 +64,33 @@
     }
     
     @Test
-    public void testMissingInfo() {
-        String testString = localize("MISSING_INFO");
+    public void testLocalizeWithoutArguments() {
+        String testString = localize(LocaleResources.MISSING_INFO);
         Assert.assertEquals("Missing Information", testString);
     }
     
     @Test
-    public void testLocalization() {
-        String testString = localize("APPLICATION_INFO_VERSION", "test");
+    public void testLocalizeWithArguments() {
+        String testString = localize(LocaleResources.APPLICATION_INFO_VERSION, "test");
         Assert.assertEquals("Version test", testString);
         
-        testString = localize("APPLICATION_INFO_DESCRIPTION");
+        testString = localize(LocaleResources.APPLICATION_INFO_DESCRIPTION);
         Assert.assertEquals("A monitoring and serviceability tool for OpenJDK",
                             testString);
     }
     
-    @Test(expected = MissingResourceException.class)
-    public void testLocalizationError1() {
+    @Test
+    public void testLocalizedStringsArePresent() throws IOException {
+        
+        String stringsResource = "/" + LocaleResources.RESOURCE_BUNDLE.replace(".", "/") + ".properties";
         
-        localize("INVALID_BLABLABLA_FLUFF");
-        Assert.fail("java.util.MissingResourceException expected");
-    }
-    
-    @Test(expected = MissingResourceException.class)
-    public void testLocalizationError2() {
+        Properties props = new Properties();
+        props.load(getClass().getResourceAsStream(stringsResource));
         
-        localize("INVALID_BLABLABLA_FLUFF", "test");
-        Assert.fail("java.util.MissingResourceException expected");
+        Assert.assertEquals(LocaleResources.values().length, props.values().size());
+        for (LocaleResources resource : LocaleResources.values()) {
+            Assert.assertTrue("missing property from resource bound file: " + resource,
+                              props.containsKey(resource.name()));
+        }
     }
 }
--- a/common/src/main/resources/com/redhat/thermostat/app-info.properties	Fri Mar 02 11:18:29 2012 +0100
+++ b/common/src/main/resources/com/redhat/thermostat/app-info.properties	Fri Mar 02 15:15:59 2012 +0100
@@ -1,9 +1,7 @@
-APP_NAME = ${project.name}
+APP_NAME = Thermostat
 APP_VERSION = ${project.version}
 APP_RELEASE_DATE = ${thermostat.releasedate}
 APP_EMAIL = ${thermostat.email}
 APP_WEBSITE = ${project.url}
-APP_DESCRIPTION = A monitoring and servicability tool for OpenJDK
 APP_COPYRIGHT = Copyright 2012 Red Hat, Inc.
-APP_LICENSE_SUMMARY = GPLv2+ with Classpath exceptions