1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-26 16:04:27 +02:00

Merge pull request #211 from chrisgward/patch-1

i18n
This commit is contained in:
KHobbits
2012-12-14 05:34:34 -08:00
18 changed files with 55 additions and 38 deletions

View File

@@ -471,3 +471,25 @@ antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74.
gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities
invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp name
debugToggle=Essentials {0} debug mode {1}
gamemodeFailed=Cannot change game mode for player {0}
getposWorld=\u00a77World: {0}
getposX=\u00a77X: {0} (+East <-> -West)
getposY=\u00a77Y: {0} (+Up <-> -Down)
getposZ=\u00a77Z: {0} (+South <-> -North)
getposYaw=\u00a77Yaw: {0} (Rotation)
getposPitch=\u00a77Pitch: {0} (Head angle)
getposDistance=\u00a77Distance: {0}
give=\u00a72Giving {0} of {1} to {2}.
godFailed=\u00a76Can't change god mode for player {0}
socialSpyFailed=Can't change social spy for player {0}
timeWorldFailed=You are not allowed to set the time in world {0}.
tptoggleFailed=Can't change teleport toggle for player {0}
vanishFailed=Can't change vanish mode for player {0}
metrics1=PluginMetrics collects minimal statistic data, starting in about 5 minutes.
metrics2=To opt out, run /essentials opt-out
metrics3=[Metrics] Admin join - Starting 5 minute opt-out period.
metrics4=This will start 5 minutes after the first admin/op joins.
userNotFound=User not found!
flyFailed=Can't change fly mode for {0}
deniedWorldAccess=You do not have permission to access world {0}

View File

@@ -119,7 +119,7 @@ public class Essentials implements IEssentials
throw new IOException();
}
logger.log(Level.INFO, I18n._("usingTempFolderForTesting"));
logger.log(Level.INFO, _("usingTempFolderForTesting"));
logger.log(Level.INFO, dataFolder.toString());
storageQueue.setEnabled(true);
settings = new SettingsHolder(this);

View File

@@ -46,7 +46,7 @@ public class Commandessentials extends EssentialsCommand
private void run_debug(final CommandSender sender, final String[] args) throws Exception
{
ess.getSettings().setDebug(!ess.getSettings().isDebug());
sender.sendMessage("Essentials " + ess.getPlugin().getVersion() + " debug mode " + (ess.getSettings().isDebug() ? "enabled" : "disabled"));
sender.sendMessage(_("debugToggle", ess.getPlugin().getVersion(), _(ess.getSettings().isDebug() ? "enabled" : "disabled")));
}
private void run_reload(final CommandSender sender, final String[] args) throws Exception

View File

@@ -30,8 +30,7 @@ public class Commandfly extends EssentialsToggleCommand
}
else
{
//TODO: TL this
sender.sendMessage("Can't change fly mode for player " + player.getName());
sender.sendMessage(_("flyFailed", player.getName()));
}
}

View File

@@ -30,8 +30,7 @@ public class Commandgamemode extends EssentialsSettingsCommand
sender.sendMessage( _("gameMode", getValue(player).toString().toLowerCase(Locale.ENGLISH), player.getPlayer().getDisplayName()));
}
else {
//TODO: TL this
sender.sendMessage("Can't change game mode for player " + player.getName());
sender.sendMessage(_("gamemodeFailed", player.getName()));
}
}

View File

@@ -4,6 +4,7 @@ import net.ess3.api.IUser;
import net.ess3.permissions.Permissions;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import static net.ess3.I18n._;
@@ -37,18 +38,17 @@ public class Commandgetpos extends EssentialsCommand
outputPosition(sender, user.getPlayer().getLocation(), null);
}
//TODO: Translate
private void outputPosition(final CommandSender sender, final Location coords, final Location distance)
{
sender.sendMessage("§7World: " + coords.getWorld().getName());
sender.sendMessage("§7X: " + coords.getBlockX() + " (+East <-> -West)");
sender.sendMessage("§7Y: " + coords.getBlockY() + " (+Up <-> -Down)");
sender.sendMessage("§7Z: " + coords.getBlockZ() + " (+South <-> -North)");
sender.sendMessage("§7Yaw: " + (coords.getYaw() + 180 + 360) % 360 + " (Rotation)");
sender.sendMessage("§7Pitch: " + coords.getPitch() + " (Head angle)");
sender.sendMessage(_("getposWorld", coords.getWorld().getName()));
sender.sendMessage(_("getposX", coords.getBlockX()));
sender.sendMessage(_("getposY", coords.getBlockY()));
sender.sendMessage(_("getposZ", coords.getBlockZ()));
sender.sendMessage(_("getposYaw", (coords.getYaw() + 540) % 360));
sender.sendMessage(_("getposPitch", coords.getPitch()));
if (distance != null && coords.getWorld().equals(distance.getWorld()))
{
sender.sendMessage("§7Distance: " + coords.distance(distance));
sender.sendMessage(_("getposDistance", coords.distance(distance)));
}
}
}

View File

@@ -81,9 +81,8 @@ public class Commandgive extends EssentialsCommand
giveTo.giveItems(stack, false);
//TODO: TL this.
final String itemName = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' ');
sender.sendMessage(ChatColor.BLUE + "Giving " + stack.getAmount() + " of " + itemName + " to " + giveTo.getPlayer().getDisplayName() + ".");
sender.sendMessage( _("give", stack.getAmount(), itemName, giveTo.getPlayer().getDisplayName()));
}
}

View File

@@ -27,8 +27,7 @@ public class Commandgod extends EssentialsToggleCommand
}
else
{
//TODO: TL this
sender.sendMessage("Can't change god mode for player " + player.getName());
sender.sendMessage(_("godFailed", player.getName()));
}
}

View File

@@ -2,6 +2,7 @@ package net.ess3.commands;
import static net.ess3.I18n._;
import net.ess3.api.IUser;
import net.ess3.permissions.Permissions;
import org.bukkit.command.CommandSender;
import org.bukkit.event.entity.EntityDamageEvent;
@@ -20,7 +21,7 @@ public class Commandkill extends EssentialsCommand
{
final EntityDamageEvent ede = new EntityDamageEvent(matchPlayer.getPlayer(), sender instanceof IUser && sender.getName().equals(matchPlayer.getName()) ? EntityDamageEvent.DamageCause.SUICIDE : EntityDamageEvent.DamageCause.CUSTOM, Short.MAX_VALUE);
server.getPluginManager().callEvent(ede);
if (ede.isCancelled() && !sender.hasPermission("essentials.kill.force"))
if (ede.isCancelled() && Permissions.KILL_FORCE.isAuthorized(sender))
{
continue;
}

View File

@@ -26,8 +26,7 @@ public class Commandsocialspy extends EssentialsToggleCommand
sender.sendMessage( _("socialSpyMode", _(getValue(player) ? "enabled" : "disabled"), player.getPlayer().getDisplayName()));
}
else {
//TODO: TL this
sender.sendMessage("Can't change socialspy for player " + player.getName());
sender.sendMessage(_("socialSpyFailed", player.getName()));
}
}

View File

@@ -94,7 +94,7 @@ public class Commandtime extends EssentialsCommand
World world = iterator.next();
if (!Permissions.TIME_WORLDS.isAuthorized(sender, world.getName())) {
iterator.remove();
sender.sendMessage("You are not allowed to set the time in world "+world.getName()); //TODO:I18n
sender.sendMessage(_("timeWorldFailed", world.getName()));
continue;
}
long time = world.getTime();

View File

@@ -28,8 +28,7 @@ public class Commandtptoggle extends EssentialsToggleCommand
}
else
{
//TODO: TL this
sender.sendMessage("Can't change teleport toggle for player " + player.getName());
sender.sendMessage(_("tptoggleFailed", player.getName()));
}
}

View File

@@ -26,8 +26,7 @@ public class Commandvanish extends EssentialsToggleCommand
}
else
{
//TODO: TL this
sender.sendMessage("Can't change vanish mode for player " + player.getName());
sender.sendMessage(_("vanishFailed", player.getName()));
}
}

View File

@@ -52,7 +52,7 @@ public class Commandworld extends EssentialsCommand
if (!Permissions.WORLD.isAuthorized(user, world.getName()))
{
user.sendMessage(_("invalidWorld")); //TODO: Make a "world teleport denied" translation
user.sendMessage(_("deniedWorldAccess", world.getName()));
throw new NoChargeException();
}

View File

@@ -10,7 +10,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import static net.ess3.I18n._;
public class MetricsListener implements Listener
{
@@ -33,9 +33,9 @@ public class MetricsListener implements Listener
ISettings settings = ess.getSettings();
if (settings.getData().getGeneral().getMetricsEnabled() == null && (Permissions.ESSENTIALS.isAuthorized(event.getPlayer()) || event.getPlayer().hasPermission("bukkit.broadcast.admin")))
{
player.sendMessage("PluginMetrics collects minimal statistic data, starting in about 5 minutes.");
player.sendMessage("To opt out, run /essentials opt-out");
ess.getLogger().log(Level.INFO, "[Metrics] Admin join - Starting 5 minute opt-out period.");
player.sendMessage(_("metrics1"));
player.sendMessage(_("metrics2"));
ess.getLogger().log(Level.INFO, _("metrics3"));
settings.getData().getGeneral().setMetricsEnabled(true);
settings.queueSave();
ess.getPlugin().scheduleAsyncDelayedTask(starter, 5 * 1200);

View File

@@ -8,7 +8,7 @@ import net.ess3.economy.register.Method;
import net.ess3.economy.register.methods.VaultEco;
import net.ess3.metrics.Metrics.Graph;
import net.ess3.metrics.Metrics.Plotter;
import static net.ess3.I18n._;
public class MetricsStarter implements Runnable
{
@@ -46,9 +46,9 @@ public class MetricsStarter implements Runnable
}
else if (settings.getData().getGeneral().getMetricsEnabled() == null)
{
ess.getLogger().info("This plugin collects minimal statistic data and sends it to http://metrics.essentials3.net.");
ess.getLogger().info("You can opt out by running /essentials opt-out");
ess.getLogger().info("This will start 5 minutes after the first admin/op joins.");
ess.getLogger().info(_("metrics1"));
ess.getLogger().info(_("metrics2"));
ess.getLogger().info(_("metrics4"));
start = false;
}
return;

View File

@@ -62,6 +62,7 @@ public enum Permissions implements IPermission
KEEPXP,
KICK_EXEMPT,
KICK_NOTIFY,
KILL_FORCE,
LIST_HIDDEN,
LIGHTNING_OTHERS,
MAIL,

View File

@@ -15,7 +15,7 @@ import net.ess3.api.InvalidNameException;
import net.ess3.storage.StorageObjectMap;
import net.ess3.utils.FormatUtil;
import org.bukkit.entity.Player;
import static net.ess3.I18n._;
public class UserMap extends StorageObjectMap<IUser> implements IUserMap
{
@@ -47,7 +47,7 @@ public class UserMap extends StorageObjectMap<IUser> implements IUserMap
IUser user = getUser(lowercaseName);
if (user == null)
{
throw new Exception("User not found!");
throw new Exception(_("userNotFound"));
}
else
{
@@ -69,7 +69,7 @@ public class UserMap extends StorageObjectMap<IUser> implements IUserMap
keys.add(name.toLowerCase(Locale.ENGLISH));
return new User(ess.getServer().getOfflinePlayer(name), ess);
}
throw new Exception("User not found!");
throw new Exception(_("userNotFound"));
}
@Override