Skip to content

Commit

Permalink
Add various missing translation entries (#6777)
Browse files Browse the repository at this point in the history
  • Loading branch information
62832 committed Nov 20, 2022
1 parent ed44d60 commit 7bfe55f
Show file tree
Hide file tree
Showing 16 changed files with 107 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import appeng.client.gui.widgets.ServerSettingToggleButton;
import appeng.client.gui.widgets.SettingToggleButton;
import appeng.core.definitions.AEItems;
import appeng.core.localization.ButtonToolTips;
import appeng.menu.SlotSemantics;
import appeng.menu.implementations.InterfaceMenu;

Expand All @@ -58,7 +59,7 @@ public InterfaceScreen(InterfaceMenu menu, Inventory playerInventory, Component
menu.openSetAmountMenu(configSlot.slot);
});
button.setDisableBackground(true);
button.setMessage(Component.literal("Set amount to stock"));
button.setMessage(ButtonToolTips.InterfaceSetStockAmount.text());
widgets.add("amtButton" + (1 + i), button);
amountButtons.add(button);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ protected void renderGridInventoryEntryTooltip(PoseStack poseStack, GridInventor

if (Minecraft.getInstance().options.advancedItemTooltips) {
currentToolTip
.add(Component.literal("Serial: " + entry.getSerial()).withStyle(ChatFormatting.DARK_GRAY));
.add(ButtonToolTips.Serial.text(entry.getSerial()).withStyle(ChatFormatting.DARK_GRAY));
}

// Special case to support the Item API of visual tooltip components
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import appeng.client.gui.style.ScreenStyle;
import appeng.core.definitions.AEParts;
import appeng.core.localization.ButtonToolTips;
import appeng.core.localization.GuiText;
import appeng.core.localization.Tooltips;
import appeng.menu.me.crafting.CraftingStatusMenu;

Expand Down Expand Up @@ -254,6 +255,6 @@ private String formatStorage(CraftingStatusMenu.CraftingCpuListEntry cpu) {
}

private Component getCpuName(CraftingStatusMenu.CraftingCpuListEntry cpu) {
return cpu.name() != null ? cpu.name() : Component.literal("CPU #" + cpu.serial());
return cpu.name() != null ? cpu.name() : GuiText.CPUs.text().append(String.format(" #%d", cpu.serial()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ private void validate() {
if (possibleValue.isPresent()) {
// Reject decimal values if the unit is integral
if (type.amountPerUnit() == 1 && possibleValue.get().scale() > 0) {
validationErrors.add(Component.literal("Must be whole number"));
validationErrors.add(GuiText.NumberNonInteger.text());
} else {
var value = convertToExternalValue(possibleValue.get());
if (value < minValue) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ public List<Component> getTooltipMessage() {

var buttonAppearance = appearances.get(new EnumPair<>(this.buttonSetting, this.currentValue));
if (buttonAppearance == null) {
return Collections.singletonList(Component.literal("No Such Message"));
return Collections.singletonList(ButtonToolTips.NoSuchMessage.text());
}

return buttonAppearance.tooltipLines;
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/appeng/core/localization/ButtonToolTips.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public enum ButtonToolTips implements LocalizationEnum {
IOMode("Input/Output Mode"),
InterfaceBlockingMode("Blocking Mode"),
InterfaceCraftingMode("Crafting Mode"),
InterfaceSetStockAmount("Set amount to stock"),
InterfaceTerminalDisplayMode("Display Mode"),
InventoryTweaks("Inventory Tweaks"),
ItemName("Item name"),
Expand All @@ -92,6 +93,7 @@ public enum ButtonToolTips implements LocalizationEnum {
MoveWhenFull("Move to output when full."),
MoveWhenWorkIsDone("Move to output when work is done."),
NonBlocking("Ignore the contents of the target inventory."),
NoSuchMessage("No Such Message"),
NumberOfItems("Number of items"),
Off("Off"),
On("On"),
Expand All @@ -117,6 +119,7 @@ public enum ButtonToolTips implements LocalizationEnum {
SchedulingModeRandom("Export items in random mode."),
SchedulingModeRoundRobin("Export using round robin mode."),
SearchSettingsTooltip("Show Search Settings"),
Serial("Serial: %d"),
Singularity("Condense Into Singularities\n%s per item"),
ShowAll("Show All"),
ShowAllProviders("Show all Pattern Providers"),
Expand Down Expand Up @@ -160,6 +163,7 @@ public enum ButtonToolTips implements LocalizationEnum {
LeftClick("Left-Click"),
MiddleClick("Middle-Click"),
RightClick("Right-Click"),
MouseButton("Mouse %d"),
StoreAction("%s: Store %s"),
SetAction("%s: Set %s"),
ModifyAmountAction("%s: Modify Amount"),
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/appeng/core/localization/GuiText.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public enum GuiText implements LocalizationEnum {
And("and"),
Or("or"),
AttachedTo("Attached to: %s"),
AutoCrafting("Auto-Crafting"),
Automatic("Automatic"),
Black("Black"),
Blank("Blank"),
Expand Down Expand Up @@ -140,6 +141,7 @@ public enum GuiText implements LocalizationEnum {
NotSoMysteriousQuote("\"So far, no matter how close.\""),
NumberGreaterThanMaxValue("Please enter a number less than or equal to %s"),
NumberLessThanMinValue("Please enter a number greater than or equal to %s"),
NumberNonInteger("Must be whole number"),
OCTunnel("OpenComputers"),
Of("of"),
OfSecondOutput("%1$d%% Chance for second output."),
Expand Down
35 changes: 34 additions & 1 deletion src/main/java/appeng/core/localization/PlayerMessages.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,60 @@
public enum PlayerMessages implements LocalizationEnum {
AmmoDepleted("Ammo Depleted."),
ChestCannotReadStorageCell("ME Chest cannot read storage cell."),
ChannelModeSet("Channel mode set to %s. Updated %d grids."),
ChannelModeCurrent("Current channel mode: %s"),
ClickToShowDetails("Click to show details"),
ClickToTeleport("Click to teleport into plot"),
CommunicationError("Error Communicating with Network."),
DeviceNotLinked("Device is not linked."),
DeviceNotPowered("Device is low on power."),
MissingBlankPatterns("Not enough blank pattern to restore patterns (missing %d)."),
MissingUpgrades("Not enough %s to restore upgrades (missing %d)."),
InvalidMachine("Could not restore configuration for an incompatible device."),
InvalidMachinePartiallyRestored("Partially restored configuration for an incompatible device: %s."),
LastTransition("Last Transition:"),
LastTransitionUnknown("Last Transition unknown"),
LoadedSettings("Loaded device configuration from memory card."),
MachineNotPowered("Machine is not powered."),
MinecraftProfile("Minecraft profile (%s)"),
NoLastTransition("This plot doesn't have a last known transition."),
NoSpatialIOLevel("The spatial I/O level is missing: %s"),
NoSpatialIOPlots("There are no spatial I/O plots."),
NotStorageCell("Storage cell items don't implement the storage cell interface!"),
NotInSpatialStorageLevel("Must be within the spatial storage level."),
Origin("Origin"),
OutOfRange("Wireless Out Of Range."),
Owner("Owner"),
PlayerConnected("%s [Connected]"),
PlayerDisconnected("%s [Disconnected]"),
PlotID("Plot ID"),
PlotNotFound("Plot not found: %d"),
PlotNotFoundForCurrentPosition("Couldn't find a plot for the current position."),
Plot("Plot"),
RegionFile("Region file"),
ResetSettings("New device configuration created and copied to memory card."),
SavedSettings("Copied current device configuration to memory card."),
SettingCleared("Memory card cleared."),
Size("Size"),
Source("Source"),
SourceLink("%s - %s to %s"),
StationCanNotBeLocated("Station can not be located."),
Unknown("Unknown"),
UnknownAE2Player("Unknown AE2 Player (%s)"),
When("When"),
TestWorldNotInCreativeMode("Command can only be used in creative mode."),
TestWorldNotInSuperflatVoid("A test world can only be set up in a Superflat world with the Void preset!"),
TestWorldSetupComplete("Test world setup completed in %s"),
TestWorldSetupFailed("Setting up the test world failed: %s"),
CompassTestSection("Section [y=%d-%d] %d: %b"),
isNowLocked("Monitor is now Locked."),
isNowUnlocked("Monitor is now Unlocked."),
OnlyEmptyCellsCanBeDisassembled("Only empty storage cells can be disassembled."),
UnsupportedUpgrade("This upgrade is not supported by this machine."),
MaxUpgradesOfTypeInstalled("No further upgrade cards of this type can be installed."),
MaxUpgradesInstalled("The upgrade capacity of this machine has been reached."),
UnknownHotkey("Unknown Hotkey: ");
UnknownHotkey("Unknown Hotkey: "),
SpecialThanks("Special thanks to %s");

private final String englishText;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/appeng/core/localization/Tooltips.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public static Component getMouseButtonText(int button) {
case InputConstants.MOUSE_BUTTON_LEFT -> ButtonToolTips.LeftClick.text();
case InputConstants.MOUSE_BUTTON_RIGHT -> ButtonToolTips.RightClick.text();
case InputConstants.MOUSE_BUTTON_MIDDLE -> ButtonToolTips.MiddleClick.text();
default -> Component.literal("Mouse " + button);
default -> ButtonToolTips.MouseButton.text(button);
};
}

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/appeng/helpers/iface/PatternProviderLogic.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
import appeng.api.util.IConfigManager;
import appeng.core.AELog;
import appeng.core.definitions.AEItems;
import appeng.core.localization.GuiText;
import appeng.core.localization.PlayerMessages;
import appeng.core.settings.TickRates;
import appeng.helpers.ICustomNameObject;
Expand Down Expand Up @@ -586,7 +587,7 @@ public Component getTermName() {
}
}

return Component.literal("Nothing");
return GuiText.Nothing.text();
}

public long getSortValue() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import appeng.api.storage.IStorageMounts;
import appeng.api.storage.IStorageProvider;
import appeng.api.storage.MEStorage;
import appeng.core.localization.GuiText;
import appeng.me.service.CraftingService;

/**
Expand All @@ -51,7 +52,7 @@ public long insert(AEKey what, long amount, Actionable mode, IActionSource sourc

@Override
public Component getDescription() {
return Component.literal("Auto-Crafting");
return GuiText.AutoCrafting.text();
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.core.BlockPos;
import net.minecraft.core.SectionPos;
import net.minecraft.network.chat.Component;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.level.ChunkPos;

import appeng.core.localization.PlayerMessages;
import appeng.server.ISubCommand;

public class TestCompassCommand implements ISubCommand {
Expand All @@ -40,9 +40,7 @@ public void call(MinecraftServer srv, CommandContext<CommandSourceStack> ctx, Co
var hasSkyStone = compassRegion.hasSkyStone(chunkPos.x, chunkPos.z, i);
var yMin = i * SectionPos.SECTION_SIZE;
var yMax = (i + 1) * SectionPos.SECTION_SIZE - 1;
sender.sendSuccess(
Component.literal("Section [y=" + yMin + "-" + yMax + "] " + i + ": " + hasSkyStone),
false);
sender.sendSuccess(PlayerMessages.CompassTestSection.text(yMin, yMax, i, hasSkyStone), false);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
import com.mojang.brigadier.context.CommandContext;

import net.minecraft.commands.CommandSourceStack;
import net.minecraft.network.chat.Component;
import net.minecraft.server.MinecraftServer;

import appeng.api.networking.pathing.ChannelMode;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.localization.PlayerMessages;
import appeng.hooks.ticking.TickHandler;
import appeng.me.Grid;
import appeng.server.ISubCommand;
Expand All @@ -35,9 +35,7 @@ public void addArguments(LiteralArgumentBuilder<CommandSourceStack> builder) {
@Override
public void call(MinecraftServer srv, CommandContext<CommandSourceStack> ctx, CommandSourceStack sender) {
var mode = AEConfig.instance().getChannelMode();
sender.sendSuccess(
Component.literal("Current channel mode: " + mode.name().toLowerCase(Locale.ROOT)),
true);
sender.sendSuccess(PlayerMessages.ChannelModeCurrent.text(mode.name().toLowerCase(Locale.ROOT)), true);
}

private void setChannelMode(CommandContext<CommandSourceStack> ctx, ChannelMode mode) {
Expand All @@ -53,7 +51,6 @@ private void setChannelMode(CommandContext<CommandSourceStack> ctx, ChannelMode
}

var modeName = mode.name().toLowerCase(Locale.ROOT);
ctx.getSource().sendSuccess(Component.literal("Channel mode set to " + modeName
+ ". Updated " + gridCount + " grids."), true);
ctx.getSource().sendSuccess(PlayerMessages.ChannelModeSet.text(modeName, gridCount), true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

import net.minecraft.commands.CommandSourceStack;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
Expand All @@ -23,6 +22,7 @@

import appeng.core.AELog;
import appeng.core.definitions.AEItems;
import appeng.core.localization.PlayerMessages;
import appeng.items.tools.powered.ColorApplicatorItem;
import appeng.server.ISubCommand;
import appeng.server.testplots.TestPlots;
Expand Down Expand Up @@ -53,14 +53,13 @@ private void setupTestWorld(MinecraftServer srv, CommandSourceStack sender, @Nul
try {
var player = sender.getPlayerOrException();
if (!player.isCreative()) {
sender.sendFailure(Component.literal("Command can only be used in creative mode."));
sender.sendFailure(PlayerMessages.TestWorldNotInCreativeMode.text());
return;
}

var level = srv.overworld();
if (!isVoidWorld(level)) {
sender.sendFailure(Component.literal(
"A test world can only be set up in a Superflat world with the Void preset!"));
sender.sendFailure(PlayerMessages.TestWorldNotInSuperflatVoid.text());
return;
}

Expand All @@ -81,10 +80,10 @@ private void setupTestWorld(MinecraftServer srv, CommandSourceStack sender, @Nul
player.teleportTo(level, goodStartPos.getX(), goodStartPos.getY(), goodStartPos.getZ(), 0, 0);
}

sender.sendSuccess(Component.literal("Test world setup completed in " + sw), true);
sender.sendSuccess(PlayerMessages.TestWorldSetupComplete.text(sw), true);
} catch (RuntimeException | CommandSyntaxException e) {
AELog.error(e);
sender.sendFailure(Component.literal("Setting up the test world failed: " + e));
sender.sendFailure(PlayerMessages.TestWorldSetupFailed.text(e));
}
}

Expand Down

0 comments on commit 7bfe55f

Please sign in to comment.