Skip to content

Commit

Permalink
Merge pull request daveyliam#22 from Adaptivity/master
Browse files Browse the repository at this point in the history
Localization support for 1.7.10
  • Loading branch information
Vectron committed Dec 8, 2015
2 parents 57814da + b33a300 commit 090b836
Show file tree
Hide file tree
Showing 11 changed files with 766 additions and 566 deletions.
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Jul 02 15:54:47 CDT 2014
#Mon Dec 07 11:14:05 CST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-bin.zip
58 changes: 30 additions & 28 deletions src/main/java/mapwriter/gui/MwGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import mapwriter.tasks.RebuildRegionsTask;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;

import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
Expand Down Expand Up @@ -173,11 +174,12 @@ public void mergeMapViewToImage() {
this.mw.worldDir,
this.mw.worldDir.getName()));

MwUtil.printBoth("merging to '" + this.mw.worldDir.getAbsolutePath() + "'");
MwUtil.printBoth(I18n.format("mw.gui.mwgui.chatmsg.merge") + " '" + this.mw.worldDir.getAbsolutePath() + "'");
}

public void regenerateView() {
MwUtil.printBoth(String.format("regenerating %dx%d blocks starting from (%d, %d)",
MwUtil.printBoth(String.format(
I18n.format("mw.gui.mwgui.chatmsg.regenmap.1") + " %dx%d " + I18n.format("mw.gui.mwgui.chatmsg.regenmap.2") + " (%d, %d)",
(int) this.mapView.getWidth(),
(int) this.mapView.getHeight(),
(int) this.mapView.getMinX(),
Expand Down Expand Up @@ -375,7 +377,7 @@ protected void mouseClicked(int x, int y, int button) {
// open new marker dialog
String group = this.mw.markerManager.getVisibleGroupName();
if (group.equals("none")) {
group = "group";
group = I18n.format("mw.gui.mwgui.group");
}

int mx, my, mz;
Expand Down Expand Up @@ -503,13 +505,13 @@ public void updateScreen() {
public void drawStatus(int bX, int bY, int bZ) {
String s;
if (bY != 0) {
s = String.format("cursor: (%d, %d, %d)", bX, bY, bZ);
s = I18n.format("mw.gui.mwgui.status.cursor", bX, bY, bZ);
} else {
s = String.format("cursor: (%d, ?, %d)", bX, bZ);
s = I18n.format("mw.gui.mwgui.status.cursorNoY", bX, bZ);
}
if (this.mc.theWorld != null) {
if (!this.mc.theWorld.getChunkFromBlockCoords(bX, bZ).isEmpty()) {
s += String.format(", biome: %s", this.mc.theWorld.getBiomeGenForCoords(bX, bZ).biomeName);
s += String.format(", " + I18n.format("mw.gui.mwgui.status.biome", this.mc.theWorld.getBiomeGenForCoords(bX, bZ).biomeName));
}
}

Expand All @@ -529,7 +531,7 @@ public void drawStatus(int bX, int bY, int bZ) {
public void drawHelp() {
drawRect(10, 20, this.width - 20, this.height - 30, 0x80000000);
this.fontRendererObj.drawSplitString(
"Keys:\n\n" +
I18n.format("mw.gui.mwgui.keys") + ":\n\n" +
" Space\n" +
" Delete\n" +
" C\n" +
Expand All @@ -540,24 +542,24 @@ public void drawHelp() {
" P\n" +
" R\n" +
" U\n\n" +
"Left click drag or arrow keys pan the map.\n" +
"Mouse wheel or Page Up/Down zooms map.\n" +
"Right click map to create a new marker.\n" +
"Left click drag a selected marker to move it.\n" +
"Mouse wheel over selected marker to cycle colour.\n" +
"Mouse wheel over dimension or group box to cycle.\n",
I18n.format("mw.gui.mwgui.helptext.1") + "\n" +
I18n.format("mw.gui.mwgui.helptext.2") + "\n" +
I18n.format("mw.gui.mwgui.helptext.3") + "\n" +
I18n.format("mw.gui.mwgui.helptext.4") + "\n" +
I18n.format("mw.gui.mwgui.helptext.5") + "\n" +
I18n.format("mw.gui.mwgui.helptext.6") + "\n",
15, 24, this.width - 30, 0xffffff);
this.fontRendererObj.drawSplitString(
"| Next marker group\n" +
"| Delete selected marker\n" +
"| Cycle selected marker colour\n" +
"| Centre map on player\n" +
"| Centre map on selected marker\n" +
"| Select next marker\n" +
"| Teleport to cursor or selected marker\n" +
"| Save PNG of visible map area\n" +
"| Regenerate visible map area from region files\n" +
"| Underground map mode\n",
"| " + I18n.format("mw.gui.mwgui.helptext.nextmarkergroup") + "\n" +
"| " + I18n.format("mw.gui.mwgui.helptext.deletemarker") + "\n" +
"| " + I18n.format("mw.gui.mwgui.helptext.cyclecolour") + "\n" +
"| " + I18n.format("mw.gui.mwgui.helptext.centermap") + "\n" +
"| " + I18n.format("mw.gui.mwgui.helptext.centermapplayer") + "\n" +
"| " + I18n.format("mw.gui.mwgui.helptext.selectnextmarker") + "\n" +
"| " + I18n.format("mw.gui.mwgui.helptext.teleport") + "\n" +
"| " + I18n.format("mw.gui.mwgui.helptext.savepng") + "\n" +
"| " + I18n.format("mw.gui.mwgui.helptext.regenerate") + "\n" +
"| " + I18n.format("mw.gui.mwgui.helptext.undergroundmap") + "\n",
75, 42, this.width - 90, 0xffffff);
}

Expand Down Expand Up @@ -634,13 +636,13 @@ public void drawScreen(int mouseX, int mouseY, float f) {
this.drawStatus(this.mouseBlockX, this.mouseBlockY, this.mouseBlockZ);

// draw labels
this.helpLabel.draw(menuX, menuY, "[help]");
this.optionsLabel.drawToRightOf(this.helpLabel, "[options]");
String dimString = String.format("[dimension: %d]", this.mapView.getDimension());
this.helpLabel.draw(menuX, menuY, "[" + I18n.format("mw.gui.mwgui.help") + "]");
this.optionsLabel.drawToRightOf(this.helpLabel, "[" + I18n.format("mw.gui.mwgui.options") + "]");
String dimString = String.format("[" + I18n.format("mw.gui.mwgui.dimension", this.mapView.getDimension()) + "]");
this.dimensionLabel.drawToRightOf(this.optionsLabel, dimString);
String groupString = String.format("[group: %s]", this.mw.markerManager.getVisibleGroupName());
String groupString = String.format("[" + I18n.format("mw.gui.mwgui.group") + ": %s]", this.mw.markerManager.getVisibleGroupName());
this.groupLabel.drawToRightOf(this.dimensionLabel, groupString);
String overlayString = String.format("[overlay : %s]", MwAPI.getCurrentProviderName());
String overlayString = String.format("[" + I18n.format("mw.gui.mwgui.overlay", MwAPI.getCurrentProviderName()) + "]");
this.overlayLabel.drawToRightOf(this.groupLabel, overlayString);

// help message on mouse over
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/mapwriter/gui/MwGuiDimensionDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import mapwriter.Mw;
import mapwriter.map.MapView;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

Expand All @@ -14,7 +15,7 @@ public class MwGuiDimensionDialog extends MwGuiTextDialog {
final int dimension;

public MwGuiDimensionDialog(GuiScreen parentScreen, Mw mw, MapView mapView, int dimension) {
super(parentScreen, "Set dimension to:", "" + dimension, "invalid dimension");
super(parentScreen, I18n.format("mw.gui.mwguidimensiondialog.title") + ":", Integer.toString(dimension), I18n.format("mw.gui.mwguidimensiondialog.error"));
this.mw = mw;
this.mapView = mapView;
this.dimension = dimension;
Expand Down
55 changes: 29 additions & 26 deletions src/main/java/mapwriter/gui/MwGuiMarkerDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,25 @@
import mapwriter.map.Marker;
import mapwriter.map.MarkerManager;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class MwGuiMarkerDialog extends MwGuiTextDialog {
private final MarkerManager markerManager;
private final MarkerManager markerManager;
private Marker editingMarker;
private String markerName = "name";
private String markerGroup = "group";
private int markerX = 0;
private int markerY = 80;
private int markerZ = 0;
private int state = 0;
private int dimension = 0;

public MwGuiMarkerDialog(GuiScreen parentScreen, MarkerManager markerManager, String markerName, String markerGroup, int x, int y, int z, int dimension) {
super(parentScreen, "Marker Name:", markerName, "marker must have a name");
private String markerName = "";
private String markerGroup = "";
private int markerX = 0;
private int markerY = 80;
private int markerZ = 0;
private int state = 0;
private int dimension = 0;

public MwGuiMarkerDialog(GuiScreen parentScreen, MarkerManager markerManager, String markerName, String markerGroup, int x, int y, int z, int dimension)
{
super(parentScreen, I18n.format("mw.gui.mwguimarkerdialog.title.new") + ":", markerName, I18n.format("mw.gui.mwguimarkerdialog.error"));
this.markerManager = markerManager;
this.markerName = markerName;
this.markerGroup = markerGroup;
Expand All @@ -28,57 +30,58 @@ public MwGuiMarkerDialog(GuiScreen parentScreen, MarkerManager markerManager, St
this.markerZ = z;
this.editingMarker = null;
this.dimension = dimension;
}

public MwGuiMarkerDialog(GuiScreen parentScreen, MarkerManager markerManager, Marker editingMarker) {
super(parentScreen, "Edit Marker Name:", editingMarker.name, "marker must have a name");
this.markerManager = markerManager;
}

public MwGuiMarkerDialog(GuiScreen parentScreen, MarkerManager markerManager, Marker editingMarker)
{
super(parentScreen, I18n.format("mw.gui.mwguimarkerdialog.title.edit") + ":", editingMarker.name, I18n.format("mw.gui.mwguimarkerdialog.error"));
this.markerManager = markerManager;
this.editingMarker = editingMarker;
this.markerName = editingMarker.name;
this.markerGroup = editingMarker.groupName;
this.markerX = editingMarker.x;
this.markerY = editingMarker.y;
this.markerZ = editingMarker.z;
this.dimension = editingMarker.dimension;
}
}
@Override
public boolean submit() {
boolean done = false;
switch(this.state) {
case 0:
this.markerName = this.getInputAsString();
if (this.inputValid) {
this.title = "Marker Group:";
this.title = I18n.format("mw.gui.mwguimarkerdialog.title.group") + ":";
this.setText(this.markerGroup);
this.error = "marker must have a group name";
this.error = I18n.format("mw.gui.mwguimarkerdialog.error.group");
this.state++;
}
break;
case 1:
this.markerGroup = this.getInputAsString();
if (this.inputValid) {
this.title = "Marker X:";
this.title = I18n.format("mw.gui.mwguimarkerdialog.title.x") + ":";
this.setText("" + this.markerX);
this.error = "invalid value";
this.error = I18n.format("mw.gui.mwguimarkerdialog.error.x");
this.state++;
}
break;
case 2:
this.markerX = this.getInputAsInt();
if (this.inputValid) {
this.title = "Marker Y:";
this.title = I18n.format("mw.gui.mwguimarkerdialog.title.y") + ":";
this.setText("" + this.markerY);
this.error = "invalid value";
this.error = I18n.format("mw.gui.mwguimarkerdialog.error.y");
this.state++;
}
break;
case 3:
this.markerY = this.getInputAsInt();
if (this.inputValid) {
this.title = "Marker Z:";
this.title = I18n.format("mw.gui.mwguimarkerdialog.title.z") + ":";
this.setText("" + this.markerZ);
this.error = "invalid value";
this.error = I18n.format("mw.gui.mwguimarkerdialog.error.z");
this.state++;
}
break;
Expand Down
Loading

0 comments on commit 090b836

Please sign in to comment.