Further translations

This commit is contained in:
Matthew Miller 2019-10-21 23:45:02 +10:00
parent 1cca2182a9
commit c01d2f7c24
9 changed files with 103 additions and 47 deletions

View File

@ -290,7 +290,7 @@ public class BrushCommands {
maxRadius = Math.max(config.maxBrushRadius, config.butcherMaxRadius);
}
if (radius > maxRadius) {
player.printError("Maximum allowed brush radius: " + maxRadius);
player.printError(TranslatableComponent.of("worldedit.bruch.radius-too-large", TextComponent.of(maxRadius)));
return;
}

View File

@ -116,7 +116,7 @@ public class ExpandCommands {
TranslatableComponent.of(pluraliseI18n("worldedit.expand.expanded.vert", changeSize), TextComponent.of(changeSize))
);
} catch (RegionOperationException e) {
player.printError(e.getMessage());
player.printError(TextComponent.of(e.getMessage()));
}
}

View File

@ -203,9 +203,9 @@ public class GeneralCommands {
@Arg(desc = "The world override", def = "") World world) {
session.setWorldOverride(world);
if (world == null) {
actor.print("Removed world override.");
actor.printInfo(TranslatableComponent.of("worldedit.world.remove"));
} else {
actor.print("Set the world override to " + world.getId() + ". (Use //world to go back to default)");
actor.printInfo(TranslatableComponent.of("worldedit.world.set", TextComponent.of(world.getId())));
}
}
@ -220,16 +220,16 @@ public class GeneralCommands {
@Arg(desc = "The mode to set the watchdog hook to", def = "")
HookMode hookMode) {
if (WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getWatchdog() == null) {
actor.printError("This platform has no watchdog hook.");
actor.printError(TranslatableComponent.of("worldedit.watchdog.no-hook"));
return;
}
boolean previousMode = session.isTickingWatchdog();
if (hookMode != null && (hookMode == HookMode.ACTIVE) == previousMode) {
actor.printError("Watchdog hook already " + (previousMode ? "active" : "inactive") + ".");
actor.printError(TranslatableComponent.of(previousMode ? "worldedit.help.already-active" : "worldedit.help.already-inactive"));
return;
}
session.setTickingWatchdog(!previousMode);
actor.print("Watchdog hook now " + (previousMode ? "inactive" : "active") + ".");
actor.printInfo(TranslatableComponent.of(previousMode ? "worldedit.help.now-inactive" : "worldedit.help.now-active"));
}
@Command(

View File

@ -75,6 +75,7 @@ import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgum
import static com.sk89q.worldedit.regions.Regions.asFlatRegion;
import static com.sk89q.worldedit.regions.Regions.maximumBlockY;
import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
import static com.sk89q.worldedit.util.translation.LocalisationHelpers.pluraliseI18n;
/**
* Commands that operate on regions.
@ -128,7 +129,7 @@ public class RegionCommands {
@Switch(name = 'h', desc = "Generate only a shell")
boolean shell) throws WorldEditException {
if (!(region instanceof CuboidRegion)) {
actor.printError("//line only works with cuboid selections");
actor.printError(TranslatableComponent.of("worldedit.line.cuboid-only"));
return 0;
}
checkCommandArgument(thickness >= 0, "Thickness must be >= 0");
@ -138,7 +139,7 @@ public class RegionCommands {
BlockVector3 pos2 = cuboidregion.getPos2();
int blocksChanged = editSession.drawLine(pattern, pos1, pos2, thickness, !shell);
actor.print(blocksChanged + " block(s) have been changed.");
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.line.changed", blocksChanged), TextComponent.of(blocksChanged)));
return blocksChanged;
}
@ -158,7 +159,7 @@ public class RegionCommands {
@Switch(name = 'h', desc = "Generate only a shell")
boolean shell) throws WorldEditException {
if (!(region instanceof ConvexPolyhedralRegion)) {
actor.printError("//curve only works with convex polyhedral selections");
actor.printError(TranslatableComponent.of("worldedit.curve.convex-only"));
return 0;
}
checkCommandArgument(thickness >= 0, "Thickness must be >= 0");
@ -168,7 +169,7 @@ public class RegionCommands {
int blocksChanged = editSession.drawSpline(pattern, vectors, 0, 0, 0, 10, thickness, !shell);
actor.print(blocksChanged + " block(s) have been changed.");
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.curve.changed", blocksChanged), TextComponent.of(blocksChanged)));
return blocksChanged;
}
@ -188,7 +189,7 @@ public class RegionCommands {
from = new ExistingBlockMask(editSession);
}
int affected = editSession.replaceBlocks(region, from, to);
actor.print(affected + " block(s) have been replaced.");
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.replace.replaced", affected), TextComponent.of(affected)));
return affected;
}
@ -202,7 +203,7 @@ public class RegionCommands {
@Arg(desc = "The pattern of blocks to overlay")
Pattern pattern) throws WorldEditException {
int affected = editSession.overlayCuboidBlocks(region, pattern);
actor.print(affected + " block(s) have been overlaid.");
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.overlay.overlaid", affected), TextComponent.of(affected)));
return affected;
}
@ -217,7 +218,7 @@ public class RegionCommands {
@Arg(desc = "The pattern of blocks to set")
Pattern pattern) throws WorldEditException {
int affected = editSession.center(region, pattern);
actor.print("Center set (" + affected + " block(s) changed)");
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.center.changed", affected), TextComponent.of(affected)));
return affected;
}
@ -229,7 +230,7 @@ public class RegionCommands {
@Logging(REGION)
public int naturalize(Actor actor, EditSession editSession, @Selection Region region) throws WorldEditException {
int affected = editSession.naturalizeCuboidBlocks(region);
actor.print(affected + " block(s) have been made to look more natural.");
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.naturalize.naturalized", affected), TextComponent.of(affected)));
return affected;
}
@ -243,7 +244,7 @@ public class RegionCommands {
@Arg(desc = "The pattern of blocks to set")
Pattern pattern) throws WorldEditException {
int affected = editSession.makeWalls(region, pattern);
actor.print(affected + " block(s) have been changed.");
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.walls.changed", affected), TextComponent.of(affected)));
return affected;
}
@ -258,7 +259,7 @@ public class RegionCommands {
@Arg(desc = "The pattern of blocks to set")
Pattern pattern) throws WorldEditException {
int affected = editSession.makeCuboidFaces(region, pattern);
actor.print(affected + " block(s) have been changed.");
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.faces.changed", affected), TextComponent.of(affected)));
return affected;
}
@ -277,7 +278,7 @@ public class RegionCommands {
HeightMap heightMap = new HeightMap(editSession, region, mask);
HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0));
int affected = heightMap.applyFilter(filter, iterations);
actor.print("Terrain's height map smoothed. " + affected + " block(s) changed.");
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.smooth.changed", affected), TextComponent.of(affected)));
return affected;
}
@ -328,11 +329,11 @@ public class RegionCommands {
session.getRegionSelector(world).learnChanges();
session.getRegionSelector(world).explainRegionAdjust(actor, session);
} catch (RegionOperationException e) {
actor.printError(e.getMessage());
actor.printError(TextComponent.of(e.getMessage()));
}
}
actor.print(affected + " block(s) moved.");
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.move.moved", affected), TextComponent.of(affected)));
return affected;
}
@ -383,11 +384,11 @@ public class RegionCommands {
session.getRegionSelector(world).learnChanges();
session.getRegionSelector(world).explainRegionAdjust(actor, session);
} catch (RegionOperationException e) {
actor.printError(e.getMessage());
actor.printError(TextComponent.of(e.getMessage()));
}
}
actor.print(affected + " block(s) changed. Undo with //undo");
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.stack.changed", affected), TextComponent.of(affected)));
return affected;
}
@ -408,7 +409,7 @@ public class RegionCommands {
} finally {
session.setMask(mask);
}
actor.print("Region regenerated.");
actor.printInfo(TranslatableComponent.of("worldedit.regen.regenerated"));
}
@Command(
@ -454,10 +455,10 @@ public class RegionCommands {
if (actor instanceof Player) {
((Player) actor).findFreePosition();
}
actor.print(affected + " block(s) have been deformed.");
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.deform.deformed", affected), TextComponent.of(affected)));
return affected;
} catch (ExpressionException e) {
actor.printError(e.getMessage());
actor.printError(TextComponent.of(e.getMessage()));
return 0;
}
}
@ -478,7 +479,7 @@ public class RegionCommands {
checkCommandArgument(thickness >= 0, "Thickness must be >= 0");
int affected = editSession.hollowOutRegion(region, thickness, pattern);
actor.print(affected + " block(s) have been changed.");
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.hollow.changed", affected), TextComponent.of(affected)));
return affected;
}
@ -495,7 +496,7 @@ public class RegionCommands {
double density) throws WorldEditException {
checkCommandArgument(0 <= density && density <= 100, "Density must be in [0, 100]");
int affected = editSession.makeForest(region, density / 100, type);
actor.print(affected + " trees created.");
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.forest.created", affected), TextComponent.of(affected)));
return affected;
}
@ -517,7 +518,7 @@ public class RegionCommands {
Operations.completeLegacy(visitor);
int affected = ground.getAffected();
actor.print(affected + " flora created.");
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.flora.created", affected), TextComponent.of(affected)));
return affected;
}

View File

@ -46,6 +46,7 @@ import com.sk89q.worldedit.util.formatting.component.ErrorFormat;
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.event.HoverEvent;
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
@ -112,7 +113,7 @@ public class SchematicCommands {
ClipboardFormats.getFileExtensionArray());
if (!f.exists()) {
actor.printError("Schematic " + filename + " does not exist!");
actor.printError(TranslatableComponent.of("worldedit.schematic.load.does-not-exist", TextComponent.of(filename)));
return;
}
@ -121,7 +122,7 @@ public class SchematicCommands {
format = ClipboardFormats.findByAlias(formatName);
}
if (format == null) {
actor.printError("Unknown schematic format: " + formatName);
actor.printError(TranslatableComponent.of("worldedit.schematic.unknown-format", TextComponent.of(formatName)));
return;
}
@ -156,7 +157,7 @@ public class SchematicCommands {
ClipboardFormat format = ClipboardFormats.findByAlias(formatName);
if (format == null) {
actor.printError("Unknown schematic format: " + formatName);
actor.printError(TranslatableComponent.of("worldedit.schematic.unknown-format", TextComponent.of(formatName)));
return;
}
@ -168,7 +169,7 @@ public class SchematicCommands {
throw new StopExecutionException(TextComponent.of("That schematic already exists!"));
}
if (!allowOverwrite) {
actor.printError("That schematic already exists. Use the -f flag to overwrite it.");
actor.printError(TranslatableComponent.of("worldedit.schematic.save.already-exists"));
return;
}
}
@ -177,8 +178,8 @@ public class SchematicCommands {
File parent = f.getParentFile();
if (parent != null && !parent.exists()) {
if (!parent.mkdirs()) {
throw new StopExecutionException(TextComponent.of(
"Could not create folder for schematics!"));
throw new StopExecutionException(TranslatableComponent.of(
"worldedit.schematic.save.failed-directory"));
}
}
@ -209,16 +210,16 @@ public class SchematicCommands {
dir, filename, "schematic", ClipboardFormats.getFileExtensionArray());
if (!f.exists()) {
actor.printError("Schematic " + filename + " does not exist!");
actor.printError(TranslatableComponent.of("worldedit.schematic.delete.does-not-exist", TextComponent.of(filename)));
return;
}
if (!f.delete()) {
actor.printError("Deletion of " + filename + " failed! Maybe it is read-only.");
actor.printError(TranslatableComponent.of("worldedit.schematic.delete.failed", TextComponent.of(filename)));
return;
}
actor.print(filename + " has been deleted.");
actor.printInfo(TranslatableComponent.of("worldedit.schematic.delete.deleted", TextComponent.of(filename)));
try {
log.info(actor.getName() + " deleted " + f.getCanonicalPath());
} catch (IOException e) {
@ -233,7 +234,7 @@ public class SchematicCommands {
)
@CommandPermissions("worldedit.schematic.formats")
public void formats(Actor actor) {
actor.print("Available clipboard formats (Name: Lookup names)");
actor.printInfo(TranslatableComponent.of("worldedit.schematic.formats.title"));
StringBuilder builder;
boolean first = true;
for (ClipboardFormat format : ClipboardFormats.getAll()) {
@ -247,7 +248,7 @@ public class SchematicCommands {
first = false;
}
first = true;
actor.print(builder.toString());
actor.printInfo(TextComponent.of(builder.toString()));
}
}

View File

@ -27,6 +27,8 @@ import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.util.formatting.component.CommandListBox;
import com.sk89q.worldedit.util.formatting.component.CommandUsageBox;
import com.sk89q.worldedit.util.formatting.component.InvalidComponentException;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import org.enginehub.piston.Command;
import org.enginehub.piston.CommandManager;
@ -78,7 +80,7 @@ public class PrintCommandHelp {
List<Command> visited = new ArrayList<>();
Command currentCommand = detectCommand(manager, commandPath.get(0));
if (currentCommand == null) {
actor.printError(String.format("The command '%s' could not be found.", commandPath.get(0)));
actor.printError(TranslatableComponent.of("worldedit.help.command-not-found", TextComponent.of(commandPath.get(0))));
return;
}
visited.add(currentCommand);

View File

@ -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;
@ -264,10 +265,8 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
if (world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) {
int platformY = Math.max(initialY, y - 3 - clearance);
if (platformY < initialY) { // if ==, they already have the given clearance, if <, clearance is too large
printError("Not enough space above you!");
return false;
} else if (platformY == initialY) {
printError("You're already at the ceiling.");
return false;
}
floatAt(x, platformY + 1, z, alwaysGlass);

View File

@ -32,6 +32,7 @@ import com.sk89q.worldedit.session.SessionKey;
import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.gamemode.GameMode;
@ -116,22 +117,22 @@ class PlayerProxy extends AbstractPlayerActor {
@Override
public void printRaw(String msg) {
basePlayer.printRaw(msg);
basePlayer.print(TextComponent.of(msg));
}
@Override
public void printDebug(String msg) {
basePlayer.printDebug(msg);
basePlayer.printDebug(TextComponent.of(msg));
}
@Override
public void print(String msg) {
basePlayer.print(msg);
basePlayer.printInfo(TextComponent.of(msg));
}
@Override
public void printError(String msg) {
basePlayer.printError(msg);
basePlayer.printError(TextComponent.of(msg));
}
@Override

View File

@ -12,6 +12,7 @@
"worldedit.biomeinfo.selection.singular": "Biome in your selection: {0}",
"worldedit.biomeinfo.selection.plural": "Biomes in your selection: {0}",
"worldedit.bruch.radius-too-large": "Maximum allowed brush radius: {0}",
"worldedit.brush.apply.description": "Apply brush, apply a function to every block",
"worldedit.brush.apply.radius": "The size of the brush",
"worldedit.brush.apply.shape": "The shape of the region",
@ -58,6 +59,13 @@
"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.watchdog.no-hook": "This platform has no watchdog hook.",
"worldedit.watchdog.already-active": "Watchdog hook already active.",
"worldedit.watchdog.already-inactive": "Watchdog hook already inactive.",
"worldedit.watchdog.now-active": "Watchdog hook now active.",
"worldedit.watchdog.now-inactive": "Watchdog hook now inactive.",
"worldedit.world.remove": "Removed world override.",
"worldedit.world.set": "Set the world override to {0}. (Use //world to go back to default)",
"worldedit.undo.undone": "Undid {0} available edits.",
"worldedit.undo.none": "Nothing left to undo.",
@ -82,6 +90,15 @@
"worldedit.snapshot.use.newest": "Now using newest snapshot.",
"worldedit.schematic.unknown-format": "Unknown schematic format: {0}.",
"worldedit.schematic.load.does-not-exist": "Schematic {0} does not exist!",
"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.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.",
"worldedit.schematic.formats.title": "Available clipboard formats (Name: Lookup names)",
"worldedit.drain.drained.singular": "{0} block has been drained.",
"worldedit.drain.drained.plural": "{0} blocks have been drained.",
"worldedit.fill.created.singular": "{0} block has been filled.",
@ -125,6 +142,39 @@
"worldedit.set.done": "Operation completed.",
"worldedit.set.done.verbose": "Operation completed ({0}).",
"worldedit.line.changed.singular": "{0} block has been changed.",
"worldedit.line.changed.plural": "{0} blocks have been changed.",
"worldedit.line.cuboid-only": "//line only works with cuboid selections",
"worldedit.curve.changed.singular": "{0} block has been changed.",
"worldedit.curve.changed.plural": "{0} blocks have been changed.",
"worldedit.curve.convex-only": "//curve only works with convex polyhedral selections",
"worldedit.replace.replaced.singular": "{0} block has been replaced.",
"worldedit.replace.replaced.plural": "{0} blocks have been replaced.",
"worldedit.stack.changed.singular": "{0} block changed. Undo with //undo",
"worldedit.stack.changed.plural": "{0} blocks changed. Undo with //undo",
"worldedit.regen.regenerated": "Region regenerated.",
"worldedit.walls.changed.singular": "{0} block has been changed.",
"worldedit.walls.changed.plural": "{0} blocks have been changed.",
"worldedit.faces.changed.singular": "{0} block has been changed.",
"worldedit.faces.changed.plural": "{0} blocks have been changed.",
"worldedit.overlay.overlaid.singular": "{0} block has been overlaid.",
"worldedit.overlay.overlaid.plural": "{0} blocks have been overlaid.",
"worldedit.naturalize.naturalized.singular": "{0} block has been made to look more natural.",
"worldedit.naturalize.naturalized.plural": "{0} block(s) have been made to look more natural.",
"worldedit.center.changed.singular": "Center set. ({0} block changed)",
"worldedit.center.changed.plural": "Center set. ({0} blocks changed)",
"worldedit.smooth.changed.singular": "Terrain's height map smoothed. {0} block changed.",
"worldedit.smooth.changed.plural": "Terrain's height map smoothed. {0} blocks changed.",
"worldedit.move.moved.singular": "{0} block moved.",
"worldedit.move.moved.plural": "{0} blocks moved.",
"worldedit.deform.deformed.singular": "{0} block has been deformed.",
"worldedit.deform.deformed.plural": "{0} blocks have been deformed.",
"worldedit.hollow.changed.singular": "{0} block has been changed.",
"worldedit.hollow.changed.plural": "{0} blocks have been changed.",
"worldedit.forest.created.singular": "{0} tree created.",
"worldedit.forest.created.plural": "{0} trees created.",
"worldedit.flora.created.singular": "{0} flora created.",
"worldedit.flora.created.plural": "{0} flora created.",
"worldedit.unstuck.moved": "There you go!",
"worldedit.ascend.obstructed": "No free spot above you found.",
@ -194,5 +244,7 @@
"worldedit.operation.affected.column.plural": "{0} columns affected",
"worldedit.operation.affected.entity.singular": "{0} entity affected",
"worldedit.operation.affected.entity.plural": "{0} entities affected",
"worldedit.operation.deform.expression": "deformed using {0}"
"worldedit.operation.deform.expression": "deformed using {0}",
"worldedit.help.command-not-found": "The command '{0}' could not be found."
}