Skip to content

Commit

Permalink
Translated more strings
Browse files Browse the repository at this point in the history
  • Loading branch information
me4502 committed Jul 7, 2019
1 parent 73eda8f commit 3bca0ea
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import com.sk89q.worldedit.command.util.CommandPermissions;
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
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;
Expand Down Expand Up @@ -67,7 +69,7 @@ public void undo(Player player, LocalSession session,
player.checkPermission("worldedit.history.undo.other");
undoSession = worldEdit.getSessionManager().findByName(playerName);
if (undoSession == null) {
player.printError("Unable to find session for " + playerName);
player.printError(TranslatableComponent.of("worldedit.session.cant-find-session", TextComponent.of(playerName)));
return;
}
}
Expand All @@ -82,9 +84,9 @@ public void undo(Player player, LocalSession session,
}
}
if (timesUndone > 0) {
player.print("Undid " + timesUndone + " available edits.");
player.printInfo(TranslatableComponent.of("worldedit.undo.undone", TextComponent.of(timesUndone)));
} else {
player.printError("Nothing left to undo.");
player.printError(TranslatableComponent.of("worldedit.undo.none"));
}
}

Expand All @@ -105,7 +107,7 @@ public void redo(Player player, LocalSession session,
player.checkPermission("worldedit.history.redo.other");
redoSession = worldEdit.getSessionManager().findByName(playerName);
if (redoSession == null) {
player.printError("Unable to find session for " + playerName);
player.printError(TranslatableComponent.of("worldedit.session.cant-find-session", TextComponent.of(playerName)));
return;
}
}
Expand All @@ -120,9 +122,9 @@ public void redo(Player player, LocalSession session,
}
}
if (timesRedone > 0) {
player.print("Redid " + timesRedone + " available edits.");
player.printInfo(TranslatableComponent.of("worldedit.redo.redid", TextComponent.of(timesRedone)));
} else {
player.printError("Nothing left to redo.");
player.printError(TranslatableComponent.of("worldedit.redo.none"));
}
}

Expand All @@ -134,7 +136,7 @@ public void redo(Player player, LocalSession session,
@CommandPermissions("worldedit.history.clear")
public void clearHistory(Player player, LocalSession session) {
session.clearHistory();
player.print("History cleared.");
player.printInfo(TranslatableComponent.of("worldedit.clearhistory.cleared"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
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;
Expand Down Expand Up @@ -74,7 +75,7 @@ public void list(Player player,
LocalConfiguration config = we.getConfiguration();

if (config.snapshotRepo == null) {
player.printError("Snapshot/backup restore is not configured.");
player.printError(TranslatableComponent.of("worldedit.restore.not-configured"));
return;
}

Expand All @@ -99,7 +100,7 @@ public void list(Player player,
}
}
} catch (MissingWorldException ex) {
player.printError("No snapshots were found for this world.");
player.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
}
}

Expand All @@ -115,7 +116,7 @@ public void use(Player player, LocalSession session,
LocalConfiguration config = we.getConfiguration();

if (config.snapshotRepo == null) {
player.printError("Snapshot/backup restore is not configured.");
player.printError(TranslatableComponent.of("worldedit.restore.not-configured"));
return;
}

Expand All @@ -126,12 +127,12 @@ public void use(Player player, LocalSession session,

if (snapshot != null) {
session.setSnapshot(null);
player.print("Now using newest snapshot.");
player.printInfo(TranslatableComponent.of("worldedit.snapshot.use.newest"));
} else {
player.printError("No snapshots were found.");
player.printError(TranslatableComponent.of("worldedit.restore.none-found"));
}
} catch (MissingWorldException ex) {
player.printError("No snapshots were found for this world.");
player.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
}
} else {
try {
Expand All @@ -154,7 +155,7 @@ public void sel(Player player, LocalSession session,
LocalConfiguration config = we.getConfiguration();

if (config.snapshotRepo == null) {
player.printError("Snapshot/backup restore is not configured.");
player.printError(TranslatableComponent.of("worldedit.restore.not-configured"));
return;
}

Expand All @@ -177,7 +178,7 @@ public void sel(Player player, LocalSession session,
session.setSnapshot(snapshot);
player.print("Snapshot set to: " + snapshot.getName());
} catch (MissingWorldException e) {
player.printError("No snapshots were found for this world.");
player.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
}
}

Expand All @@ -193,7 +194,7 @@ public void before(Player player, LocalSession session,
LocalConfiguration config = we.getConfiguration();

if (config.snapshotRepo == null) {
player.printError("Snapshot/backup restore is not configured.");
player.printError(TranslatableComponent.of("worldedit.restore.not-configured"));
return;
}

Expand All @@ -208,7 +209,7 @@ public void before(Player player, LocalSession session,
player.print("Snapshot set to: " + snapshot.getName());
}
} catch (MissingWorldException ex) {
player.printError("No snapshots were found for this world.");
player.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
}
}

Expand All @@ -224,7 +225,7 @@ public void after(Player player, LocalSession session,
LocalConfiguration config = we.getConfiguration();

if (config.snapshotRepo == null) {
player.printError("Snapshot/backup restore is not configured.");
player.printError(TranslatableComponent.of("worldedit.restore.not-configured"));
return;
}

Expand All @@ -238,7 +239,7 @@ public void after(Player player, LocalSession session,
player.print("Snapshot set to: " + snapshot.getName());
}
} catch (MissingWorldException ex) {
player.printError("No snapshots were found for this world.");
player.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import com.sk89q.worldedit.command.util.Logging;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.DataException;
import com.sk89q.worldedit.world.snapshot.InvalidSnapshotException;
import com.sk89q.worldedit.world.snapshot.Snapshot;
Expand Down Expand Up @@ -67,7 +69,7 @@ public void restore(Player player, LocalSession session, EditSession editSession
LocalConfiguration config = we.getConfiguration();

if (config.snapshotRepo == null) {
player.printError("Snapshot/backup restore is not configured.");
player.printError(TranslatableComponent.of("worldedit.restore.not-configured"));
return;
}

Expand All @@ -78,7 +80,7 @@ public void restore(Player player, LocalSession session, EditSession editSession
try {
snapshot = config.snapshotRepo.getSnapshot(snapshotName);
} catch (InvalidSnapshotException e) {
player.printError("That snapshot does not exist or is not available.");
player.printError(TranslatableComponent.of("worldedit.restore.not-available"));
return;
}
} else {
Expand All @@ -91,7 +93,7 @@ public void restore(Player player, LocalSession session, EditSession editSession
snapshot = config.snapshotRepo.getDefaultSnapshot(player.getWorld().getName());

if (snapshot == null) {
player.printError("No snapshots were found. See console for details.");
player.printError(TranslatableComponent.of("worldedit.restore.none-found-console"));

// Okay, let's toss some debugging information!
File dir = config.snapshotRepo.getDirectory();
Expand All @@ -108,7 +110,7 @@ public void restore(Player player, LocalSession session, EditSession editSession
return;
}
} catch (MissingWorldException ex) {
player.printError("No snapshots were found for this world.");
player.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
return;
}
}
Expand All @@ -118,9 +120,9 @@ public void restore(Player player, LocalSession session, EditSession editSession
// Load chunk store
try {
chunkStore = snapshot.getChunkStore();
player.print("Snapshot '" + snapshot.getName() + "' loaded; now restoring...");
player.printInfo(TranslatableComponent.of("worldedit.restore.loaded", TextComponent.of(snapshot.getName())));
} catch (DataException | IOException e) {
player.printError("Failed to load snapshot: " + e.getMessage());
player.printError(TranslatableComponent.of("worldedit.restore.failed", TextComponent.of(e.getMessage())));
return;
}

Expand All @@ -134,18 +136,17 @@ public void restore(Player player, LocalSession session, EditSession editSession
if (restore.hadTotalFailure()) {
String error = restore.getLastErrorMessage();
if (!restore.getMissingChunks().isEmpty()) {
player.printError("Chunks were not present in snapshot.");
player.printError(TranslatableComponent.of("worldedit.restore.chunk-not-present"));
} else if (error != null) {
player.printError("Errors prevented any blocks from being restored.");
player.printError("Last error: " + error);
player.printError(TranslatableComponent.of("worldedit.restore.block-place-failed"));
player.printError(TranslatableComponent.of("worldedit.restore.block-place-error", TextComponent.of(error)));
} else {
player.printError("No chunks could be loaded. (Bad archive?)");
player.printError(TranslatableComponent.of("worldedit.restore.chunk-load-failed"));
}
} else {
player.print(String.format("Restored; %d "
+ "missing chunks and %d other errors.",
restore.getMissingChunks().size(),
restore.getErrorChunks().size()));
player.printInfo(TranslatableComponent.of("worldedit.restore.restored",
TextComponent.of(restore.getMissingChunks().size()),
TextComponent.of(restore.getErrorChunks().size())));
}
} finally {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ public int butcher(Actor actor,
if (radius == null) {
radius = config.butcherDefaultRadius;
} else if (radius < -1) {
actor.printError("Use -1 to remove all mobs in loaded chunks");
actor.printError(TranslatableComponent.of("worldedit.butcher.explain-all"));
return 0;
} else if (radius == -1) {
if (config.butcherMaxRadius != -1) {
Expand Down Expand Up @@ -437,7 +437,7 @@ public int remove(Actor actor,
Player player = actor instanceof Player ? (Player) actor : null;

if (radius < -1) {
actor.printError("Use -1 to remove all entities in loaded chunks");
actor.printError(TranslatableComponent.of("worldedit.remove.explain-all"));
return 0;
}

Expand Down Expand Up @@ -503,8 +503,7 @@ public void calc(Actor actor,
try {
expression = Expression.compile(String.join(" ", input));
} catch (ExpressionException e) {
actor.printError(String.format(
"'%s' could not be parsed as a valid expression", input));
actor.printError(TranslatableComponent.of("worldedit.calc.invalid", TextComponent.of(String.join(" ", input))));
return;
}
WorldEditAsyncCommandBuilder.createAndSendMessage(actor, () -> {
Expand Down
25 changes: 25 additions & 0 deletions worldedit-core/src/main/resources/lang/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,29 @@
"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.undo.undone": "Undid {0} available edits.",
"worldedit.undo.none": "Nothing left to undo.",
"worldedit.redo.undone": "Redid {0} available edits.",
"worldedit.redo.none": "Nothing left to redo.",
"worldedit.clearhistory.cleared": "History cleared.",

"worldedit.raytrace.noblock": "No block in sight!",

"worldedit.restore.not-configured": "Snapshot/backup restore is not configured.",
"worldedit.restore.not-available": "That snapshot does not exist or is not available.",
"worldedit.restore.failed": "Failed to load snapshot: {0}",
"worldedit.restore.loaded": "Snapshot '{0}' loaded; now restoring...",
"worldedit.restore.restored": "Restored; {0} missing chunks and {1} other errors.",
"worldedit.restore.none-for-world": "No snapshots were found for this world.",
"worldedit.restore.none-found": "No snapshots were found.",
"worldedit.restore.none-found-console": "No snapshots were found. See console for details.",
"worldedit.restore.chunk-not-present": "Chunks were not present in snapshot.",
"worldedit.restore.chunk-load-failed": "No chunks could be loaded. (Bad archive?)",
"worldedit.restore.block-place-failed": "Errors prevented any blocks from being restored.",
"worldedit.restore.block-place-error": "Last error: {0}",

"worldedit.snapshot.use.newest": "Now using newest snapshot.",

"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.",
Expand Down Expand Up @@ -88,8 +109,11 @@
"worldedit.extinguish.removed.plural": "{0} fires have been extinguished.",
"worldedit.butcher.killed.singular": "{0} mob has been killed in a radius of {1}.",
"worldedit.butcher.killed.plural": "{0} mobs have been killed in a radius of {1}.",
"worldedit.butcher.explain-all": "Use -1 to remove all mobs in loaded chunks",
"worldedit.remove.removed.singular": "{0} entity has been marked for removal.",
"worldedit.remove.removed.plural": "{0} entities have been marked for removal.",
"worldedit.remove.explain-all": "Use -1 to remove all entities in loaded chunks",
"worldedit.calc.invalid": "'{0}' could not be parsed as a valid expression",

"worldedit.paste.pasted": "The clipboard has been pasted at {0}",
"worldedit.rotate.no-interpolation": "Note: Interpolation is not yet supported, so angles that are multiples of 90 is recommended.",
Expand Down Expand Up @@ -127,6 +151,7 @@

"worldedit.command.time-elapsed": "{0}s elapsed (history: {1} changed; {2} blocks/sec).",
"worldedit.pastebin.uploading": "(Please wait... sending output to pastebin...)",
"worldedit.session.cant-find-session": "Unable to find session for {0}",

"worldedit.tool.max-block-changes": "Max blocks change limit reached.",
"worldedit.tool.no-block": "No block in sight!",
Expand Down

0 comments on commit 3bca0ea

Please sign in to comment.