changeset 1582:874a0ce0c0d5

Internationalize strings in ProfileVmCommand Reviewed-by: jkang Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2014-November/011845.html
author Omair Majid <omajid@redhat.com>
date Fri, 28 Nov 2014 17:09:31 -0500
parents 610cf7f75c49
children 17e344385eff
files vm-profiler/client-cli/src/main/java/com/redhat/thermostat/vm/profiler/client/cli/internal/LocaleResources.java vm-profiler/client-cli/src/main/java/com/redhat/thermostat/vm/profiler/client/cli/internal/ProfileVmCommand.java vm-profiler/client-cli/src/main/resources/com/redhat/thermostat/vm/profiler/client/cli/internal/strings.properties
diffstat 3 files changed, 24 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/vm-profiler/client-cli/src/main/java/com/redhat/thermostat/vm/profiler/client/cli/internal/LocaleResources.java	Fri Nov 28 16:44:05 2014 -0500
+++ b/vm-profiler/client-cli/src/main/java/com/redhat/thermostat/vm/profiler/client/cli/internal/LocaleResources.java	Fri Nov 28 17:09:31 2014 -0500
@@ -50,6 +50,14 @@
     INTERRUPTED_WAITING_FOR_RESPONSE,
     AGENT_NOT_FOUND,
 
+    STARTED_PROFILING,
+    ALREADY_PROFILING,
+    UNABLE_TO_START_PROFILING,
+    STOPPED_PROFILING,
+    NOT_PROFILING,
+    UNABLE_TO_STOP_PROFILING,
+    UNABLE_TO_USE_PROFILING,
+
     STATUS_CURRENTLY_PROFILING,
     STATUS_CURRENTLY_NOT_PROFILING,
 
--- a/vm-profiler/client-cli/src/main/java/com/redhat/thermostat/vm/profiler/client/cli/internal/ProfileVmCommand.java	Fri Nov 28 16:44:05 2014 -0500
+++ b/vm-profiler/client-cli/src/main/java/com/redhat/thermostat/vm/profiler/client/cli/internal/ProfileVmCommand.java	Fri Nov 28 17:09:31 2014 -0500
@@ -125,13 +125,13 @@
                 console, queue, target, ProfileRequest.START_PROFILING, vmId);
 
         if (response.getType() == ResponseType.OK) {
-            console.getOutput().println("Started profiling " + vmId);
+            console.getOutput().println(translator.localize(LocaleResources.STARTED_PROFILING, vmId).getContents());
         } else if (response.getType() == ResponseType.NOOP) {
-            console.getOutput().println("Profiling already active for " + vmId);
+            console.getOutput().println(translator.localize(LocaleResources.ALREADY_PROFILING, vmId).getContents());
         } else if (response.getType() == ResponseType.NOK) {
-            console.getError().println("Unable to start profiling " + vmId);
+            console.getError().println(translator.localize(LocaleResources.UNABLE_TO_START_PROFILING, vmId).getContents());
         } else {
-            console.getError().println("Unable to use profiling");
+            console.getError().println(translator.localize(LocaleResources.UNABLE_TO_USE_PROFILING).getContents());
         }
     }
 
@@ -140,13 +140,13 @@
                 console, queue, target, ProfileRequest.STOP_PROFILING, vmId);
 
         if (response.getType() == ResponseType.OK) {
-            console.getOutput().println("Stopped profiling " + vmId);
+            console.getOutput().println(translator.localize(LocaleResources.STOPPED_PROFILING, vmId).getContents());
         } else if (response.getType() == ResponseType.NOOP) {
-            console.getOutput().println("Profiling was *not* active for " + vmId + ". No action taken");
+            console.getOutput().println(translator.localize(LocaleResources.NOT_PROFILING, vmId).getContents());
         } else if (response.getType() == ResponseType.NOK) {
-            console.getError().println("Unable to stop profiling " + vmId);
+            console.getError().println(translator.localize(LocaleResources.UNABLE_TO_STOP_PROFILING, vmId).getContents());
         } else {
-            console.getError().println("Unable to use profiling");
+            console.getError().println(translator.localize(LocaleResources.UNABLE_TO_USE_PROFILING).getContents());
         }
     }
 
--- a/vm-profiler/client-cli/src/main/resources/com/redhat/thermostat/vm/profiler/client/cli/internal/strings.properties	Fri Nov 28 16:44:05 2014 -0500
+++ b/vm-profiler/client-cli/src/main/resources/com/redhat/thermostat/vm/profiler/client/cli/internal/strings.properties	Fri Nov 28 17:09:31 2014 -0500
@@ -8,6 +8,14 @@
 INTERRUPTED_WAITING_FOR_RESPONSE = Interrupted while waiting for a response from agent
 AGENT_NOT_FOUND = error: agent {0} not found
 
+STARTED_PROFILING = Started profiling {0}
+ALREADY_PROFILING = Profiling already active for {0}
+UNABLE_TO_START_PROFILING = Unable to start profiling {0}
+STOPPED_PROFILING = Stopped profiling {0}
+NOT_PROFILING = Profiling was *not* active for {0}. No action taken
+UNABLE_TO_STOP_PROFILING = Unable to stop profiling {0}
+UNABLE_TO_USE_PROFILING = Unable to use profiling
+
 STATUS_CURRENTLY_PROFILING = Currently profiling: Yes
 STATUS_CURRENTLY_NOT_PROFILING = Currently profiling: No