changeset 2161:3dd1f0e2aeae

Fix hardcoded english strings in HeaderPanel Reviewed-by: jeboaa Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2016-February/017690.html
author Omair Majid <omajid@redhat.com>
date Mon, 08 Feb 2016 11:49:02 -0500
parents dde3c89a2f96
children 7f37bccc0fbc
files client/swing/src/main/java/com/redhat/thermostat/client/swing/components/HeaderPanel.java client/swing/src/main/java/com/redhat/thermostat/client/swing/internal/LocaleResources.java client/swing/src/main/resources/com/redhat/thermostat/client/swing/internal/strings.properties
diffstat 3 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/client/swing/src/main/java/com/redhat/thermostat/client/swing/components/HeaderPanel.java	Mon Feb 08 11:48:26 2016 -0500
+++ b/client/swing/src/main/java/com/redhat/thermostat/client/swing/components/HeaderPanel.java	Mon Feb 08 11:49:02 2016 -0500
@@ -58,7 +58,9 @@
 import javax.swing.JPanel;
 import javax.swing.SwingUtilities;
 
+import com.redhat.thermostat.client.swing.internal.LocaleResources;
 import com.redhat.thermostat.shared.locale.LocalizedString;
+import com.redhat.thermostat.shared.locale.Translate;
 
 /**
  * A component that host a panel with a nicely rendered header.
@@ -68,6 +70,8 @@
         
     public static final String SHOW_TEXT = "SHOW_TEXT";
     
+    private static final Translate<LocaleResources> translate = LocaleResources.createLocalizer();
+
     private boolean showText;
     
     private LocalizedString header;
@@ -187,10 +191,9 @@
     class PreferencesPopup extends ThermostatPopupMenu {
         JMenuItem preferencesMenu;
         public PreferencesPopup() {
-            // TODO: localize
-            String text = "Show button text";
+            String text = translate.localize(LocaleResources.SHOW_BUTTON_TEXT).getContents();
             if (showText) {
-                text = "Hide button text";
+                text = translate.localize(LocaleResources.HIDE_BUTTON_TEXT).getContents();
             }
             preferencesMenu = new JMenuItem(text);
             preferencesMenu.addActionListener(new ActionListener() {
--- a/client/swing/src/main/java/com/redhat/thermostat/client/swing/internal/LocaleResources.java	Mon Feb 08 11:48:26 2016 -0500
+++ b/client/swing/src/main/java/com/redhat/thermostat/client/swing/internal/LocaleResources.java	Mon Feb 08 11:49:02 2016 -0500
@@ -54,6 +54,10 @@
     CUT,
     COPY,
     PASTE,
+
+    SHOW_BUTTON_TEXT,
+    HIDE_BUTTON_TEXT,
+
     ;
 
     static final String RESOURCE_BUNDLE =
--- a/client/swing/src/main/resources/com/redhat/thermostat/client/swing/internal/strings.properties	Mon Feb 08 11:48:26 2016 -0500
+++ b/client/swing/src/main/resources/com/redhat/thermostat/client/swing/internal/strings.properties	Mon Feb 08 11:49:02 2016 -0500
@@ -11,4 +11,7 @@
 
 CUT = Cut
 COPY = Copy
-PASTE = Paste
\ No newline at end of file
+PASTE = Paste
+
+SHOW_BUTTON_TEXT = Show button text
+HIDE_BUTTON_TEXT = Hide button text