From bc4f609ebafc80511adedf1289af85b8c0019e84 Mon Sep 17 00:00:00 2001 From: Vexatos Date: Sun, 17 Aug 2014 20:32:55 +0200 Subject: [PATCH 1/2] More localization fixes. Allow custom bee names. --- lang | 2 +- src/main/java/forestry/apiculture/items/ItemBeeGE.java | 4 ++++ src/main/java/forestry/core/genetics/ItemResearchNote.java | 7 ++++--- src/main/resources/assets/forestry/lang/en_US.lang | 7 +++++++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lang b/lang index 7bd2e3194..9a75c1cb4 160000 --- a/lang +++ b/lang @@ -1 +1 @@ -Subproject commit 7bd2e3194df4a484a0fd090064b4963f51a29711 +Subproject commit 9a75c1cb4938243337fcf8d47081b8abf68ed65c diff --git a/src/main/java/forestry/apiculture/items/ItemBeeGE.java b/src/main/java/forestry/apiculture/items/ItemBeeGE.java index f2d7a879b..b55b4a9a1 100755 --- a/src/main/java/forestry/apiculture/items/ItemBeeGE.java +++ b/src/main/java/forestry/apiculture/items/ItemBeeGE.java @@ -37,6 +37,7 @@ import forestry.core.config.Config; import forestry.core.genetics.ItemGE; import forestry.core.utils.StringUtil; import forestry.plugins.PluginApiculture; +import net.minecraft.util.StatCollector; public class ItemBeeGE extends ItemGE { @@ -72,6 +73,9 @@ public class ItemBeeGE extends ItemGE { return StringUtil.localize(type.getName()); IBee individual = new Bee(itemstack.getTagCompound()); + if(StatCollector.canTranslate("bees.custom." + type.getName() + "." + individual.getDisplayName())){ + return StringUtil.localize("bees.custom." + type.getName() + "." + individual.getDisplayName()); + } return StringUtil.localize(type.getName() + ".grammar").replaceAll("%SPECIES", individual.getDisplayName()).replaceAll("%TYPE", StringUtil.localize(type.getName() + ".type")); } diff --git a/src/main/java/forestry/core/genetics/ItemResearchNote.java b/src/main/java/forestry/core/genetics/ItemResearchNote.java index 9d862c4a8..331c38f23 100755 --- a/src/main/java/forestry/core/genetics/ItemResearchNote.java +++ b/src/main/java/forestry/core/genetics/ItemResearchNote.java @@ -13,6 +13,7 @@ package forestry.core.genetics; import java.util.ArrayList; import java.util.List; +import forestry.core.utils.StringUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; @@ -211,8 +212,8 @@ public class ItemResearchNote extends ItemForestry { public void addTooltip(List list) { ArrayList tooltips = type.getTooltip(inner); if(tooltips.size() <= 0) { - list.add("\u00A7o\u00A7cIt is impossible to decipher the washed out scribbles."); - list.add("The note has become unreadable and is worthless."); + list.add("\u00A7o\u00A7c" + StringUtil.localize("item.research.note.error.0")); + list.add(StringUtil.localize("item.research.note.error.1")); return; } @@ -232,7 +233,7 @@ public class ItemResearchNote extends ItemForestry { @Override public String getItemStackDisplayName(ItemStack itemstack) { ResearchNote note = new ResearchNote(itemstack.getTagCompound()); - return String.format("%s's Notes", note.researcher); + return StringUtil.localizeAndFormat("item.research.note", note.researcher); } @SuppressWarnings("rawtypes") diff --git a/src/main/resources/assets/forestry/lang/en_US.lang b/src/main/resources/assets/forestry/lang/en_US.lang index 6daaa7bb9..edd89d706 100644 --- a/src/main/resources/assets/forestry/lang/en_US.lang +++ b/src/main/resources/assets/forestry/lang/en_US.lang @@ -465,6 +465,9 @@ item.fruit.lemon=Lemon item.fruit.plum=Plum item.fruit.papaya=Papaya item.fruit.dates=Date +item.research.note=%s's Notes +item.research.note.error.0=It is impossible to decipher the washed out scribbles. +item.research.note.error.1=The note has become unreadable and is worthless. itemGroup.forestry=Forestry itemGroup.arboriculture=Arboriculture itemGroup.apiculture=Apiculture @@ -1000,3 +1003,7 @@ item.catalogue=Catalogue #################### item.PipeItemsPropolis.name=Apiarist's Pipe + +########################### +# CUSTOM BEE SPECIES NAMES +########################### From 4c74e3865fa1af9ffa92e9e35f1a45deaa2dcba0 Mon Sep 17 00:00:00 2001 From: Vexatos Date: Sun, 17 Aug 2014 20:36:05 +0200 Subject: [PATCH 2/2] Fixed indentation --- src/main/java/forestry/apiculture/items/ItemBeeGE.java | 6 +++--- src/main/resources/assets/forestry/lang/en_US.lang | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/forestry/apiculture/items/ItemBeeGE.java b/src/main/java/forestry/apiculture/items/ItemBeeGE.java index b55b4a9a1..75dde6f67 100755 --- a/src/main/java/forestry/apiculture/items/ItemBeeGE.java +++ b/src/main/java/forestry/apiculture/items/ItemBeeGE.java @@ -73,9 +73,9 @@ public class ItemBeeGE extends ItemGE { return StringUtil.localize(type.getName()); IBee individual = new Bee(itemstack.getTagCompound()); - if(StatCollector.canTranslate("bees.custom." + type.getName() + "." + individual.getDisplayName())){ - return StringUtil.localize("bees.custom." + type.getName() + "." + individual.getDisplayName()); - } + if(StatCollector.canTranslate("bees.custom." + type.getName() + "." + individual.getDisplayName())){ + return StringUtil.localize("bees.custom." + type.getName() + "." + individual.getDisplayName()); + } return StringUtil.localize(type.getName() + ".grammar").replaceAll("%SPECIES", individual.getDisplayName()).replaceAll("%TYPE", StringUtil.localize(type.getName() + ".type")); } diff --git a/src/main/resources/assets/forestry/lang/en_US.lang b/src/main/resources/assets/forestry/lang/en_US.lang index edd89d706..8720e880a 100644 --- a/src/main/resources/assets/forestry/lang/en_US.lang +++ b/src/main/resources/assets/forestry/lang/en_US.lang @@ -1007,3 +1007,7 @@ item.PipeItemsPropolis.name=Apiarist's Pipe ########################### # CUSTOM BEE SPECIES NAMES ########################### +# Syntax: +# bees.custom..=New custom name +# Example: +# bees.custom.drone.forest=Forest Drone