Localized GUI Strings

This commit is contained in:
CrushedPixel
2015-04-26 14:32:33 +02:00
parent 79be2bd0d5
commit 60a9541c16
13 changed files with 178 additions and 88 deletions

View File

@@ -8,6 +8,7 @@ import eu.crushedpixel.replaymod.gui.elements.listeners.SelectionListener;
import eu.crushedpixel.replaymod.utils.ReplayFileIO;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.resources.I18n;
import org.apache.commons.io.FilenameUtils;
import java.awt.*;
@@ -18,8 +19,8 @@ import java.util.List;
public class GuiConnectPart extends GuiStudioPart {
private static final String DESCRIPTION = "Connects multiple Replays in the same order as the list.";
private static final String TITLE = "Connect Replays";
private final String DESCRIPTION = I18n.format("replaymod.gui.editor.connect.description");
private final String TITLE = I18n.format("replaymod.gui.editor.connect.title");
private boolean initialized = false;
@@ -60,7 +61,7 @@ public class GuiConnectPart extends GuiStudioPart {
if(!initialized) {
concatList = new GuiEntryList(1, fontRendererObj, 30, yPos, 150, 0);
filesToConcat = new ArrayList<String>();
String selectedName = FilenameUtils.getBaseName(GuiReplayStudio.instance.getSelectedFile().getAbsolutePath());
String selectedName = FilenameUtils.getBaseName(GuiReplayEditor.instance.getSelectedFile().getAbsolutePath());
filesToConcat.add(selectedName);
concatList.setElements(filesToConcat);
@@ -88,7 +89,7 @@ public class GuiConnectPart extends GuiStudioPart {
@Override
public void onSelectionChanged(int selectionIndex) {
try {
filesToConcat.set(concatList.getSelectionIndex(), (String) replayDropdown.getElement(selectionIndex));
filesToConcat.set(concatList.getSelectionIndex(), replayDropdown.getElement(selectionIndex));
concatList.setElements(filesToConcat);
} catch(Exception e) {
} //Sorry, too lazy to properly avoid this Exception here
@@ -120,26 +121,26 @@ public class GuiConnectPart extends GuiStudioPart {
downButton = new GuiArrowButton(GuiConstants.REPLAY_EDITOR_DOWN_BUTTON, 219, yPos + 40, "", false);
buttonList.add(downButton);
int w = GuiReplayStudio.instance.width - 243 - 20 - 4;
int w = GuiReplayEditor.instance.width - 243 - 20 - 4;
removeButton = new GuiButton(GuiConstants.REPLAY_EDITOR_REMOVE_BUTTON, 249, yPos + 40, "Remove");
removeButton = new GuiButton(GuiConstants.REPLAY_EDITOR_REMOVE_BUTTON, 249, yPos + 40, I18n.format("replaymod.gui.remove"));
buttonList.add(removeButton);
addButton = new GuiButton(GuiConstants.REPLAY_EDITOR_ADD_BUTTON, 0, yPos + 40, "Add");
addButton = new GuiButton(GuiConstants.REPLAY_EDITOR_ADD_BUTTON, 0, yPos + 40, I18n.format("replaymod.gui.add"));
buttonList.add(addButton);
concatList.setSelectionIndex(0);
}
int w = GuiReplayStudio.instance.width - 249 - 20 - 4;
int w = GuiReplayEditor.instance.width - 249 - 20 - 4;
addButton.xPosition = 249 + 6 + (w / 2);
addButton.width = w / 2 + 2;
removeButton.width = w / 2 + 2;
replayDropdown.width = GuiReplayStudio.instance.width - 250 - 18;
replayDropdown.width = GuiReplayEditor.instance.width - 250 - 18;
int h = GuiReplayStudio.instance.height - yPos - 20;
int h = GuiReplayEditor.instance.height - yPos - 20;
int rows = (int) (h / (float) GuiEntryList.elementHeight);
concatList.setVisibleElements(rows);
@@ -159,7 +160,7 @@ public class GuiConnectPart extends GuiStudioPart {
concatList.drawTextBox();
replayDropdown.drawTextBox();
drawString(fontRendererObj, "Replay:", 200, yPos + 5 + 7, Color.WHITE.getRGB());
drawString(fontRendererObj, I18n.format("replaymod.gui.replay")+":", 200, yPos + 5 + 7, Color.WHITE.getRGB());
}
@Override

View File

@@ -6,6 +6,7 @@ import eu.crushedpixel.replaymod.utils.ReplayFileIO;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiMainMenu;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
import org.apache.commons.io.FilenameUtils;
import java.awt.*;
@@ -14,10 +15,10 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class GuiReplayStudio extends GuiScreen {
public class GuiReplayEditor extends GuiScreen {
private static final int tabYPos = 110;
public static GuiReplayStudio instance = null;
public static GuiReplayEditor instance = null;
private StudioTab currentTab = StudioTab.TRIM;
private GuiDropdown replayDropdown;
private GuiButton saveModeButton, saveButton;
@@ -25,7 +26,7 @@ public class GuiReplayStudio extends GuiScreen {
private boolean initialized = false;
private List<File> replayFiles = new ArrayList<File>();
public GuiReplayStudio() {
public GuiReplayEditor() {
instance = this;
}
@@ -50,9 +51,9 @@ public class GuiReplayStudio extends GuiScreen {
public void initGui() {
List<GuiButton> tabButtons = new ArrayList<GuiButton>();
tabButtons.add(new GuiButton(GuiConstants.REPLAY_EDITOR_TRIM_TAB, 0, 0, "Trim Replay"));
tabButtons.add(new GuiButton(GuiConstants.REPLAY_EDITOR_CONNECT_TAB, 0, 0, "Connect Replays"));
tabButtons.add(new GuiButton(GuiConstants.REPLAY_EDITOR_MODIFY_TAB, 0, 0, "Modify Replay"));
tabButtons.add(new GuiButton(GuiConstants.REPLAY_EDITOR_TRIM_TAB, 0, 0, I18n.format("replaymod.gui.editor.trim.title")));
tabButtons.add(new GuiButton(GuiConstants.REPLAY_EDITOR_CONNECT_TAB, 0, 0, I18n.format("replaymod.gui.editor.connect.title")));
tabButtons.add(new GuiButton(GuiConstants.REPLAY_EDITOR_MODIFY_TAB, 0, 0, I18n.format("replaymod.gui.editor.modify.title")));
int w = this.width - 30;
int w2 = w / tabButtons.size();
@@ -86,11 +87,11 @@ public class GuiReplayStudio extends GuiScreen {
buttonList.add(saveModeButton);
GuiButton backButton = new GuiButton(GuiConstants.REPLAY_EDITOR_BACK_BUTTON, width - 70 - 18, height - 20 - 5, "Back");
GuiButton backButton = new GuiButton(GuiConstants.REPLAY_EDITOR_BACK_BUTTON, width - 70 - 18, height - 20 - 5, I18n.format("replaymod.gui.back"));
backButton.width = 70;
buttonList.add(backButton);
saveButton = new GuiButton(GuiConstants.REPLAY_EDITOR_SAVE_BUTTON, width - 70 - 18, height - (2 * 20) - 5 - 3, "Save");
saveButton = new GuiButton(GuiConstants.REPLAY_EDITOR_SAVE_BUTTON, width - 70 - 18, height - (2 * 20) - 5 - 3, I18n.format("replaymod.gui.save"));
saveButton.width = 70;
buttonList.add(saveButton);
@@ -102,7 +103,7 @@ public class GuiReplayStudio extends GuiScreen {
}
private String getSaveModeLabel() {
return overrideSave ? "Replace Source File" : "Save to new File";
return overrideSave ? I18n.format("replaymod.gui.editor.savemode.override") : I18n.format("replaymod.gui.editor.savemode.newfile");
}
;
@@ -182,8 +183,8 @@ public class GuiReplayStudio extends GuiScreen {
i++;
}
drawCenteredString(fontRendererObj, "Replay Studio", this.width / 2, 10, 16777215);
drawString(fontRendererObj, "Replay File:", 30, 67, Color.WHITE.getRGB());
drawCenteredString(fontRendererObj, I18n.format("replaymod.gui.replayeditor"), this.width / 2, 10, 16777215);
drawString(fontRendererObj, I18n.format("replaymod.gui.editor.replayfile"), 30, 67, Color.WHITE.getRGB());
replayDropdown.drawTextBox();
}

View File

@@ -3,6 +3,7 @@ package eu.crushedpixel.replaymod.gui.replaystudio;
import eu.crushedpixel.replaymod.gui.elements.GuiNumberInput;
import eu.crushedpixel.replaymod.studio.StudioImplementation;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import org.lwjgl.input.Keyboard;
import java.awt.*;
@@ -12,8 +13,8 @@ import java.util.List;
public class GuiTrimPart extends GuiStudioPart {
private static final String DESCRIPTION = "Removes the beginning and end of a Replay File and only keeps the Replay between the given timestamps.";
private static final String TITLE = "Trim Replay";
private static final String DESCRIPTION = I18n.format("replaymod.gui.editor.trim.description");
private final String TITLE = I18n.format("replaymod.gui.editor.trim.title");
private Minecraft mc = Minecraft.getMinecraft();
private boolean initialized = false;
@@ -103,8 +104,8 @@ public class GuiTrimPart extends GuiStudioPart {
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
drawString(mc.fontRendererObj, "Start:", 30, yPos + 7, Color.WHITE.getRGB());
drawString(mc.fontRendererObj, "End:", 30, yPos + 7 + 30, Color.WHITE.getRGB());
drawString(mc.fontRendererObj, I18n.format("replaymod.gui.start")+":", 30, yPos + 7, Color.WHITE.getRGB());
drawString(mc.fontRendererObj, I18n.format("replaymod.gui.end")+":", 30, yPos + 7 + 30, Color.WHITE.getRGB());
drawString(mc.fontRendererObj, "m", 105, yPos + 7, Color.WHITE.getRGB());
drawString(mc.fontRendererObj, "m", 105, yPos + 7 + 30, Color.WHITE.getRGB());
drawString(mc.fontRendererObj, "s", 150, yPos + 7, Color.WHITE.getRGB());