Added a tonne more translations

Dieser Commit ist enthalten in:
Matthew Miller 2019-11-01 22:33:31 +10:00
Ursprung 4ba54c4337
Commit fc0fee39cb
11 geänderte Dateien mit 81 neuen und 42 gelöschten Zeilen

Datei anzeigen

@ -32,6 +32,7 @@ import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
import com.sk89q.worldedit.registry.state.Property;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockCategory;
import com.sk89q.worldedit.world.block.BlockState;
@ -237,13 +238,13 @@ public class CLIWorldEdit {
while (scanner.hasNextLine()) {
String line = scanner.nextLine();
if (line.equals("stop")) {
commandSender.print("Stopping!");
commandSender.printInfo(TextComponent.of("Stopping!"));
break;
}
CommandEvent event = new CommandEvent(commandSender, line);
WorldEdit.getInstance().getEventBus().post(event);
if (!event.isCancelled()) {
commandSender.printError("Unknown command!");
commandSender.printError(TextComponent.of("Unknown command!"));
} else {
saveAllWorlds(false);
}

Datei anzeigen

@ -49,6 +49,8 @@ import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.concurrency.EvenMoreExecutors;
import com.sk89q.worldedit.util.eventbus.EventBus;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
import com.sk89q.worldedit.util.io.file.FileSelectionAbortedException;
import com.sk89q.worldedit.util.io.file.FilenameException;
import com.sk89q.worldedit.util.io.file.FilenameResolutionException;
@ -634,7 +636,7 @@ public final class WorldEdit {
* @param player the player
* @param f the script file to execute
* @param args arguments for the script
* @throws WorldEditException
* @throws WorldEditException if something goes wrong
*/
public void runScript(Player player, File f, String[] args) throws WorldEditException {
String filename = f.getPath();
@ -642,7 +644,7 @@ public final class WorldEdit {
String ext = filename.substring(index + 1);
if (!ext.equalsIgnoreCase("js")) {
player.printError("Only .js scripts are currently supported");
player.printError(TranslatableComponent.of("worldedit.script.unsupported"));
return;
}
@ -655,7 +657,7 @@ public final class WorldEdit {
file = WorldEdit.class.getResourceAsStream("craftscripts/" + filename);
if (file == null) {
player.printError("Script does not exist: " + filename);
player.printError(TranslatableComponent.of("worldedit.script.file-not-found", TextComponent.of(filename)));
return;
}
} else {
@ -668,7 +670,7 @@ public final class WorldEdit {
in.close();
script = new String(data, 0, data.length, StandardCharsets.UTF_8);
} catch (IOException e) {
player.printError("Script read error: " + e.getMessage());
player.printError(TranslatableComponent.of("worldedit.script.read-error", TextComponent.of(e.getMessage())));
return;
}
@ -681,8 +683,7 @@ public final class WorldEdit {
try {
engine = new RhinoCraftScriptEngine();
} catch (NoClassDefFoundError ignored) {
player.printError("Failed to find an installed script engine.");
player.printError("Please see https://worldedit.enginehub.org/en/latest/usage/other/craftscripts/");
player.printError(TranslatableComponent.of("worldedit.script.no-script-engine"));
return;
}
@ -696,14 +697,13 @@ public final class WorldEdit {
try {
engine.evaluate(script, filename, vars);
} catch (ScriptException e) {
player.printError("Failed to execute:");
player.print(TextComponent.of(e.getMessage()));
player.printError(TranslatableComponent.of("worldedit.script.failed", TextComponent.of(e.getMessage(), TextColor.WHITE)));
logger.warn("Failed to execute script", e);
} catch (NumberFormatException | WorldEditException e) {
throw e;
} catch (Throwable e) {
player.printError("Failed to execute (see console):");
player.print(TextComponent.of(e.getClass().getCanonicalName()));
player.printError(TranslatableComponent.of("worldedit.script.failed-console", TextComponent.of(e.getClass().getCanonicalName(),
TextColor.WHITE)));
logger.warn("Failed to execute script", e);
} finally {
for (EditSession editSession : scriptContext.getEditSessions()) {

Datei anzeigen

@ -38,6 +38,7 @@ import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.formatting.component.PaginationBox;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
import com.sk89q.worldedit.world.World;
@ -85,9 +86,9 @@ public class ChunkCommands {
int chunkZ = (int) Math.floor(pos.getBlockZ() / 16.0);
final BlockVector2 chunkPos = BlockVector2.at(chunkX, chunkZ);
player.print("Chunk: " + chunkX + ", " + chunkZ);
player.print("Old format: " + LegacyChunkStore.getFilename(chunkPos));
player.print("McRegion: region/" + McRegionChunkStore.getFilename(chunkPos));
player.printInfo(TranslatableComponent.of("worldedit.chunkinfo.chunk", TextComponent.of(chunkX), TextComponent.of(chunkZ)));
player.printInfo(TranslatableComponent.of("worldedit.chunkinfo.old-filename", TextComponent.of(LegacyChunkStore.getFilename(chunkPos))));
player.printInfo(TranslatableComponent.of("worldedit.chunkinfo.mcregion-filename", TextComponent.of(McRegionChunkStore.getFilename(chunkPos))));
}
@Command(
@ -101,7 +102,7 @@ public class ChunkCommands {
WorldEditAsyncCommandBuilder.createAndSendMessage(actor,
() -> new ChunkListPaginationBox(region).create(page),
"Listing chunks for " + actor.getName());
TranslatableComponent.of("worldedit.listchunks.listfor", TextComponent.of(actor.getName())));
}
@Command(

Datei anzeigen

@ -289,7 +289,7 @@ public class GeneralCommands {
}
WorldEditAsyncCommandBuilder.createAndSendMessage(actor, new ItemSearcher(search, blocksOnly, itemsOnly, page),
"(Please wait... searching items.)");
TranslatableComponent.of("worldedit.searchitem.searching"));
}
private static class ItemSearcher implements Callable<Component> {

Datei anzeigen

@ -129,7 +129,7 @@ public class SchematicCommands {
SchematicLoadTask task = new SchematicLoadTask(actor, f, format);
AsyncCommandBuilder.wrap(task, actor)
.registerWithSupervisor(worldEdit.getSupervisor(), "Loading schematic " + filename)
.sendMessageAfterDelay("(Please wait... loading schematic.)")
.sendMessageAfterDelay(TranslatableComponent.of("worldedit.schematic.load.loading"))
.onSuccess(TextComponent.of(filename, TextColor.GOLD)
.append(TextComponent.of(" loaded. Paste it with ", TextColor.LIGHT_PURPLE))
.append(CodeFormat.wrap("//paste").clickEvent(ClickEvent.of(ClickEvent.Action.SUGGEST_COMMAND, "//paste"))),
@ -188,7 +188,7 @@ public class SchematicCommands {
SchematicSaveTask task = new SchematicSaveTask(actor, f, format, holder, overwrite);
AsyncCommandBuilder.wrap(task, actor)
.registerWithSupervisor(worldEdit.getSupervisor(), "Saving schematic " + filename)
.sendMessageAfterDelay("(Please wait... saving schematic.)")
.sendMessageAfterDelay(TranslatableComponent.of("worldedit.schematic.save.saving"))
.onSuccess(filename + " saved" + (overwrite ? " (overwriting previous file)." : "."), null)
.onFailure("Failed to load schematic", worldEdit.getPlatformManager().getPlatformCommandManager().getExceptionConverter())
.buildAndExec(worldEdit.getExecutorService());

Datei anzeigen

@ -26,6 +26,7 @@ import com.sk89q.worldedit.command.util.CommandPermissions;
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
import com.sk89q.worldedit.command.util.Logging;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
@ -67,7 +68,7 @@ public class ScriptingCommands {
@Arg(desc = "Arguments to the CraftScript", def = "", variable = true)
List<String> args) throws WorldEditException {
if (!player.hasPermission("worldedit.scripting.execute." + filename)) {
player.printError("You don't have permission to use that script.");
player.printError(TranslatableComponent.of("worldedit.execute.script-permissions"));
return;
}
@ -93,12 +94,12 @@ public class ScriptingCommands {
String lastScript = session.getLastScript();
if (!player.hasPermission("worldedit.scripting.execute." + lastScript)) {
player.printError("You don't have permission to use that script.");
player.printError(TranslatableComponent.of("worldedit.execute.script-permissions"));
return;
}
if (lastScript == null) {
player.printError("Use /cs with a script name first.");
player.printError(TranslatableComponent.of("worldedit.executelast.no-script"));
return;
}

Datei anzeigen

@ -86,7 +86,7 @@ public class SnapshotCommands {
if (!snapshots.isEmpty()) {
actor.print(new SnapshotListBox(world.getName(), snapshots).create(page));
} else {
actor.printError("No snapshots are available. See console for details.");
actor.printError(TranslatableComponent.of("worldedit.restore.none-found-console"));
// Okay, let's toss some debugging information!
File dir = config.snapshotRepo.getDirectory();
@ -138,9 +138,9 @@ public class SnapshotCommands {
} else {
try {
session.setSnapshot(config.snapshotRepo.getSnapshot(name));
actor.print("Snapshot set to: " + name);
actor.printInfo(TranslatableComponent.of("worldedit.snapshot.use", TextComponent.of(name)));
} catch (InvalidSnapshotException e) {
actor.printError("That snapshot does not exist or is not available.");
actor.printError(TranslatableComponent.of("worldedit.restore.not-available"));
}
}
}
@ -161,23 +161,23 @@ public class SnapshotCommands {
}
if (index < 1) {
actor.printError("Invalid index, must be equal or higher then 1.");
actor.printError(TranslatableComponent.of("worldedit.snapshot.index-above-0"));
return;
}
try {
List<Snapshot> snapshots = config.snapshotRepo.getSnapshots(true, world.getName());
if (snapshots.size() < index) {
actor.printError("Invalid index, must be between 1 and " + snapshots.size() + ".");
actor.printError(TranslatableComponent.of("worldedit.snapshot.index-oob", TextComponent.of(snapshots.size())));
return;
}
Snapshot snapshot = snapshots.get(index - 1);
if (snapshot == null) {
actor.printError("That snapshot does not exist or is not available.");
actor.printError(TranslatableComponent.of("worldedit.restore.not-available"));
return;
}
session.setSnapshot(snapshot);
actor.print("Snapshot set to: " + snapshot.getName());
actor.printInfo(TranslatableComponent.of("worldedit.snapshot.use", TextComponent.of(snapshot.getName())));
} catch (MissingWorldException e) {
actor.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
}
@ -203,11 +203,13 @@ public class SnapshotCommands {
Snapshot snapshot = config.snapshotRepo.getSnapshotBefore(date, world.getName());
if (snapshot == null) {
actor.printError("Couldn't find a snapshot before "
+ dateFormat.withZone(session.getTimeZone()).format(date) + ".");
actor.printError(TranslatableComponent.of(
"worldedit.snapshot.none-before",
TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date)))
);
} else {
session.setSnapshot(snapshot);
actor.print("Snapshot set to: " + snapshot.getName());
actor.printInfo(TranslatableComponent.of("worldedit.snapshot.use", TextComponent.of(snapshot.getName())));
}
} catch (MissingWorldException ex) {
actor.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
@ -233,11 +235,13 @@ public class SnapshotCommands {
try {
Snapshot snapshot = config.snapshotRepo.getSnapshotAfter(date, world.getName());
if (snapshot == null) {
actor.printError("Couldn't find a snapshot after "
+ dateFormat.withZone(session.getTimeZone()).format(date) + ".");
actor.printError(TranslatableComponent.of(
"worldedit.snapshot.none-after",
TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date)))
);
} else {
session.setSnapshot(snapshot);
actor.print("Snapshot set to: " + snapshot.getName());
actor.printInfo(TranslatableComponent.of("worldedit.snapshot.use", TextComponent.of(snapshot.getName())));
}
} catch (MissingWorldException ex) {
actor.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));

Datei anzeigen

@ -22,6 +22,7 @@ package com.sk89q.worldedit.command.util;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import javax.annotation.Nullable;
import java.util.concurrent.Callable;
@ -33,13 +34,18 @@ public final class WorldEditAsyncCommandBuilder {
private WorldEditAsyncCommandBuilder() {
}
@Deprecated
public static void createAndSendMessage(Actor actor, Callable<Component> task, @Nullable String desc) {
createAndSendMessage(actor, task, desc != null ? TextComponent.of(desc) : null);
}
public static void createAndSendMessage(Actor actor, Callable<Component> task, @Nullable Component desc) {
final AsyncCommandBuilder<Component> builder = AsyncCommandBuilder.wrap(task, actor);
if (desc != null) {
builder.sendMessageAfterDelay(desc);
}
builder
.onSuccess((String) null, actor::print)
.onSuccess((String) null, actor::printInfo)
.onFailure((String) null, WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().getExceptionConverter())
.buildAndExec(WorldEdit.getInstance().getExecutorService());
}

Datei anzeigen

@ -35,6 +35,7 @@ import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.TargetBlock;
import com.sk89q.worldedit.util.auth.AuthorizationException;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
@ -490,13 +491,13 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
@Override
public File openFileOpenDialog(String[] extensions) {
printError("File dialogs are not supported in your environment.");
printError(TranslatableComponent.of("worldedit.platform.no-file-dialog"));
return null;
}
@Override
public File openFileSaveDialog(String[] extensions) {
printError("File dialogs are not supported in your environment.");
printError(TranslatableComponent.of("worldedit.platform.no-file-dialog"));
return null;
}
@ -545,7 +546,6 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
}
@SuppressWarnings("CloneDoesntCallSuperClone")
@Override
public Object clone() throws CloneNotSupportedException {
throw new CloneNotSupportedException("Not supported");

Datei anzeigen

@ -497,7 +497,7 @@ public final class PlatformCommandManager {
}
} catch (ConditionFailedException e) {
if (e.getCondition() instanceof PermissionCondition) {
actor.printError("You are not permitted to do that. Are you in the right mode?");
actor.printError(TranslatableComponent.of("worldedit.command.permissions"));
} else {
actor.print(e.getRichMessage());
}
@ -559,7 +559,7 @@ public final class PlatformCommandManager {
store.injectValue(Key.of(Player.class), ValueProvider.constant((Player) actor));
} else {
store.injectValue(Key.of(Player.class), context -> {
throw new CommandException(TextComponent.of("This command must be used with a player."), ImmutableList.of());
throw new CommandException(TranslatableComponent.of("worldedit.command.player-only"), ImmutableList.of());
});
}
store.injectValue(Key.of(Arguments.class), ValueProvider.constant(arguments));
@ -576,7 +576,7 @@ public final class PlatformCommandManager {
}
private void handleUnknownException(Actor actor, Throwable t) {
actor.printError("Please report this error: [See console]");
actor.printError(TranslatableComponent.of("worldedit.command.error.report"));
actor.print(TextComponent.of(t.getClass().getName() + ": " + t.getMessage()));
log.error("An unexpected error while handling a WorldEdit command", t);
}

Datei anzeigen

@ -53,6 +53,7 @@
"worldedit.toggleplace.player": "Now placing at the block you stand in.",
"worldedit.searchitem.too-short": "Enter a longer search string (len > 2).",
"worldedit.searchitem.b-and-i": "You cannot use both the 'b' and 'i' flags simultaneously.",
"worldedit.searchitem.searching": "(Please wait... searching items.)",
"worldedit.watchdog.no-hook": "This platform has no watchdog hook.",
"worldedit.watchdog.active.already": "Watchdog hook already active.",
"worldedit.watchdog.inactive.already": "Watchdog hook already inactive.",
@ -83,11 +84,18 @@
"worldedit.restore.block-place-error": "Last error: {0}",
"worldedit.snapshot.use.newest": "Now using newest snapshot.",
"worldedit.snapshot.use": "Snapshot set to: {0}",
"worldedit.snapshot.none-before": "Couldn't find a snapshot before {0}.",
"worldedit.snapshot.none-after": "Couldn't find a snapshot after {0}.",
"worldedit.snapshot.index-above-0": "Invalid index, must be equal or higher then 1.",
"worldedit.snapshot.index-oob": "Invalid index, must be between 1 and {0}.",
"worldedit.schematic.unknown-format": "Unknown schematic format: {0}.",
"worldedit.schematic.load.does-not-exist": "Schematic {0} does not exist!",
"worldedit.schematic.load.loading": "(Please wait... loading schematic.)",
"worldedit.schematic.save.already-exists": "That schematic already exists. Use the -f flag to overwrite it.",
"worldedit.schematic.save.failed-directory": "Could not create folder for schematics!",
"worldedit.schematic.save.saving": "(Please wait... saving schematic.)",
"worldedit.schematic.delete.does-not-exist": "Schematic {0} does not exist!",
"worldedit.schematic.delete.failed": "Deletion of {0} failed! Is it read-only?",
"worldedit.schematic.delete.deleted": "{0} has been deleted.",
@ -134,6 +142,11 @@
"worldedit.select.convex.description": "Select a convex polyhedral",
"worldedit.select.default-set": "Your default region selector is now {0}.",
"worldedit.chunkinfo.chunk": "Chunk: {0}, {1}",
"worldedit.chunkinfo.old-filename": "Old format: {0}",
"worldedit.chunkinfo.mcregion-filename": "McRegion: region/{0}",
"worldedit.listchunks.listfor": "Listing chunks for: {0}",
"worldedit.drain.drained": "{0} blocks have been drained.",
"worldedit.fill.created": "{0} blocks have been filled.",
"worldedit.fillr.created": "{0} blocks have been filled.",
@ -215,8 +228,12 @@
"worldedit.version.version": "WorldEdit version {0}",
"worldedit.command.time-elapsed": "{0}s elapsed (history: {1} changed; {2} blocks/sec).",
"worldedit.command.permissions": "You are not permitted to do that. Are you in the right mode?",
"worldedit.command.player-only": "This command must be used with a player.",
"worldedit.command.error.report": "Please report this error: [See console]",
"worldedit.pastebin.uploading": "(Please wait... sending output to pastebin...)",
"worldedit.session.cant-find-session": "Unable to find session for {0}",
"worldedit.platform.no-file-dialog": "File dialogs are not supported in your environment.",
"worldedit.tool.max-block-changes": "Max blocks change limit reached.",
"worldedit.tool.no-block": "No block in sight!",
@ -260,6 +277,15 @@
"worldedit.tool.tracemask.set": "Trace mask set.",
"worldedit.tool.tracemask.disabled": "Trace mask disabled.",
"worldedit.execute.script-permissions": "You don't have permission to use that script.",
"worldedit.executelast.no-script": "Use /cs with a script name first.",
"worldedit.script.read-error": "Script read error: {0}",
"worldedit.script.unsupported": "Only .js scripts are currently supported",
"worldedit.script.file-not-found": "Script does not exist: {0}",
"worldedit.script.no-script-engine": "Failed to find an installed script engine.\nPlease see https://worldedit.enginehub.org/en/latest/usage/other/craftscripts/",
"worldedit.script.failed": "Failed to execute: {0}",
"worldedit.script.failed-console": "Failed to execute (see console): {0}",
"worldedit.operation.affected.biome": "{0} biomes affected",
"worldedit.operation.affected.block": "{0} blocks affected",
"worldedit.operation.affected.column": "{0} columns affected",