More translation stuff

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1395 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
snowleo 2011-05-09 20:46:25 +00:00
parent 442e54ad6b
commit 4486a99a4e
5 changed files with 54 additions and 31 deletions

View File

@ -42,7 +42,7 @@ public class Backup implements Runnable {
if (command == null || "".equals(command)) {
return;
}
logger.log(Level.INFO, "Backup started");
logger.log(Level.INFO, Util.i18n("backupStarted"));
final CommandSender cs = server.getServer().console;
server.dispatchCommand(cs, "save-all");
server.dispatchCommand(cs, "save-off");
@ -71,7 +71,7 @@ public class Backup implements Runnable {
}
}
active = false;
logger.log(Level.INFO, "Backup finished");
logger.log(Level.INFO, Util.i18n("backupFinished"));
}
});
}

View File

@ -15,7 +15,7 @@ public class Console implements IReplyTo {
public static CommandSender getCommandSender(Server server) throws Exception {
if (! (server instanceof CraftServer)) {
throw new Exception("Invalid server!");
throw new Exception(Util.i18n("invalidServer"));
}
return ((CraftServer)server).getServer().console;
}

View File

@ -63,7 +63,7 @@ public class Essentials extends JavaPlugin
File dataFolder = File.createTempFile("essentialstest", "");
dataFolder.delete();
dataFolder.mkdir();
logger.log(Level.INFO, "Using temp folder for testing:");
logger.log(Level.INFO, Util.i18n("usingTempFolderForTesting"));
logger.log(Level.INFO, dataFolder.toString());
this.initialize(null, null, new PluginDescriptionFile(new FileReader(new File("src" + File.separator + "plugin.yml"))), dataFolder, null, null);
settings = new Settings(dataFolder);
@ -74,21 +74,20 @@ public class Essentials extends JavaPlugin
instance = this;
}
@SuppressWarnings("LoggerStringConcat")
public void onEnable()
{
setStatic();
EssentialsUpgrade upgrade = new EssentialsUpgrade(this.getDescription().getVersion(), this);
if (newWorldsLoaded)
{
logger.log(Level.SEVERE, "New worlds have been loaded while upgrading files. The server will stop now, please restart it.");
logger.log(Level.SEVERE, Util.i18n("worldsLoadedRestartServer"));
try
{
getServer().dispatchCommand(Console.getCommandSender(getServer()), "stop");
}
catch (Exception ex)
{
logger.log(Level.SEVERE, "Failed to stop the server!", ex);
logger.log(Level.SEVERE, Util.i18n("failedStopServer"), ex);
}
}
confList = new ArrayList<IConf>();
@ -111,7 +110,7 @@ public class Essentials extends JavaPlugin
{
if (!plugin.getDescription().getVersion().equals(this.getDescription().getVersion()))
{
logger.log(Level.WARNING, "Version mismatch! Please update " + plugin.getDescription().getName() + " to the same version.");
logger.log(Level.WARNING, Util.format("versionMismatch", plugin.getDescription().getName()));
}
}
}
@ -121,12 +120,12 @@ public class Essentials extends JavaPlugin
int versionNumber = Integer.parseInt(versionMatch.group(4));
if (versionNumber < minBukkitBuildVersion)
{
logger.log(Level.WARNING, "Bukkit version is not the recommended build for Essentials.");
logger.log(Level.WARNING, Util.i18n("notRecommendedBukkit"));
}
}
else
{
logger.log(Level.INFO, "Bukkit version format changed. Version not checked.");
logger.log(Level.INFO, Util.i18n("bukkitFormatChanged"));
}
@ -195,7 +194,7 @@ public class Essentials extends JavaPlugin
}
catch (Exception ex)
{
logger.log(Level.WARNING, "Could not load items.csv.", ex);
logger.log(Level.WARNING, Util.i18n("itemsCsvNotLoaded"), ex);
}
}
@ -227,7 +226,7 @@ public class Essentials extends JavaPlugin
}
catch (Throwable ex2)
{
System.out.println(ChatColor.DARK_RED + "Notice: Your configuration file has a corrupt " + node + " node.");
logger.log(Level.WARNING, Util.format("corruptNodeInConfig", node));
return new String[0];
}
}
@ -380,7 +379,7 @@ public class Essentials extends JavaPlugin
{
if (mail.size() > 0)
{
user.sendMessage(ChatColor.RED + "You have " + mail.size() + " messages!§f Type §7/mail read§f to view your mail.");
user.sendMessage(Util.format("youHaveNewMail", mail.size()));
}
}
}
@ -398,16 +397,16 @@ public class Essentials extends JavaPlugin
}
catch (Exception ex)
{
sender.sendMessage(ChatColor.RED + "That command is improperly loaded.");
logger.log(Level.SEVERE, "Command " + commandLabel + " is improperly loaded.", ex);
sender.sendMessage(Util.format("commandNotLoaded", commandLabel));
logger.log(Level.SEVERE, Util.format("commandNotLoaded", commandLabel), ex);
return true;
}
// Check authorization
if (user != null && !user.isAuthorized(cmd))
{
logger.log(Level.WARNING, user.getName() + " was denied access to command.");
user.sendMessage(ChatColor.RED + "You do not have access to that command.");
logger.log(Level.WARNING, Util.format("deniedAccessCommand", user.getName()));
user.sendMessage(Util.i18n("noAccessCommand"));
return true;
}
@ -435,14 +434,14 @@ public class Essentials extends JavaPlugin
sender.sendMessage(ChatColor.RED + "Error: " + ex.getMessage());
if (getSettings().isDebug())
{
logger.log(Level.WARNING, "Error calling command /" + commandLabel, ex);
logger.log(Level.WARNING, Util.format("errorCallingCommand", commandLabel), ex);
}
return true;
}
}
catch (Throwable ex)
{
logger.log(Level.SEVERE, "Command " + commandLabel + " failed: ", ex);
logger.log(Level.SEVERE, Util.format("commandFailed", commandLabel), ex);
return true;
}
}
@ -456,7 +455,7 @@ public class Essentials extends JavaPlugin
{
if (!file.exists())
{
throw new FileNotFoundException("banned-players.txt not found");
throw new FileNotFoundException(Util.i18n("bannedPlayersFileNotFound"));
}
BufferedReader rx = new BufferedReader(new FileReader(file));
@ -477,19 +476,19 @@ public class Essentials extends JavaPlugin
}
catch (IOException io)
{
logger.log(Level.SEVERE, "Error reading banned-players.txt", io);
logger.log(Level.SEVERE, Util.i18n("bannedPlayersFileError"), io);
}
}
catch (FileNotFoundException ex)
{
logger.log(Level.SEVERE, "Error reading banned-players.txt", ex);
logger.log(Level.SEVERE, Util.i18n("bannedPlayersFileError"), ex);
}
try
{
if (!ipFile.exists())
{
throw new FileNotFoundException("banned-ips.txt not found");
throw new FileNotFoundException(Util.i18n("bannedIpsFileNotFound"));
}
BufferedReader rx = new BufferedReader(new FileReader(ipFile));
@ -510,12 +509,12 @@ public class Essentials extends JavaPlugin
}
catch (IOException io)
{
logger.log(Level.SEVERE, "Error reading banned-ips.txt", io);
logger.log(Level.SEVERE, Util.i18n("bannedIpsFileError"), io);
}
}
catch (FileNotFoundException ex)
{
logger.log(Level.SEVERE, "Error reading banned-ips.txt", ex);
logger.log(Level.SEVERE, Util.i18n("bannedIpsFileError"), ex);
}
}

View File

@ -37,7 +37,7 @@ public class EssentialsBlockListener extends BlockListener
if (isBlockProtected(event.getBlock(), user))
{
event.setCancelled(true);
user.sendMessage("§cYou do not have permission to destroy that chest.");
user.sendMessage(Util.format("noDestroyPermission", event.getBlock().getType().toString().toLowerCase()));
return;
}
}
@ -46,7 +46,7 @@ public class EssentialsBlockListener extends BlockListener
checkProtectionSign(event.getBlock(), user) != OWNER)
{
event.setCancelled(true);
user.sendMessage("§cYou do not have permission to destroy that sign.");
user.sendMessage(Util.format("noDestroyPermission", event.getBlock().getType().toString().toLowerCase()));
}
}
@ -88,7 +88,7 @@ public class EssentialsBlockListener extends BlockListener
String[] l1 = event.getLine(1).split("[ :-]+", 2);
boolean m1 = l1[0].matches("\\$[0-9]+");
int q1 = Integer.parseInt(m1 ? l1[0].substring(1) : l1[0]);
if (q1 < 1) throw new Exception("Quantities must be greater than 0.");
if (q1 < 1) throw new Exception(Util.i18n("moreThanZero"));
if (!m1) ItemDb.get(l1[1]);
event.setLine(1, (m1 ? "$" + q1 : q1 + " " + l1[1]));
}
@ -129,7 +129,7 @@ public class EssentialsBlockListener extends BlockListener
String[] l1 = event.getLine(3).split("[ :-]+", 2);
boolean m1 = l1[0].matches("\\$[0-9]+");
int q1 = Integer.parseInt(m1 ? l1[0].substring(1) : l1[0]);
if (q1 < 1) throw new Exception("Quantities must be greater than 0.");
if (q1 < 1) throw new Exception(Util.i18n("moreThanZero"));
if (!m1) ItemDb.get(l1[1]);
event.setLine(3, (m1 ? "$" + q1 : q1 + " " + l1[1]));
}
@ -149,7 +149,7 @@ public class EssentialsBlockListener extends BlockListener
}
catch (Throwable ex)
{
user.sendMessage("§cError: " + ex.getMessage());
user.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
}
}

View File

@ -2,4 +2,28 @@ loadinfo = Loaded {0} build {1} maintained by {2}
markedAsNotAway = \u00a77You are no longer marked as away.
markedAsAway = \u00a77You are now marked as away.
userIsNotAway = {0} is no longer AFK
userIsAway = {0} is now AFK
userIsAway = {0} is now AFK
backupStarted = Backup started
backupFinished = Backup finished
invalidServer = Invalid server!
usingTempFolderForTesting = Using temp folder for testing:
worldsLoadedRestartServer = New worlds have been loaded while upgrading files. The server will stop now, please restart it.
failedStopServer = Failed to stop the server!
versionMismatch = Version mismatch! Please update {0} to the same version.
notRecommendedBukkit = Bukkit version is not the recommended build for Essentials.
bukkitFormatChanged = Bukkit version format changed. Version not checked.
itemsCsvNotLoaded = Could not load items.csv.
corruptNodeInConfig = \u00a74Notice: Your configuration file has a corrupt {0} node.
youHaveNewMail = \u00a7cYou have {0} messages!\u00a7f Type \u00a77/mail read\u00a7f to view your mail.
commandNotLoaded = \u00a7cCommand {0} is improperly loaded.
deniedAccessCommand = {0} was denied access to command.
noAccessCommand = \u00a7cYou do not have access to that command.
errorCallingCommand = Error calling command /{0}
commandFailed = Command {0} failed:
bannedPlayersFileNotFound = banned-players.txt not found
bannedPlayersFileError = Error reading banned-players.txt
bannedIpsFileNotFound = banned-ips.txt not found
bannedIpsFileError = Error reading banned-ips.txt
noDestroyPermission = \u00a7cYou do not have permission to destroy that {0}.
moreThanZero = Quantities must be greater than 0.
errorWithMessage = \u00a7cError: {0}