Started localizing the Chat Messages and GUI
This commit is contained in:
@@ -7,6 +7,7 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.awt.*;
|
||||
@@ -25,8 +26,6 @@ public class GuiLoginPrompt extends GuiScreen {
|
||||
private PasswordTextField password;
|
||||
private GuiButton loginButton;
|
||||
private GuiButton cancelButton;
|
||||
private int lastMouseX, lastMouseY;
|
||||
private float lastPartialTicks;
|
||||
|
||||
public GuiLoginPrompt(GuiScreen parent, GuiScreen successScreen) {
|
||||
this.parent = parent;
|
||||
@@ -45,12 +44,12 @@ public class GuiLoginPrompt extends GuiScreen {
|
||||
password.setEnabled(true);
|
||||
password.setFocused(false);
|
||||
|
||||
loginButton = new GuiButton(GuiConstants.LOGIN_OKAY_BUTTON, this.width / 2 - 150 - 2, 110, "Login");
|
||||
loginButton = new GuiButton(GuiConstants.LOGIN_OKAY_BUTTON, this.width / 2 - 150 - 2, 110, I18n.format("replaymod.gui.login"));
|
||||
loginButton.width = 150;
|
||||
loginButton.enabled = false;
|
||||
buttonList.add(loginButton);
|
||||
|
||||
cancelButton = new GuiButton(GuiConstants.LOGIN_CANCEL_BUTTON, this.width / 2 + 2, 110, "Cancel");
|
||||
cancelButton = new GuiButton(GuiConstants.LOGIN_CANCEL_BUTTON, this.width / 2 + 2, 110, I18n.format("replaymod.gui.cancel"));
|
||||
cancelButton.width = 150;
|
||||
buttonList.add(cancelButton);
|
||||
}
|
||||
@@ -92,28 +91,24 @@ public class GuiLoginPrompt extends GuiScreen {
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
lastMouseX = mouseX;
|
||||
lastMouseY = mouseY;
|
||||
lastPartialTicks = partialTicks;
|
||||
|
||||
this.drawDefaultBackground();
|
||||
drawCenteredString(fontRendererObj, "Login to ReplayMod.com", this.width / 2, 10, Color.WHITE.getRGB());
|
||||
drawCenteredString(fontRendererObj, I18n.format("replaymod.gui.login.title"), this.width / 2, 10, Color.WHITE.getRGB());
|
||||
|
||||
drawString(fontRendererObj, "Username", this.width / 2 - 100, 37, Color.WHITE.getRGB());
|
||||
drawString(fontRendererObj, I18n.format("replaymod.gui.username"), this.width / 2 - 100, 37, Color.WHITE.getRGB());
|
||||
username.drawTextBox();
|
||||
|
||||
drawString(fontRendererObj, "Password", this.width / 2 - 100, 67, Color.WHITE.getRGB());
|
||||
drawString(fontRendererObj, I18n.format("replaymod.gui.password"), this.width / 2 - 100, 67, Color.WHITE.getRGB());
|
||||
password.drawTextBox();
|
||||
|
||||
switch(textState) {
|
||||
case INVALID_LOGIN:
|
||||
drawCenteredString(fontRendererObj, "Incorrect username or password.", this.width / 2, 92, Color.RED.getRGB());
|
||||
drawCenteredString(fontRendererObj, I18n.format("replaymod.gui.login.incorrect"), this.width / 2, 92, Color.RED.getRGB());
|
||||
break;
|
||||
case LOGGING_IN:
|
||||
drawCenteredString(fontRendererObj, "Logging in...", this.width / 2, 92, Color.WHITE.getRGB());
|
||||
drawCenteredString(fontRendererObj, I18n.format("replaymod.gui.login.logging"), this.width / 2, 92, Color.WHITE.getRGB());
|
||||
break;
|
||||
case NO_CONNECTION:
|
||||
drawCenteredString(fontRendererObj, "Could not connect to ReplayMod.com", this.width / 2, 92, Color.RED.getRGB());
|
||||
drawCenteredString(fontRendererObj, I18n.format("replaymod.gui.login.connectionerror"), this.width / 2, 92, Color.RED.getRGB());
|
||||
break;
|
||||
}
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
|
||||
@@ -33,8 +33,9 @@ public class GuiReplayCenter extends GuiScreen implements GuiYesNoCallback {
|
||||
private SearchPagination myFilePagination;
|
||||
|
||||
public static GuiYesNo getYesNoGui(GuiYesNoCallback p_152129_0_, int p_152129_2_) {
|
||||
String s1 = I18n.format("Do you really want to log out?", new Object[0]);
|
||||
GuiYesNo guiyesno = new GuiYesNo(p_152129_0_, s1, "", "Logout", "Cancel", p_152129_2_);
|
||||
String s1 = I18n.format("replaymod.gui.center.logoutcallback");
|
||||
GuiYesNo guiyesno = new GuiYesNo(p_152129_0_, s1, "", I18n.format("replaymod.gui.logout"),
|
||||
I18n.format("replaymod.gui.cancel"), p_152129_2_);
|
||||
return guiyesno;
|
||||
}
|
||||
|
||||
@@ -52,17 +53,17 @@ public class GuiReplayCenter extends GuiScreen implements GuiYesNoCallback {
|
||||
//Top Button Bar
|
||||
List<GuiButton> buttonBar = new ArrayList<GuiButton>();
|
||||
|
||||
GuiButton recentButton = new GuiButton(GuiConstants.CENTER_RECENT_BUTTON, 20, 30, "Newest Replays");
|
||||
GuiButton recentButton = new GuiButton(GuiConstants.CENTER_RECENT_BUTTON, 20, 30, I18n.format("replaymod.gui.center.newest"));
|
||||
buttonBar.add(recentButton);
|
||||
|
||||
GuiButton bestButton = new GuiButton(GuiConstants.CENTER_BEST_BUTTON, 20, 30, "Best Replays");
|
||||
GuiButton bestButton = new GuiButton(GuiConstants.CENTER_BEST_BUTTON, 20, 30, I18n.format("replaymod.gui.center.best"));
|
||||
buttonBar.add(bestButton);
|
||||
|
||||
GuiButton ownReplayButton = new GuiButton(GuiConstants.CENTER_MY_REPLAYS_BUTTON, 20, 30, "My Replays");
|
||||
GuiButton ownReplayButton = new GuiButton(GuiConstants.CENTER_MY_REPLAYS_BUTTON, 20, 30, I18n.format("replaymod.gui.center.my"));
|
||||
ownReplayButton.enabled = AuthenticationHandler.isAuthenticated();
|
||||
buttonBar.add(ownReplayButton);
|
||||
|
||||
GuiButton searchButton = new GuiButton(GuiConstants.CENTER_SEARCH_BUTTON, 20, 30, "Search");
|
||||
GuiButton searchButton = new GuiButton(GuiConstants.CENTER_SEARCH_BUTTON, 20, 30, I18n.format("replaymod.gui.center.search"));
|
||||
buttonBar.add(searchButton);
|
||||
|
||||
int i = 0;
|
||||
@@ -83,13 +84,13 @@ public class GuiReplayCenter extends GuiScreen implements GuiYesNoCallback {
|
||||
//Bottom Button Bar (dat alliteration)
|
||||
List<GuiButton> bottomBar = new ArrayList<GuiButton>();
|
||||
|
||||
GuiButton exitButton = new GuiButton(GuiConstants.CENTER_BACK_BUTTON, 20, 20, "Main Menu");
|
||||
GuiButton exitButton = new GuiButton(GuiConstants.CENTER_BACK_BUTTON, 20, 20, I18n.format("replaymod.gui.mainmenu"));
|
||||
bottomBar.add(exitButton);
|
||||
|
||||
GuiButton managerButton = new GuiButton(GuiConstants.CENTER_MANAGER_BUTTON, 20, 20, "Replay Viewer");
|
||||
GuiButton managerButton = new GuiButton(GuiConstants.CENTER_MANAGER_BUTTON, 20, 20, I18n.format("replaymod.gui.replayviewer"));
|
||||
bottomBar.add(managerButton);
|
||||
|
||||
GuiButton logoutButton = new GuiButton(GuiConstants.CENTER_LOGOUT_BUTTON, 20, 20, "Logout");
|
||||
GuiButton logoutButton = new GuiButton(GuiConstants.CENTER_LOGOUT_BUTTON, 20, 20, I18n.format("replaymod.gui.logout"));
|
||||
bottomBar.add(logoutButton);
|
||||
|
||||
i = 0;
|
||||
@@ -150,7 +151,7 @@ public class GuiReplayCenter extends GuiScreen implements GuiYesNoCallback {
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
this.drawDefaultBackground();
|
||||
this.drawCenteredString(fontRendererObj, "Replay Center", this.width / 2, 8, Color.WHITE.getRGB());
|
||||
this.drawCenteredString(fontRendererObj, I18n.format("replaymod.gui.replaycenter"), this.width / 2, 8, Color.WHITE.getRGB());
|
||||
|
||||
if(currentList != null) {
|
||||
currentList.drawScreen(mouseX, mouseY, partialTicks);
|
||||
|
||||
@@ -18,10 +18,13 @@ import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.client.renderer.texture.DynamicTexture;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
|
||||
import org.apache.commons.compress.archivers.zip.ZipFile;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
@@ -50,6 +53,8 @@ public class GuiUploadFile extends GuiScreen {
|
||||
private Minecraft mc = Minecraft.getMinecraft();
|
||||
private GuiReplayViewer parent;
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
public GuiUploadFile(File file, GuiReplayViewer parent) {
|
||||
this.parent = parent;
|
||||
|
||||
@@ -98,7 +103,7 @@ public class GuiUploadFile extends GuiScreen {
|
||||
}
|
||||
|
||||
if(!correctFile) {
|
||||
System.out.println("Invalid file provided to upload");
|
||||
logger.error("Invalid file provided to upload");
|
||||
mc.displayGuiScreen(parent); //TODO: Error message
|
||||
replayFile = null;
|
||||
return;
|
||||
@@ -131,7 +136,7 @@ public class GuiUploadFile extends GuiScreen {
|
||||
}
|
||||
|
||||
if(categoryButton == null) {
|
||||
categoryButton = new GuiButton(GuiConstants.UPLOAD_CATEGORY_BUTTON, (this.width / 2) + 20 + 10 - 1, 80, "Category: " + category.toNiceString());
|
||||
categoryButton = new GuiButton(GuiConstants.UPLOAD_CATEGORY_BUTTON, (this.width / 2) + 20 + 10 - 1, 80, I18n.format("replaymod.category")+": " + category.toNiceString());
|
||||
categoryButton.width = Math.min(202, this.width - 20 - 260 + 2);
|
||||
buttonList.add(categoryButton);
|
||||
} else {
|
||||
@@ -140,14 +145,14 @@ public class GuiUploadFile extends GuiScreen {
|
||||
|
||||
if(startUploadButton == null) {
|
||||
List<GuiButton> bottomBar = new ArrayList<GuiButton>();
|
||||
startUploadButton = new GuiButton(GuiConstants.UPLOAD_START_BUTTON, 0, 0, "Start Upload");
|
||||
startUploadButton = new GuiButton(GuiConstants.UPLOAD_START_BUTTON, 0, 0, I18n.format("replaymod.gui.upload.start"));
|
||||
bottomBar.add(startUploadButton);
|
||||
|
||||
cancelUploadButton = new GuiButton(GuiConstants.UPLOAD_CANCEL_BUTTON, 0, 0, "Cancel Upload");
|
||||
cancelUploadButton = new GuiButton(GuiConstants.UPLOAD_CANCEL_BUTTON, 0, 0, I18n.format("replaymod.gui.upload.cancel"));
|
||||
cancelUploadButton.enabled = false;
|
||||
bottomBar.add(cancelUploadButton);
|
||||
|
||||
backButton = new GuiButton(GuiConstants.UPLOAD_BACK_BUTTON, 0, 0, "Back");
|
||||
backButton = new GuiButton(GuiConstants.UPLOAD_BACK_BUTTON, 0, 0, I18n.format("replaymod.gui.back"));
|
||||
bottomBar.add(backButton);
|
||||
|
||||
int i = 0;
|
||||
@@ -208,7 +213,7 @@ public class GuiUploadFile extends GuiScreen {
|
||||
if(tagPlaceholder == null) {
|
||||
tagPlaceholder = new GuiTextField(GuiConstants.UPLOAD_TAG_PLACEHOLDER, fontRendererObj, (this.width / 2) + 20 + 10, 110, Math.min(200, this.width - 20 - 260), 20);
|
||||
tagPlaceholder.setTextColor(Color.DARK_GRAY.getRGB());
|
||||
tagPlaceholder.setText("Tags separated by comma");
|
||||
tagPlaceholder.setText(I18n.format("replaymod.gui.upload.tagshint"));
|
||||
} else {
|
||||
tagPlaceholder.xPosition = (this.width / 2) + 20 + 10;
|
||||
tagPlaceholder.width = Math.min(200, this.width - 20 - 260);
|
||||
@@ -222,7 +227,7 @@ public class GuiUploadFile extends GuiScreen {
|
||||
if(!button.enabled) return;
|
||||
if(button.id == GuiConstants.UPLOAD_CATEGORY_BUTTON) {
|
||||
category = category.next();
|
||||
categoryButton.displayString = "Category: " + category.toNiceString();
|
||||
categoryButton.displayString = I18n.format("replaymod.category")+": " + category.toNiceString();
|
||||
} else if(button.id == GuiConstants.UPLOAD_BACK_BUTTON) {
|
||||
mc.displayGuiScreen(parent);
|
||||
} else if(button.id == GuiConstants.UPLOAD_START_BUTTON) {
|
||||
@@ -261,13 +266,13 @@ public class GuiUploadFile extends GuiScreen {
|
||||
this.drawDefaultBackground();
|
||||
|
||||
drawString(fontRendererObj, metaData.getServerName(), (this.width / 2) + 20 + 10, 50, Color.GRAY.getRGB());
|
||||
drawString(fontRendererObj, "Duration: " + String.format("%02dm%02ds",
|
||||
drawString(fontRendererObj, I18n.format("replaymod.gui.duration")+": " + String.format("%02dm%02ds",
|
||||
TimeUnit.MILLISECONDS.toMinutes(metaData.getDuration()),
|
||||
TimeUnit.MILLISECONDS.toSeconds(metaData.getDuration()) -
|
||||
TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(metaData.getDuration()))
|
||||
), (this.width / 2) + 20 + 10, 65, Color.GRAY.getRGB());
|
||||
|
||||
drawCenteredString(fontRendererObj, "Upload File", this.width / 2, 5, Color.WHITE.getRGB());
|
||||
drawCenteredString(fontRendererObj, I18n.format("replaymod.gui.upload.title"), this.width / 2, 5, Color.WHITE.getRGB());
|
||||
|
||||
//Draw thumbnail
|
||||
if(thumb != null) {
|
||||
@@ -364,7 +369,7 @@ public class GuiUploadFile extends GuiScreen {
|
||||
backButton.enabled = false;
|
||||
categoryButton.enabled = false;
|
||||
fileTitleInput.setEnabled(false);
|
||||
messageTextField.setText("Uploading...");
|
||||
messageTextField.setText(I18n.format("replaymod.gui.upload.uploading"));
|
||||
messageTextField.setTextColor(Color.WHITE.getRGB());
|
||||
}
|
||||
|
||||
@@ -375,7 +380,7 @@ public class GuiUploadFile extends GuiScreen {
|
||||
categoryButton.enabled = true;
|
||||
fileTitleInput.setEnabled(true);
|
||||
if(success) {
|
||||
messageTextField.setText("File has been successfully uploaded");
|
||||
messageTextField.setText(I18n.format("replaymod.gui.upload.success"));
|
||||
messageTextField.setTextColor(Color.GREEN.getRGB());
|
||||
} else {
|
||||
messageTextField.setText(info);
|
||||
|
||||
Reference in New Issue
Block a user