More translation stuff

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1397 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
snowleo 2011-05-09 21:07:00 +00:00
parent dfa6e88efe
commit 0529db4a80
3 changed files with 21 additions and 13 deletions

View file

@ -46,19 +46,19 @@ public class EssentialsConf extends Configuration
{ {
if (templateName != null) if (templateName != null)
{ {
logger.log(Level.INFO, "Creating config from template: " + configFile.toString()); logger.log(Level.INFO, Util.format("creatingConfigFromTemplate ", configFile.toString()));
createFromTemplate(); createFromTemplate();
} }
else else
{ {
try try
{ {
logger.log(Level.INFO, "Creating empty config: " + configFile.toString()); logger.log(Level.INFO, Util.format("creatingEmptyConfig", configFile.toString()));
configFile.createNewFile(); configFile.createNewFile();
} }
catch (IOException ex) 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); InputStream istr = resourceClass.getResourceAsStream(templateName);
if (istr == null) if (istr == null)
{ {
logger.log(Level.SEVERE, "Could not find template " + templateName); logger.log(Level.SEVERE, Util.format("couldNotFindTemplate", templateName));
return; return;
} }
ostr = new FileOutputStream(configFile); ostr = new FileOutputStream(configFile);
@ -93,7 +93,7 @@ public class EssentialsConf extends Configuration
} }
catch (IOException ex) 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; return;
} }
finally finally
@ -107,7 +107,7 @@ public class EssentialsConf extends Configuration
} }
catch (IOException ex) 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; return;
} }
} }

View file

@ -59,7 +59,7 @@ public class EssentialsEcoBlockListener extends BlockListener
double r2 = Double.parseDouble(l2[m2 ? 1 : 2]); double r2 = Double.parseDouble(l2[m2 ? 1 : 2]);
if ((!m1 & q1 < 1) || (!m2 & q2 < 1)) 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); ItemStack i1 = m1 || r1 <= 0 ? null : ItemDb.get(l1[1], (int)r1);
@ -87,7 +87,7 @@ public class EssentialsEcoBlockListener extends BlockListener
} }
catch (Throwable ex) catch (Throwable ex)
{ {
user.sendMessage("§cError: " + ex.getMessage()); user.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
} }
return; return;
} }
@ -167,7 +167,7 @@ public class EssentialsEcoBlockListener extends BlockListener
r2 = m2 ? r2 : r2 - r2 % q2; r2 = m2 ? r2 : r2 - r2 % q2;
if ((!m1 & q1 < 1) || (!m2 &q2 < 1) || r2 < 1) 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) if (!m1)
{ {
@ -178,17 +178,17 @@ public class EssentialsEcoBlockListener extends BlockListener
{ {
if (user.getMoney() < r2) if (user.getMoney() < r2)
{ {
throw new Exception("You do not have sufficient funds."); throw new Exception(Util.i18n("notEnoughMoney"));
} }
user.takeMoney(r2); user.takeMoney(r2);
user.sendMessage("r2: " + r2 + " q2: " + q2); //user.sendMessage("r2: " + r2 + " q2: " + q2);
} }
else else
{ {
ItemStack i2 = ItemDb.get(l2[1], (int)r2); ItemStack i2 = ItemDb.get(l2[1], (int)r2);
if (!InventoryWorkaround.containsItem(user.getInventory(), true, i2)) 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); InventoryWorkaround.removeItem(user.getInventory(), true, i2);
user.updateInventory(); user.updateInventory();

View file

@ -27,3 +27,11 @@ bannedIpsFileError = Error reading banned-ips.txt
noDestroyPermission = \u00a7cYou do not have permission to destroy that {0}. noDestroyPermission = \u00a7cYou do not have permission to destroy that {0}.
moreThanZero = Quantities must be greater than 0. moreThanZero = Quantities must be greater than 0.
errorWithMessage = \u00a7cError: {0} 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}.