提交 2f7fbafd 编写于 作者: K Kohsuke Kawaguchi

i18n.

Regrettably the CLI client and the CLI server are in the same package, and this doesn't work very well with i18n scheme as we end up having two classes of the same name (and one hides the other in the server.)

So I'm renaming the Messages class on the client, but not the classes itself for compatibility
上级 1259aa9c
......@@ -29,6 +29,7 @@ import hudson.remoting.RemoteOutputStream;
import hudson.remoting.PingThread;
import hudson.remoting.SocketInputStream;
import hudson.remoting.SocketOutputStream;
import hudson.cli.client.Messages;
import java.net.URL;
import java.net.URLConnection;
......
......@@ -72,7 +72,7 @@ public class InstallPluginCommand extends CLICommand {
// is this a file?
FilePath f = new FilePath(channel, source);
if (f.exists()) {
stdout.println("Installing a plugin from local file: "+f);
stdout.println(Messages.InstallPluginCommand_InstallingPluginFromLocalFile(f));
if (name==null)
name = f.getBaseName();
f.copyTo(getTargetFile());
......@@ -82,7 +82,7 @@ public class InstallPluginCommand extends CLICommand {
// is this an URL?
try {
URL u = new URL(source);
stdout.println("Installing a plugin from "+u);
stdout.println(Messages.InstallPluginCommand_InstallingPluginFromUrl(u));
if (name==null) {
name = u.getPath();
name = name.substring(name.indexOf('/')+1);
......@@ -99,26 +99,26 @@ public class InstallPluginCommand extends CLICommand {
// is this a plugin the update center?
UpdateSite.Plugin p = h.getUpdateCenter().getPlugin(source);
if (p!=null) {
stdout.println("Installing "+source+" from update center");
stdout.println(Messages.InstallPluginCommand_InstallingFromUpdateCenter(source));
p.deploy().get();
continue;
}
stdout.println(source+" is neither a valid file, URL, nor a plugin artifact name in the update center");
stdout.println(Messages.InstallPluginCommand_NotAValidSourceName(source));
if (!source.contains(".") && !source.contains(":") && !source.contains("/") && !source.contains("\\")) {
// looks like a short plugin name. Why did we fail to find it in the update center?
if (h.getUpdateCenter().getSites().isEmpty()) {
stdout.println("Note that no update center is defined in this Hudson.");
stdout.println(Messages.InstallPluginCommand_NoUpdateCenterDefined());
} else {
Set<String> candidates = new HashSet<String>();
for (UpdateSite s : h.getUpdateCenter().getSites()) {
Data dt = s.getData();
if (dt==null)
stdout.println("No update center data is retrieved yet from: "+s.getUrl());
stdout.println(Messages.InstallPluginCommand_NoUpdateDataRetrieved(s.getUrl()));
candidates.addAll(dt.plugins.keySet());
}
stdout.println(source+" looks like a short plugin name. Did you mean '"+ EditDistance.findNearest(source,candidates)+"'?");
stdout.println(Messages.InstallPluginCommand_DidYouMean(source,EditDistance.findNearest(source,candidates)));
}
}
......
InstallPluginCommand.DidYouMean={0} looks like a short plugin name. Did you mean ''{1}''?
InstallPluginCommand.InstallingFromUpdateCenter=Installing {0} from update center
InstallPluginCommand.InstallingPluginFromLocalFile=Installing a plugin from local file: {0}
InstallPluginCommand.InstallingPluginFromUrl=Installing a plugin from {0}
InstallPluginCommand.NoUpdateCenterDefined=Note that no update center is defined in this Hudson.
InstallPluginCommand.NoUpdateDataRetrieved=No update center data is retrieved yet from: {0}
InstallPluginCommand.NotAValidSourceName={0} is neither a valid file, URL, nor a plugin artifact name in the update center
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册