From 0529db4a80cf4a660dd371802293adc50103befc Mon Sep 17 00:00:00 2001 From: snowleo Date: Mon, 9 May 2011 21:07:00 +0000 Subject: [PATCH] More translation stuff git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1397 e251c2fe-e539-e718-e476-b85c1f46cddb --- .../src/com/earth2me/essentials/EssentialsConf.java | 12 ++++++------ .../essentials/EssentialsEcoBlockListener.java | 12 ++++++------ Essentials/src/messages.properties | 10 +++++++++- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/EssentialsConf.java b/Essentials/src/com/earth2me/essentials/EssentialsConf.java index 097d02ce8..7520194a0 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsConf.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsConf.java @@ -46,19 +46,19 @@ public class EssentialsConf extends Configuration { if (templateName != null) { - logger.log(Level.INFO, "Creating config from template: " + configFile.toString()); + logger.log(Level.INFO, Util.format("creatingConfigFromTemplate ", configFile.toString())); createFromTemplate(); } else { try { - logger.log(Level.INFO, "Creating empty config: " + configFile.toString()); + logger.log(Level.INFO, Util.format("creatingEmptyConfig", configFile.toString())); configFile.createNewFile(); } catch (IOException ex) { - logger.log(Level.SEVERE, "Failed to create config " + configFile.toString(), ex); + logger.log(Level.SEVERE, Util.format("failedToCreateConfig", configFile.toString()), ex); } } } @@ -77,7 +77,7 @@ public class EssentialsConf extends Configuration InputStream istr = resourceClass.getResourceAsStream(templateName); if (istr == null) { - logger.log(Level.SEVERE, "Could not find template " + templateName); + logger.log(Level.SEVERE, Util.format("couldNotFindTemplate", templateName)); return; } ostr = new FileOutputStream(configFile); @@ -93,7 +93,7 @@ public class EssentialsConf extends Configuration } catch (IOException ex) { - logger.log(Level.SEVERE, "Failed to write config " + configFile.toString(), ex); + logger.log(Level.SEVERE, Util.format("failedToWriteConfig", configFile.toString()), ex); return; } finally @@ -107,7 +107,7 @@ public class EssentialsConf extends Configuration } catch (IOException ex) { - logger.log(Level.SEVERE, "Failed to close config " + configFile.toString(), ex); + logger.log(Level.SEVERE, Util.format("failedToCloseConfig", configFile.toString()), ex); return; } } diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEcoBlockListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEcoBlockListener.java index ffe2037f2..fa39eb79e 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsEcoBlockListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsEcoBlockListener.java @@ -59,7 +59,7 @@ public class EssentialsEcoBlockListener extends BlockListener double r2 = Double.parseDouble(l2[m2 ? 1 : 2]); if ((!m1 & q1 < 1) || (!m2 & q2 < 1)) { - throw new Exception("Quantities must be greater than 0."); + throw new Exception(Util.i18n("moreThanZero")); } ItemStack i1 = m1 || r1 <= 0 ? null : ItemDb.get(l1[1], (int)r1); @@ -87,7 +87,7 @@ public class EssentialsEcoBlockListener extends BlockListener } catch (Throwable ex) { - user.sendMessage("§cError: " + ex.getMessage()); + user.sendMessage(Util.format("errorWithMessage", ex.getMessage())); } return; } @@ -167,7 +167,7 @@ public class EssentialsEcoBlockListener extends BlockListener r2 = m2 ? r2 : r2 - r2 % q2; if ((!m1 & q1 < 1) || (!m2 &q2 < 1) || r2 < 1) { - throw new Exception("Quantities must be greater than 0."); + throw new Exception(Util.i18n("moreThanZero")); } if (!m1) { @@ -178,17 +178,17 @@ public class EssentialsEcoBlockListener extends BlockListener { if (user.getMoney() < r2) { - throw new Exception("You do not have sufficient funds."); + throw new Exception(Util.i18n("notEnoughMoney")); } user.takeMoney(r2); - user.sendMessage("r2: " + r2 + " q2: " + q2); + //user.sendMessage("r2: " + r2 + " q2: " + q2); } else { ItemStack i2 = ItemDb.get(l2[1], (int)r2); if (!InventoryWorkaround.containsItem(user.getInventory(), true, i2)) { - throw new Exception("You do not have " + r2 + "x " + l2[1] + "."); + throw new Exception(Util.format("missingItems", r2, l2[1])); } InventoryWorkaround.removeItem(user.getInventory(), true, i2); user.updateInventory(); diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index db04cd8b2..11e89f020 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -26,4 +26,12 @@ 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} \ No newline at end of file +errorWithMessage = \u00a7cError: {0} +creatingConfigFromTemplate = Creating config from template: {0} +creatingEmptyConfig = Creating empty config: {0} +failedToCreateConfig = Failed to create config {0} +couldNotFindTemplate = Could not find template {0} +failedToWriteConfig = Failed to write config {0} +failedToCloseConfig = Failed to close config {0} +notEnoughMoney = You do not have sufficient funds. +missingItems = You do not have {0}x {1}. \ No newline at end of file