Localize more things

This commit is contained in:
Shadowfacts 2021-02-23 22:39:51 -05:00
parent d3a0f279da
commit b283480edf
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
6 changed files with 25 additions and 25 deletions

View File

@ -15,6 +15,7 @@ import net.minecraft.screen.slot.Slot
import net.minecraft.screen.slot.SlotActionType import net.minecraft.screen.slot.SlotActionType
import net.minecraft.text.LiteralText import net.minecraft.text.LiteralText
import net.minecraft.text.Text import net.minecraft.text.Text
import net.minecraft.text.TranslatableText
import net.minecraft.util.Identifier import net.minecraft.util.Identifier
import net.shadowfacts.phycon.PhysicalConnectivity import net.shadowfacts.phycon.PhysicalConnectivity
import net.shadowfacts.phycon.networking.C2STerminalRequestItem import net.shadowfacts.phycon.networking.C2STerminalRequestItem
@ -161,8 +162,7 @@ class TerminalScreen(handler: TerminalScreenHandler, playerInv: PlayerInventory,
override fun drawForeground(matrixStack: MatrixStack, mouseX: Int, mouseY: Int) { override fun drawForeground(matrixStack: MatrixStack, mouseX: Int, mouseY: Int) {
textRenderer.draw(matrixStack, title, 65f, 6f, 0x404040) textRenderer.draw(matrixStack, title, 65f, 6f, 0x404040)
textRenderer.draw(matrixStack, playerInventory.displayName, 65f, backgroundHeight - 94f, 0x404040) textRenderer.draw(matrixStack, playerInventory.displayName, 65f, backgroundHeight - 94f, 0x404040)
// todo: translate this textRenderer.draw(matrixStack, TranslatableText("gui.phycon.terminal_buffer"), 7f, 6f, 0x404040)
textRenderer.draw(matrixStack, "Buffer", 7f, 6f, 0x404040)
} }
override fun drawBackground(matrixStack: MatrixStack, delta: Float, mouseX: Int, mouseY: Int) { override fun drawBackground(matrixStack: MatrixStack, delta: Float, mouseX: Int, mouseY: Int) {

View File

@ -4,12 +4,9 @@ import com.mojang.blaze3d.systems.RenderSystem
import net.minecraft.client.gui.screen.Screen import net.minecraft.client.gui.screen.Screen
import net.minecraft.client.gui.widget.ButtonWidget import net.minecraft.client.gui.widget.ButtonWidget
import net.minecraft.client.util.math.MatrixStack import net.minecraft.client.util.math.MatrixStack
import net.minecraft.text.LiteralText
import net.minecraft.text.Text
import net.shadowfacts.phycon.network.DeviceBlockEntity import net.shadowfacts.phycon.network.DeviceBlockEntity
import net.shadowfacts.phycon.network.component.ActivationController import net.shadowfacts.phycon.network.component.ActivationController
import net.shadowfacts.phycon.networking.C2SConfigureActivationMode import net.shadowfacts.phycon.networking.C2SConfigureActivationMode
import net.shadowfacts.phycon.util.ActivationMode
import net.shadowfacts.phycon.util.next import net.shadowfacts.phycon.util.next
import org.lwjgl.glfw.GLFW import org.lwjgl.glfw.GLFW
@ -66,10 +63,4 @@ class ActivatableDeviceConsoleScreen<T>(
textRenderer.draw(matrixStack, "MAC Address: ${device.macAddress}", minX + 5f, minY + 15f, 0x404040) textRenderer.draw(matrixStack, "MAC Address: ${device.macAddress}", minX + 5f, minY + 15f, 0x404040)
} }
private val ActivationMode.friendlyName: Text
get() = when (this) {
ActivationMode.AUTOMATIC -> LiteralText("Automatic")
ActivationMode.MANAGED -> LiteralText("Managed")
}
} }

View File

@ -1,17 +1,14 @@
package net.shadowfacts.phycon.screen package net.shadowfacts.phycon.screen
import com.mojang.blaze3d.systems.RenderSystem import com.mojang.blaze3d.systems.RenderSystem
import net.minecraft.client.font.TextRenderer
import net.minecraft.client.gui.screen.Screen import net.minecraft.client.gui.screen.Screen
import net.minecraft.client.gui.widget.ButtonWidget import net.minecraft.client.gui.widget.ButtonWidget
import net.minecraft.client.gui.widget.TextFieldWidget import net.minecraft.client.gui.widget.TextFieldWidget
import net.minecraft.client.util.math.MatrixStack import net.minecraft.client.util.math.MatrixStack
import net.minecraft.text.LiteralText import net.minecraft.text.LiteralText
import net.minecraft.text.Text
import net.shadowfacts.phycon.api.util.IPAddress import net.shadowfacts.phycon.api.util.IPAddress
import net.shadowfacts.phycon.network.block.redstone.RedstoneControllerBlockEntity import net.shadowfacts.phycon.network.block.redstone.RedstoneControllerBlockEntity
import net.shadowfacts.phycon.networking.C2SConfigureRedstoneController import net.shadowfacts.phycon.networking.C2SConfigureRedstoneController
import net.shadowfacts.phycon.util.RedstoneMode
import net.shadowfacts.phycon.util.next import net.shadowfacts.phycon.util.next
import org.lwjgl.glfw.GLFW import org.lwjgl.glfw.GLFW
@ -99,13 +96,4 @@ class RedstoneControllerConsoleScreen(
textRenderer.draw(matrixStack, "MAC Address: ${device.macAddress}", minX + 5f, minY + 15f, 0x404040) textRenderer.draw(matrixStack, "MAC Address: ${device.macAddress}", minX + 5f, minY + 15f, 0x404040)
} }
private val RedstoneMode.friendlyName: Text
get() = LiteralText(when (this) {
RedstoneMode.HIGH -> "High"
RedstoneMode.LOW -> "Low"
RedstoneMode.TOGGLE -> "Toggle"
RedstoneMode.RISING_EDGE -> "Rising Edge"
RedstoneMode.FALLING_EDGE -> "Falling Edge"
})
} }

View File

@ -1,9 +1,15 @@
package net.shadowfacts.phycon.util package net.shadowfacts.phycon.util
import net.minecraft.text.Text
import net.minecraft.text.TranslatableText
/** /**
* @author shadowfacts * @author shadowfacts
*/ */
enum class ActivationMode: RotatableEnum { enum class ActivationMode: RotatableEnum {
AUTOMATIC, AUTOMATIC,
MANAGED, MANAGED;
val friendlyName: Text
get() = TranslatableText("gui.phycon.activation_mode.${name.toLowerCase()}")
} }

View File

@ -1,5 +1,8 @@
package net.shadowfacts.phycon.util package net.shadowfacts.phycon.util
import net.minecraft.text.Text
import net.minecraft.text.TranslatableText
/** /**
* @author shadowfacts * @author shadowfacts
*/ */
@ -21,4 +24,7 @@ enum class RedstoneMode: RotatableEnum {
HIGH, LOW -> true HIGH, LOW -> true
else -> false else -> false
} }
val friendlyName: Text
get() = TranslatableText("gui.phycon.redstone_mode.${name.toLowerCase()}")
} }

View File

@ -8,5 +8,14 @@
"block.phycon.redstone_controller": "Redstone Controller", "block.phycon.redstone_controller": "Redstone Controller",
"item.phycon.screwdriver": "Screwdriver", "item.phycon.screwdriver": "Screwdriver",
"item.phycon.console": "Console" "item.phycon.console": "Console",
"gui.phycon.terminal_buffer": "Buffer",
"gui.phycon.redstone_mode.high": "High",
"gui.phycon.redstone_mode.low": "Low",
"gui.phycon.redstone_mode.toggle": "Toggle",
"gui.phycon.redstone_mode.rising_edge": "Rising Edge",
"gui.phycon.redstone_mode.falling_edge": "Falling Edge",
"gui.phycon.activation_mode.automatic": "Automatic",
"gui.phycon.activation_mode.managed": "Managed"
} }