From 794656477acee60f4c8b3fe744738ff3ffaedbac Mon Sep 17 00:00:00 2001 From: Alex_hawks Date: Thu, 2 Jan 2014 22:32:49 +0800 Subject: [PATCH] Begin Localizing everything --- src/main/java/resonantinduction/wire/ItemWire.java | 14 ++++++++------ .../resonantinduction/languages/en_US.properties | 12 ++++++++++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/main/java/resonantinduction/wire/ItemWire.java b/src/main/java/resonantinduction/wire/ItemWire.java index 61f78f202..951e62709 100644 --- a/src/main/java/resonantinduction/wire/ItemWire.java +++ b/src/main/java/resonantinduction/wire/ItemWire.java @@ -7,6 +7,7 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.Icon; +import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.Configuration; import net.minecraftforge.common.ForgeDirection; @@ -92,19 +93,20 @@ public class ItemWire extends JItemMultiPart return super.getUnlocalizedName(itemStack) + "." + EnumWireMaterial.values()[itemStack.getItemDamage()].getName().toLowerCase(); } - @Override + @Override + @SuppressWarnings("unchecked") public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean par4) { if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - list.add("Hold " + EnumColor.AQUA + "shift" + EnumColor.GREY + " for more information"); + list.add(StatCollector.translateToLocal("tooltip.wire.noShift").replace("%0", EnumColor.AQUA.toString()).replace("%1", EnumColor.GREY.toString())); } else { - list.add(EnumColor.AQUA + "Resistance: " + EnumColor.ORANGE + UnitDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].resistance, Unit.RESISTANCE)); - list.add(EnumColor.AQUA + "Current Capacity: " + EnumColor.ORANGE + UnitDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].maxAmps, Unit.AMPERE)); - list.add(EnumColor.AQUA + "Shock Damage: " + EnumColor.ORANGE + EnumWireMaterial.values()[itemstack.getItemDamage()].damage); - list.addAll(Calclavia.splitStringPerWord("The energy transfer rate can be increased and the energy loss may be reduced by using a higher the voltage.", 5)); + list.add(EnumColor.AQUA + StatCollector.translateToLocal("tooltip.wire.resistance").replace("%v", "" + EnumColor.ORANGE + UnitDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].resistance, Unit.RESISTANCE))); + list.add(EnumColor.AQUA + StatCollector.translateToLocal("tooltip.wire.current").replace("%v", "" + EnumColor.ORANGE + UnitDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].maxAmps, Unit.AMPERE))); + list.add(EnumColor.AQUA + StatCollector.translateToLocal("tooltip.wire.damage").replace("%v", "" + EnumColor.ORANGE + EnumWireMaterial.values()[itemstack.getItemDamage()].damage)); + list.addAll(Calclavia.splitStringPerWord(StatCollector.translateToLocal("tooltip.wire.helpText"), 5)); } } diff --git a/src/main/resources/assets/resonantinduction/languages/en_US.properties b/src/main/resources/assets/resonantinduction/languages/en_US.properties index ad81de763..f071bf80d 100644 --- a/src/main/resources/assets/resonantinduction/languages/en_US.properties +++ b/src/main/resources/assets/resonantinduction/languages/en_US.properties @@ -1,4 +1,6 @@ -# English @author Calclavia +# English @author Calclavia, Alex_hawks +# If a localization includes %v it is some data that is calculated. Such as attributes on a cable. +# A % folowed by a number is used for colors. The exact usage will be outlined in the comment above the localization. itemGroup.resonantinduction=Resonant Induction @@ -23,4 +25,10 @@ item.resonantinduction\:wire.silver.name=Silver Wire item.resonantinduction\:wire.superconductor.name=Superconductor Wire tooltip.transformer.stepUp=Step Up -tooltip.transformer.stepDown=Step Down \ No newline at end of file +tooltip.transformer.stepDown=Step Down +tooltip.wire.resistance=Resistance: %v +tooltip.wire.current=Current: %v +tooltip.wire.damage=Damage: %v +tooltip.wire.helpText=The energy transfer rate can be increased and the energy loss may be reduced by using a higher the voltage. +# %0 goes before the localized name of the shift key, %1 goes after +tooltip.wire.noShift=Hold %0shift %1for more information"