From bbda002a5b280f8742a3eba20ba2cc48bf10898d Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 26 Dec 2017 22:13:33 -0500 Subject: [PATCH] Transcribed all ingame text to a bundle --- TODO.md | 1 + core/assets/bundles/bundle_en_US.properties | 65 +++++++++++++++++++ core/src/io/anuke/mindustry/core/UI.java | 4 +- .../src/io/anuke/mindustry/io/BundleUtil.java | 13 ++++ .../mindustry/mapeditor/MapEditorDialog.java | 39 +++++------ .../mapeditor/MapGenerateDialog.java | 10 +-- .../mindustry/mapeditor/MapLoadDialog.java | 10 +-- .../mindustry/mapeditor/MapResizeDialog.java | 10 +-- .../mindustry/mapeditor/MapSaveDialog.java | 12 ++-- .../src/io/anuke/mindustry/resource/Item.java | 11 ++++ .../io/anuke/mindustry/resource/Liquid.java | 10 +++ .../io/anuke/mindustry/resource/Weapon.java | 4 ++ .../io/anuke/mindustry/ui/FloatingDialog.java | 2 +- .../src/io/anuke/mindustry/ui/LoadDialog.java | 2 +- .../src/io/anuke/mindustry/ui/SaveDialog.java | 2 +- .../io/anuke/mindustry/ui/UpgradeDialog.java | 4 +- .../ui/fragments/BlocksFragment.java | 6 ++ .../mindustry/ui/fragments/HudFragment.java | 4 +- .../ui/fragments/PlacementFragment.java | 4 +- core/src/io/anuke/mindustry/world/Block.java | 4 +- .../io/anuke/mindustry/world/GameMode.java | 8 +++ core/src/io/anuke/mindustry/world/Map.java | 5 ++ .../blocks/types/defense/PowerTurret.java | 1 + .../blocks/types/defense/ShieldBlock.java | 6 +- .../blocks/types/distribution/Conveyor.java | 2 +- .../blocks/types/distribution/PowerLaser.java | 6 -- .../blocks/types/production/Generator.java | 4 +- .../types/production/ItemPowerGenerator.java | 4 +- .../production/LiquidPowerGenerator.java | 4 +- .../world/blocks/types/production/Pump.java | 2 +- 30 files changed, 188 insertions(+), 71 deletions(-) diff --git a/TODO.md b/TODO.md index b51ce73c39..c7990e10cf 100644 --- a/TODO.md +++ b/TODO.md @@ -10,6 +10,7 @@ _(These are not planned in the near future at all, and have been suggested befor - Liquid teleporter - More teleporter colors/any system that gives it more frequencies (numbers) - More ore generation (if you're playing on maze, *play any different map, maze has the least resources, and for good reason!*) +- Power wires or conduits ### Already Suggested _(not necessarily planned!)_ diff --git a/core/assets/bundles/bundle_en_US.properties b/core/assets/bundles/bundle_en_US.properties index e103548e10..91568cd41e 100644 --- a/core/assets/bundles/bundle_en_US.properties +++ b/core/assets/bundles/bundle_en_US.properties @@ -36,6 +36,33 @@ text.waiting=Waiting... text.countdown=Wave in {0} text.enemies={0} Enemies left text.enemies.single={0} Enemy left +text.loadimage=Load Image +text.saveimage=Save Image +text.editor.badsize=[orange]Invalid image dimensions![]\nValid map dimensions: {0} +text.editor.errorimageload=Error loading image file:\n[orange]{0} +text.editor.errorimagesave=Error saving image file:\n[orange]{0} +text.editor.generate=Generate +text.editor.resize=Resize +text.editor.loadmap=Load Map +text.editor.savemap=Save Map +text.editor.loadimage=Load Image +text.editor.saveimage=Save Image +text.editor.unsaved=[scarlet]You have unsaved changes![]\nAre you sure you want to exit? +text.editor.brushsize=Brush size: {0} +text.editor.noplayerspawn=This map has no player spawnpoint! +text.editor.manyplayerspawns=Maps cannot have more than one\nplayer spawnpoint! +text.editor.manyenemyspawns=Cannot have more than\n{0} enemy spawnpoints! +text.editor.resizemap=Resize Map +text.editor.resizebig=[scarlet]Warning!\n[]Maps larger than 256 units may be laggy and unstable. +text.editor.mapname=Map Name: +text.editor.overwrite=[accent]Warning!\nThis overwrites an existing map. +text.editor.failoverwrite=[crimson]Cannot overwrite default map! +text.editor.selectmap=Select a map to load: +text.width=Width: +text.height=Height: +text.randomize=Randomize +text.apply=Apply +text.update=Update text.menu=Menu text.play=Play text.load=Load @@ -43,7 +70,9 @@ text.save=Save text.settings=Settings text.tutorial=Tutorial text.editor=Editor +text.mapeditor=Map Editor text.donate=Donate +text.settings.reset=Reset to Defaults text.settings.controls=Controls text.settings.game=Game text.settings.sound=Sound @@ -58,6 +87,42 @@ text.error.crashmessage=[SCARLET]An unexpected error has occured, which would ha text.error.crashtitle=An error has occured text.blocks.extrainfo=[accent]extra block info: text.blocks.blockinfo=Block Info +text.blocks.powercapacity=Power Capacity +text.blocks.powershot=Power/shot +text.blocks.powersecond=Power/second +text.blocks.powerdraindamage=Power Drain/damage +text.blocks.shieldradius=Shield Radius +text.blocks.itemspeedsecond=Item Speed/second +text.blocks.range=Range +text.blocks.size=Size +text.blocks.powerliquid=Power/Liquid +text.blocks.maxliquidsecond=Max liquid/second +text.blocks.liquidcapacity=Liquid capacity +text.blocks.liquidsecond=Liquid/second +text.blocks.damageshot=Damage/shot +text.blocks.ammocapacity=Ammo Capacity +text.blocks.ammo=Ammo +text.blocks.ammoitem=Ammo/item +text.blocks.maxitemssecond=Max items/second +text.blocks.powerrange=Power range +text.blocks.lasertilerange=Laser tile range +text.blocks.capacity=Capacity +text.blocks.itemcapacity=Item Capacity +text.blocks.powergenerationsecond=Power Generation/second +text.blocks.generationsecondsitem=Generation Seconds/item +text.blocks.input=Input +text.blocks.inputliquid=Input Liquid +text.blocks.inputitem=Input Item +text.blocks.output=Output +text.blocks.secondsitem=Seconds/item +text.blocks.maxpowertransfersecond=Max power transfer/second +text.blocks.explosive=Highly explosive! +text.blocks.repairssecond=Repairs/second +text.blocks.health=Health +text.blocks.Damage/shot=Damage/shot +text.blocks.inaccuracy=Health +text.blocks.shots=Shots +text.blocks.shotssecond=Shots/second text.placemode=Place Mode text.breakmode=Break Mode text.health=health diff --git a/core/src/io/anuke/mindustry/core/UI.java b/core/src/io/anuke/mindustry/core/UI.java index fef4f27cf3..514534177f 100644 --- a/core/src/io/anuke/mindustry/core/UI.java +++ b/core/src/io/anuke/mindustry/core/UI.java @@ -373,7 +373,7 @@ public class UI extends SceneModule{ new Dialog("$text.error.title", "dialog"){{ content().margin(15); content().add(text); - getButtonTable().addButton("OK", this::hide).size(90, 50).pad(4); + getButtonTable().addButton("$text.ok", this::hide).size(90, 50).pad(4); }}.show(); } @@ -381,7 +381,7 @@ public class UI extends SceneModule{ new Dialog("$text.error.title", "dialog"){{ content().margin(15); content().add(text); - getButtonTable().addButton("Exit", Gdx.app::exit).size(90, 50).pad(4); + getButtonTable().addButton("$text.quit", Gdx.app::exit).size(90, 50).pad(4); }}.show(); } diff --git a/core/src/io/anuke/mindustry/io/BundleUtil.java b/core/src/io/anuke/mindustry/io/BundleUtil.java index eaa3d570a9..fdb7fa98bf 100644 --- a/core/src/io/anuke/mindustry/io/BundleUtil.java +++ b/core/src/io/anuke/mindustry/io/BundleUtil.java @@ -2,6 +2,7 @@ package io.anuke.mindustry.io; import com.badlogic.gdx.Game; import com.badlogic.gdx.files.FileHandle; +import com.badlogic.gdx.utils.Array; import io.anuke.mindustry.Vars; import io.anuke.mindustry.core.Tutorial; import io.anuke.mindustry.core.Tutorial.Stage; @@ -15,6 +16,7 @@ import io.anuke.ucore.core.Inputs.DeviceType; import io.anuke.ucore.core.KeyBinds; import io.anuke.ucore.core.KeyBinds.Keybind; import io.anuke.ucore.scene.ui.SettingsDialog.SettingsTable.Setting; +import io.anuke.ucore.util.Bundles; import io.anuke.ucore.util.Mathf; import java.io.File; @@ -61,6 +63,17 @@ public class BundleUtil { write("block." + block.name + ".name=" + block.formalName); if(block.fullDescription != null) write("block." + block.name + ".fulldescription=" + block.fullDescription); if(block.description != null) write("block." + block.name + ".description=" + block.description); + + Array a = new Array<>(); + block.getStats(a); + for(String s : a){ + if(s.contains(":")) { + String color = s.substring(0, s.indexOf("]")+1); + String first = s.substring(color.length(), s.indexOf(":")).replace("/", "").replace(" ", "").toLowerCase(); + String last = s.substring(s.indexOf(":"), s.length()); + s = color + Bundles.getNotNull("text.blocks." + first) + last; + } + } } } diff --git a/core/src/io/anuke/mindustry/mapeditor/MapEditorDialog.java b/core/src/io/anuke/mindustry/mapeditor/MapEditorDialog.java index 2bfeb27c17..fbb4a6eaec 100644 --- a/core/src/io/anuke/mindustry/mapeditor/MapEditorDialog.java +++ b/core/src/io/anuke/mindustry/mapeditor/MapEditorDialog.java @@ -22,6 +22,7 @@ import io.anuke.ucore.graphics.Pixmaps; import io.anuke.ucore.scene.builders.*; import io.anuke.ucore.scene.ui.*; import io.anuke.ucore.scene.ui.layout.Table; +import io.anuke.ucore.util.Bundles; import io.anuke.ucore.util.Strings; public class MapEditorDialog extends Dialog{ @@ -37,12 +38,12 @@ public class MapEditorDialog extends Dialog{ private ButtonGroup blockgroup; public MapEditorDialog(MapEditor editor){ - super("Map Editor", "dialog"); + super("$text.mapeditor", "dialog"); this.editor = editor; dialog = new MapGenerateDialog(editor); view = new MapView(editor); - openFile = new FileChooser("Load Image", FileChooser.pngFilter, true, file -> { + openFile = new FileChooser("$text.loadimage", FileChooser.pngFilter, true, file -> { Vars.ui.showLoading(); Timers.run(3f, () -> { try{ @@ -51,17 +52,17 @@ public class MapEditorDialog extends Dialog{ editor.setPixmap(pixmap); view.clearStack(); }else{ - Vars.ui.showError("[orange]Invalid image dimensions![]\nValid map dimensions: " + Arrays.toString(MapEditor.validMapSizes)); + Vars.ui.showError(Bundles.format("text.editor.badsize", Arrays.toString(MapEditor.validMapSizes))); } }catch (Exception e){ - Vars.ui.showError("Error loading image file:\n[orange]" + Strings.parseException(e, false)); + Vars.ui.showError(Bundles.format("text.editor.errorimageload", Strings.parseException(e, false))); e.printStackTrace(); } Vars.ui.hideLoading(); }); }); - saveFile = new FileChooser("Save Image", false, file -> { + saveFile = new FileChooser("$saveimage", false, file -> { if(!file.extension().toLowerCase().equals(".png")){ file = file.parent().child(file.nameWithoutExtension() + ".png"); } @@ -71,7 +72,7 @@ public class MapEditorDialog extends Dialog{ try{ Pixmaps.write(editor.pixmap(), result); }catch (Exception e){ - Vars.ui.showError("Error saving image file:\n[orange]" + Strings.parseException(e, false)); + Vars.ui.showError(Bundles.format("text.editor.errorimagesave", Strings.parseException(e, false))); if(!Vars.android) e.printStackTrace(); } Vars.ui.hideLoading(); @@ -171,48 +172,48 @@ public class MapEditorDialog extends Dialog{ new imagebutton("icon-terrain", isize, () -> dialog.show() - ).text("generate"); + ).text("$text.editor.generate"); row(); new imagebutton("icon-resize", isize, () -> resizeDialog.show() - ).text("resize").padTop(4f); + ).text("$text.editor.resize").padTop(4f); row(); new imagebutton("icon-load-map", isize, () -> loadDialog.show() - ).text("load map"); + ).text("$text.editor.loadmap"); row(); new imagebutton("icon-save-map", isize, ()-> saveDialog.show() - ).text("save map"); + ).text("$text.editor.savemap"); row(); new imagebutton("icon-load-image", isize, () -> openFile.show() - ).text("load image"); + ).text("$text.editor.loadimage"); row(); new imagebutton("icon-save-image", isize, () -> saveFile.show() - ).text("save image"); + ).text("$text.editor.saveimage"); row(); new imagebutton("icon-back", isize, () -> { if(!saved){ - Vars.ui.showConfirm("Confirm Exit", "[scarlet]You have unsaved changes![]\nAre you sure you want to exit?", + Vars.ui.showConfirm("$text.confirm", "$text.editor.unsaved", MapEditorDialog.this::hide); }else{ hide(); } - }).padBottom(0).text("back"); + }).padBottom(0).text("$text.back"); }}.left().growY().end(); @@ -260,7 +261,7 @@ public class MapEditorDialog extends Dialog{ margin(10f); Slider slider = new Slider(0, MapEditor.brushSizes.length-1, 1, false); slider.moved(f -> editor.setBrushSize(MapEditor.brushSizes[(int)(float)f])); - new label(() -> "Brush size: " + MapEditor.brushSizes[(int)slider.getValue()]).left(); + new label(() -> Bundles.format("text.editor.brushsize", MapEditor.brushSizes[(int)slider.getValue()])).left(); row(); add(slider).growX().padTop(4f); }}.growX().end(); @@ -304,15 +305,15 @@ public class MapEditorDialog extends Dialog{ } if(playerSpawns == 0){ - Vars.ui.showError("This map has no player spawnpoint!"); + Vars.ui.showError("$text.editor.noplayerspawn"); return false; }else if(playerSpawns > 1){ - Vars.ui.showError("Maps cannot have more than one\nplayer spawnpoint!"); + Vars.ui.showError("$text.editor.manyplayerspawns"); return false; } if(enemySpawns > MapEditor.maxSpawnpoints){ - Vars.ui.showError("Cannot have more than\n" + MapEditor.maxSpawnpoints + " enemy spawnpoints!"); + Vars.ui.showError(Bundles.format("text.editor.manyenemyspawns", MapEditor.maxSpawnpoints)); return false; } @@ -347,7 +348,7 @@ public class MapEditorDialog extends Dialog{ group.getButtons().get(2).setChecked(true); Table extra = new Table("button"); - extra.labelWrap(() -> editor.getDrawBlock().name).width(180f).center(); + extra.labelWrap(() -> editor.getDrawBlock().formalName).width(180f).center(); table.add(extra).growX(); table.row(); table.add(pane).growY().fillX(); diff --git a/core/src/io/anuke/mindustry/mapeditor/MapGenerateDialog.java b/core/src/io/anuke/mindustry/mapeditor/MapGenerateDialog.java index 7644b3d858..7afbf71020 100644 --- a/core/src/io/anuke/mindustry/mapeditor/MapGenerateDialog.java +++ b/core/src/io/anuke/mindustry/mapeditor/MapGenerateDialog.java @@ -24,7 +24,7 @@ public class MapGenerateDialog extends FloatingDialog{ private boolean loading; public MapGenerateDialog(MapEditor editor) { - super("generate"); + super("$text.generate"); this.editor = editor; Stack stack = new Stack(); @@ -64,13 +64,13 @@ public class MapGenerateDialog extends FloatingDialog{ content().add(pane).fillY(); buttons().defaults().size(170f, 50f).pad(4f); - buttons().addButton("Back", this::hide); - buttons().addButton("Randomize", () ->{ + buttons().addButton("$text.back", this::hide); + buttons().addButton("$text.randomize", () ->{ editor.getFilter().randomize(); apply(); }); - buttons().addButton("Update", this::apply); - buttons().addButton("Apply", () ->{ + buttons().addButton("$text.update", this::apply); + buttons().addButton("$text.apply", () ->{ Vars.ui.showLoading(); Timers.run(3f, () ->{ diff --git a/core/src/io/anuke/mindustry/mapeditor/MapLoadDialog.java b/core/src/io/anuke/mindustry/mapeditor/MapLoadDialog.java index 41bfb92ec1..16c3cd87ac 100644 --- a/core/src/io/anuke/mindustry/mapeditor/MapLoadDialog.java +++ b/core/src/io/anuke/mindustry/mapeditor/MapLoadDialog.java @@ -14,11 +14,11 @@ public class MapLoadDialog extends FloatingDialog{ private Map selected = Vars.world.maps().getMap(0); public MapLoadDialog(Consumer loader) { - super("load map"); + super("$text.editor.loadmap"); rebuild(); - TextButton button = new TextButton("Load"); + TextButton button = new TextButton("$text.load"); button.setDisabled(() -> selected == null); button.clicked(() -> { if (selected != null) { @@ -28,7 +28,7 @@ public class MapLoadDialog extends FloatingDialog{ }); buttons().defaults().size(200f, 50f); - buttons().addButton("Cancel", this::hide); + buttons().addButton("$text.cancel", this::hide); buttons().add(button); } @@ -53,7 +53,7 @@ public class MapLoadDialog extends FloatingDialog{ for (Map map : Vars.world.maps().list()) { if (!map.visible) continue; - TextButton button = new TextButton(map.name, "toggle"); + TextButton button = new TextButton(map.localized(), "toggle"); button.add(new BorderImage(map.texture, 2f)).size(16 * 4f); button.getCells().reverse(); button.clicked(() -> selected = map); @@ -63,7 +63,7 @@ public class MapLoadDialog extends FloatingDialog{ if (++i % maxcol == 0) table.row(); } - content().add("Select a map to load:"); + content().add("$text.editor.loadmap"); content().row(); content().add(pane); } diff --git a/core/src/io/anuke/mindustry/mapeditor/MapResizeDialog.java b/core/src/io/anuke/mindustry/mapeditor/MapResizeDialog.java index fd76755ad9..aed552a4f1 100644 --- a/core/src/io/anuke/mindustry/mapeditor/MapResizeDialog.java +++ b/core/src/io/anuke/mindustry/mapeditor/MapResizeDialog.java @@ -13,7 +13,7 @@ public class MapResizeDialog extends FloatingDialog{ int width, height; public MapResizeDialog(MapEditor editor, BiConsumer cons){ - super("resize map"); + super("$text.editor.resizemap"); shown(() -> { content().clear(); Pixmap pix = editor.pixmap(); @@ -29,7 +29,7 @@ public class MapResizeDialog extends FloatingDialog{ for(int i = 0; i < MapEditor.validMapSizes.length; i ++) if(MapEditor.validMapSizes[i] == curr) idx = i; - table.add(d == 0 ? "Width: ": "Height: "); + table.add(d == 0 ? "$text.width": "$text.height").padRight(8f); ButtonGroup group = new ButtonGroup<>(); for(int i = 0; i < MapEditor.validMapSizes.length; i ++){ int size = MapEditor.validMapSizes[i]; @@ -49,7 +49,7 @@ public class MapResizeDialog extends FloatingDialog{ } content().label(() -> - width + height > 512 ? "[scarlet]Warning!\n[]Maps larger than 256 units may be laggy and unstable." : "" + width + height > 512 ? "$text.editor.resizebig" : "" ).get().setAlignment(Align.center, Align.center); content().row(); content().add(table); @@ -57,8 +57,8 @@ public class MapResizeDialog extends FloatingDialog{ }); buttons().defaults().size(200f, 50f); - buttons().addButton("Cancel", this::hide); - buttons().addButton("Resize", () -> { + buttons().addButton("$text.cancel", this::hide); + buttons().addButton("$text.editor.resize", () -> { cons.accept(width, height); hide(); }); diff --git a/core/src/io/anuke/mindustry/mapeditor/MapSaveDialog.java b/core/src/io/anuke/mindustry/mapeditor/MapSaveDialog.java index 5e2d8d08cb..34ab9fa91d 100644 --- a/core/src/io/anuke/mindustry/mapeditor/MapSaveDialog.java +++ b/core/src/io/anuke/mindustry/mapeditor/MapSaveDialog.java @@ -12,7 +12,7 @@ public class MapSaveDialog extends FloatingDialog{ private TextField field; public MapSaveDialog(Consumer cons){ - super("Save Map"); + super("$text.editor.savemap"); field = new TextField(); Mindustry.platforms.addDialog(field); @@ -23,22 +23,22 @@ public class MapSaveDialog extends FloatingDialog{ Map map = Vars.world.maps().getMap(field.getText()); if(map != null){ if(map.custom){ - return "[accent]Warning!\nThis overwrites an existing map."; + return "$text.editor.overwrite"; }else{ - return "[crimson]Cannot overwrite default map!"; + return "$text.editor.failoverwrite"; } } return ""; }).colspan(2); content().row(); - content().add("Map Name: "); + content().add("$text.editor.mapname").padRight(14f); content().add(field).size(220f, 48f); }); buttons().defaults().size(200f, 50f).pad(2f); - buttons().addButton("Cancel", this::hide); + buttons().addButton("$text.cancel", this::hide); - TextButton button = new TextButton("Save"); + TextButton button = new TextButton("$text.save"); button.clicked(() -> { if(!invalid()){ cons.accept(field.getText()); diff --git a/core/src/io/anuke/mindustry/resource/Item.java b/core/src/io/anuke/mindustry/resource/Item.java index 63ca663516..a871bf38bc 100644 --- a/core/src/io/anuke/mindustry/resource/Item.java +++ b/core/src/io/anuke/mindustry/resource/Item.java @@ -1,5 +1,16 @@ package io.anuke.mindustry.resource; +import io.anuke.ucore.util.Bundles; + public enum Item{ stone, iron, coal, steel, titanium, dirium, uranium; + + public String localized(){ + return Bundles.get("item."+name() + ".name"); + } + + @Override + public String toString() { + return localized(); + } } diff --git a/core/src/io/anuke/mindustry/resource/Liquid.java b/core/src/io/anuke/mindustry/resource/Liquid.java index faf4a1ac65..2a86075996 100644 --- a/core/src/io/anuke/mindustry/resource/Liquid.java +++ b/core/src/io/anuke/mindustry/resource/Liquid.java @@ -1,6 +1,7 @@ package io.anuke.mindustry.resource; import com.badlogic.gdx.graphics.Color; +import io.anuke.ucore.util.Bundles; public enum Liquid{ water(Color.ROYAL), @@ -13,4 +14,13 @@ public enum Liquid{ private Liquid(Color color){ this.color = new Color(color); } + + public String localized(){ + return Bundles.get("liquid."+name() + ".name"); + } + + @Override + public String toString(){ + return localized(); + } } diff --git a/core/src/io/anuke/mindustry/resource/Weapon.java b/core/src/io/anuke/mindustry/resource/Weapon.java index 58eee87e4c..524f21068f 100644 --- a/core/src/io/anuke/mindustry/resource/Weapon.java +++ b/core/src/io/anuke/mindustry/resource/Weapon.java @@ -104,6 +104,10 @@ public enum Weapon{ public final String description; Vector2 vector = new Vector2(); + + public String localized(){ + return Bundles.get("weapon."+name() + ".name"); + } private Weapon(float reload, BulletType type, ItemStack... requirements){ this.reload = reload; diff --git a/core/src/io/anuke/mindustry/ui/FloatingDialog.java b/core/src/io/anuke/mindustry/ui/FloatingDialog.java index 54f82584c2..ab0e36e28d 100644 --- a/core/src/io/anuke/mindustry/ui/FloatingDialog.java +++ b/core/src/io/anuke/mindustry/ui/FloatingDialog.java @@ -20,7 +20,7 @@ public class FloatingDialog extends Dialog{ @Override public void addCloseButton(){ - buttons().addImageTextButton("Back", "icon-arrow-left", 30f, this::hide).size(230f, 64f); + buttons().addImageTextButton("$text.back", "icon-arrow-left", 30f, this::hide).size(230f, 64f); keyDown(key->{ if(key == Keys.ESCAPE || key == Keys.BACK) diff --git a/core/src/io/anuke/mindustry/ui/LoadDialog.java b/core/src/io/anuke/mindustry/ui/LoadDialog.java index d9469de536..f4796e27a6 100644 --- a/core/src/io/anuke/mindustry/ui/LoadDialog.java +++ b/core/src/io/anuke/mindustry/ui/LoadDialog.java @@ -54,7 +54,7 @@ public class LoadDialog extends FloatingDialog{ button.row(); Label info = new Label("[gray]" + (!SaveIO.isSaveValid(i) ? Bundles.get("text.empty") : SaveIO.getMode(i) + ", " - + SaveIO.getMap(i).name + ", " + Bundles.format("text.save.wave", SaveIO.getWave(i)) + "\n" + + Bundles.get("map."+SaveIO.getMap(i).name+".name", SaveIO.getMap(i).name) + ", " + Bundles.format("text.save.wave", SaveIO.getWave(i)) + "\n" + Bundles.format("text.save.date", SaveIO.getTimeString(i)))); info.setAlignment(Align.center, Align.center); diff --git a/core/src/io/anuke/mindustry/ui/SaveDialog.java b/core/src/io/anuke/mindustry/ui/SaveDialog.java index edb2b27f5c..b3dcab8a6e 100644 --- a/core/src/io/anuke/mindustry/ui/SaveDialog.java +++ b/core/src/io/anuke/mindustry/ui/SaveDialog.java @@ -36,7 +36,7 @@ public class SaveDialog extends LoadDialog{ } void save(int slot){ - Vars.ui.showLoading("text.saveload"); + Vars.ui.showLoading("$text.saveload"); Timers.runTask(5f, () -> { hide(); diff --git a/core/src/io/anuke/mindustry/ui/UpgradeDialog.java b/core/src/io/anuke/mindustry/ui/UpgradeDialog.java index a4057979a0..d6ea732524 100644 --- a/core/src/io/anuke/mindustry/ui/UpgradeDialog.java +++ b/core/src/io/anuke/mindustry/ui/UpgradeDialog.java @@ -42,7 +42,7 @@ public class UpgradeDialog extends FloatingDialog{ int i = 0; for(Weapon weapon : Weapon.values()){ - TextButton button = new TextButton(weapon.name()); + TextButton button = new TextButton("$weapon."+weapon.name()+".name"); Image img = new Image(Draw.region(weapon.name())); button.add(img).size(8*5); @@ -81,7 +81,7 @@ public class UpgradeDialog extends FloatingDialog{ String description = weapon.description; tiptable.background("pane"); - tiptable.add("[orange]" + weapon.name(), 0.5f).left().padBottom(4f); + tiptable.add("[orange]" + weapon.localized(), 0.5f).left().padBottom(4f); Table reqtable = new Table(); diff --git a/core/src/io/anuke/mindustry/ui/fragments/BlocksFragment.java b/core/src/io/anuke/mindustry/ui/fragments/BlocksFragment.java index 45272a9b2e..9a262d59ae 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/BlocksFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/BlocksFragment.java @@ -233,6 +233,12 @@ public class BlocksFragment implements Fragment{ } for(String s : statlist){ + if(s.contains(":")) { + String color = s.substring(0, s.indexOf("]")+1); + String first = s.substring(color.length(), s.indexOf(":")).replace("/", "").replace(" ", "").toLowerCase(); + String last = s.substring(s.indexOf(":"), s.length()); + s = color + Bundles.get("text.blocks." + first) + last; + } table.add(s).left(); table.row(); } diff --git a/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java b/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java index 676be94c8b..68b464b98f 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java @@ -152,7 +152,7 @@ public class HudFragment implements Fragment{ private String getEnemiesRemaining() { if(control.getEnemiesRemaining() == 1) { - return Bundles.format("text.single", control.getEnemiesRemaining()); + return Bundles.format("text.enemies.single", control.getEnemiesRemaining()); } else return Bundles.format("text.enemies", control.getEnemiesRemaining()); } @@ -215,7 +215,7 @@ public class HudFragment implements Fragment{ if(amount > 99999999){ formatted = "inf"; } - Image image = new Image(Draw.region("icon-" + items[i])); + Image image = new Image(Draw.region("icon-" + items[i].name())); Label label = new Label(formatted); label.setFontScale(fontscale*1.5f); itemtable.add(image).size(8*3); diff --git a/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java b/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java index ee4e71c7a4..e410cf5780 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java @@ -87,12 +87,10 @@ public class PlacementFragment implements Fragment{ defaults().size(54, 58).pad(0); - int d = 0; - for(PlaceMode mode : PlaceMode.values()){ if(!mode.shown || !mode.delete) continue; - defaults().padBottom(d < 2 ? -5.5f : 0); + defaults().padBottom(-5.5f); new imagebutton("icon-" + mode.name(), "toggle", 10*3, ()->{ control.getInput().resetCursor(); diff --git a/core/src/io/anuke/mindustry/world/Block.java b/core/src/io/anuke/mindustry/world/Block.java index 1b8dc783ee..2479b544fa 100644 --- a/core/src/io/anuke/mindustry/world/Block.java +++ b/core/src/io/anuke/mindustry/world/Block.java @@ -85,8 +85,8 @@ public class Block{ this.name = name; this.formalName = Bundles.get("block." + name + ".name", name); - this.description = Bundles.get("block." + name + ".description"); - this.fullDescription = Bundles.get("block." + name + ".fulldescription"); + this.description = Bundles.getOrNull("block." + name + ".description"); + this.fullDescription = Bundles.getOrNull("block." + name + ".fulldescription"); this.solid = false; this.id = lastid++; } diff --git a/core/src/io/anuke/mindustry/world/GameMode.java b/core/src/io/anuke/mindustry/world/GameMode.java index bdf6b6250c..be8fc218a3 100644 --- a/core/src/io/anuke/mindustry/world/GameMode.java +++ b/core/src/io/anuke/mindustry/world/GameMode.java @@ -1,5 +1,7 @@ package io.anuke.mindustry.world; +import io.anuke.ucore.util.Bundles; + public enum GameMode{ waves, sandbox{ @@ -15,4 +17,10 @@ public enum GameMode{ }; public boolean infiniteResources; public boolean toggleWaves; + + @Override + public String toString(){ + return Bundles.get("mode."+name()+".name"); + } + } diff --git a/core/src/io/anuke/mindustry/world/Map.java b/core/src/io/anuke/mindustry/world/Map.java index 6aa43486b3..ab71636812 100644 --- a/core/src/io/anuke/mindustry/world/Map.java +++ b/core/src/io/anuke/mindustry/world/Map.java @@ -3,6 +3,7 @@ package io.anuke.mindustry.world; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Pixmap; import com.badlogic.gdx.graphics.Texture; +import io.anuke.ucore.util.Bundles; public class Map{ public int id = -1; @@ -16,6 +17,10 @@ public class Map{ public transient Texture texture; public Map(){} + + public String localized(){ + return Bundles.get("map."+name+".name", name); + } public int getWidth(){ return pixmap.getWidth(); diff --git a/core/src/io/anuke/mindustry/world/blocks/types/defense/PowerTurret.java b/core/src/io/anuke/mindustry/world/blocks/types/defense/PowerTurret.java index eb6df6e021..c8d73ccd78 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/defense/PowerTurret.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/defense/PowerTurret.java @@ -14,6 +14,7 @@ import io.anuke.mindustry.resource.Item; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.blocks.types.PowerAcceptor; import io.anuke.ucore.core.Draw; +import io.anuke.ucore.util.Bundles; import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Strings; diff --git a/core/src/io/anuke/mindustry/world/blocks/types/defense/ShieldBlock.java b/core/src/io/anuke/mindustry/world/blocks/types/defense/ShieldBlock.java index 25cbe8c8ca..cf7cb91c64 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/defense/ShieldBlock.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/defense/ShieldBlock.java @@ -31,9 +31,9 @@ public class ShieldBlock extends PowerBlock{ @Override public void getStats(Array list){ super.getStats(list); - list.add("[powerinfo]Power used: " + Strings.toFixed(powerDrain*60, 2) + "power/s"); - list.add("[powerinfo]Power Drain: " + Strings.toFixed(powerPerDamage, 2) + "power/damage"); - list.add("[powerinfo]Shield Radius: " + (int)shieldRadius + " units"); + list.add("[powerinfo]Power/second: " + Strings.toFixed(powerDrain*60, 2)); + list.add("[powerinfo]Power Drain/damage: " + Strings.toFixed(powerPerDamage, 2)); + list.add("[powerinfo]Shield Radius: " + (int)shieldRadius); } @Override diff --git a/core/src/io/anuke/mindustry/world/blocks/types/distribution/Conveyor.java b/core/src/io/anuke/mindustry/world/blocks/types/distribution/Conveyor.java index 7e7ce43ae4..e1cae1bace 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/distribution/Conveyor.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/distribution/Conveyor.java @@ -40,7 +40,7 @@ public class Conveyor extends Block{ @Override public void getStats(Array list){ super.getStats(list); - list.add("[iteminfo]Move Speed: " + Strings.toFixed(speed * 60, 1) + " units/s"); + list.add("[iteminfo]Item Speed/second: " + Strings.toFixed(speed * 60, 1)); } @Override diff --git a/core/src/io/anuke/mindustry/world/blocks/types/distribution/PowerLaser.java b/core/src/io/anuke/mindustry/world/blocks/types/distribution/PowerLaser.java index 0fb8af6102..794ab46a0c 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/distribution/PowerLaser.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/distribution/PowerLaser.java @@ -19,12 +19,6 @@ public class PowerLaser extends Generator{ health = 50; } - @Override - public void getStats(Array list){ - super.getStats(list); - list.add("[powerinfo]Laser Range: " + laserRange + " tiles"); - } - @Override public void update(Tile tile){ distributeLaserPower(tile); diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/Generator.java b/core/src/io/anuke/mindustry/world/blocks/types/production/Generator.java index 20a3b742db..f7c1f3c818 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/Generator.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/Generator.java @@ -42,12 +42,12 @@ public class Generator extends PowerBlock{ super.getStats(list); if(hasLasers){ - list.add("[powerinfo]Laser range: " + laserRange + " blocks"); + list.add("[powerinfo]Laser tile range: " + laserRange); list.add("[powerinfo]Max power transfer/second: " + Strings.toFixed(powerSpeed * 2, 2)); } if(explosive){ - list.add("[orange]Highly explosive!"); + list.add("[orange]" + Bundles.get("text.blocks.explosive")); } } diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/ItemPowerGenerator.java b/core/src/io/anuke/mindustry/world/blocks/types/production/ItemPowerGenerator.java index 7ccfa1e67b..611cf08afd 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/ItemPowerGenerator.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/ItemPowerGenerator.java @@ -32,8 +32,8 @@ public class ItemPowerGenerator extends Generator{ public void getStats(Array list){ super.getStats(list); list.add("[powerinfo]Item Capacity: " + itemCapacity); - list.add("[powerinfo]Generation: " + Strings.toFixed(powerOutput*60f, 2) + " power/s"); - list.add("[powerinfo]Generation Time: " + Strings.toFixed(itemDuration/60f, 2) + " s/item"); + list.add("[powerinfo]Power Generation/second: " + Strings.toFixed(powerOutput*60f, 2)); + list.add("[powerinfo]Generation Seconds/item: " + Strings.toFixed(itemDuration/60f, 2)); list.add("[powerinfo]Input: " + generateItem); } diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidPowerGenerator.java b/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidPowerGenerator.java index ce8deb49be..d031b423be 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidPowerGenerator.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidPowerGenerator.java @@ -37,8 +37,8 @@ public class LiquidPowerGenerator extends Generator implements LiquidAcceptor{ public void getStats(Array list){ super.getStats(list); list.add("[liquidinfo]Liquid Capacity: " + (int)liquidCapacity); - list.add("[liquidinfo]Generation: " + Strings.toFixed(powerPerLiquid, 2) + " power/liquid"); - list.add("[liquidinfo]Max liquid: " + Strings.toFixed(maxLiquidGenerate*60f, 2) + " liquid/s"); + list.add("[liquidinfo]Power/Liquid: " + Strings.toFixed(powerPerLiquid, 2) + " power/liquid"); + list.add("[liquidinfo]Max liquid/second: " + Strings.toFixed(maxLiquidGenerate*60f, 2) + " liquid/s"); list.add("[liquidinfo]Input: " + generateLiquid); } diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/Pump.java b/core/src/io/anuke/mindustry/world/blocks/types/production/Pump.java index 4d1041eb5a..67b15b9978 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/Pump.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/Pump.java @@ -28,7 +28,7 @@ public class Pump extends LiquidBlock{ @Override public void getStats(Array list){ super.getStats(list); - list.add("[liquidinfo]Pump Speed: " + Strings.toFixed(60f*pumpAmount, 1) + "/s"); + list.add("[liquidinfo]Liquid/second: " + Strings.toFixed(60f*pumpAmount, 1)); } @Override