Merge remote-tracking branch 'upstream/feature/translatable-text' into i18n-merge

This commit is contained in:
Jesse Boyd
2019-11-21 13:50:05 +00:00
102 changed files with 1606 additions and 584 deletions

View File

@@ -59,6 +59,7 @@ import com.sk89q.worldedit.util.formatting.component.TextComponentProducer;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
import com.sk89q.worldedit.util.formatting.component.CodeFormat;
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
@@ -246,7 +247,7 @@ public class SchematicCommands {
}
file = actor.openFileOpenDialog(extensions);
if (file == null || !file.exists()) {
actor.printError("Schematic " + filename + " does not exist! (" + file + ")");
actor.printError(TranslatableComponent.of("worldedit.schematic.load.does-not-exist", TextComponent.of(filename)));
return;
}
} else {
@@ -273,7 +274,7 @@ public class SchematicCommands {
if (format == null) {
format = ClipboardFormats.findByFile(file);
if (format == null) {
BBC.CLIPBOARD_INVALID_FORMAT.send(actor, file.getName());
actor.printError(TranslatableComponent.of("worldedit.schematic.unknown-format", TextComponent.of(formatName)));
return;
}
}
@@ -322,7 +323,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;
}
@@ -353,7 +354,7 @@ public class SchematicCommands {
}
}
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;
}
}
@@ -362,8 +363,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"));
}
}
@@ -372,7 +373,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());
@@ -449,7 +450,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()) {
@@ -463,7 +464,7 @@ public class SchematicCommands {
first = false;
}
first = true;
actor.print(builder.toString());
actor.printInfo(TextComponent.of(builder.toString()));
}
}