aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGWYOG <jjn1jjn2@163.com>2016-11-07 20:25:26 +0800
committerGWYOG <jjn1jjn2@163.com>2016-11-07 20:25:26 +0800
commitefb446e212ccb7ff67e392eb46605117564aa235 (patch)
tree4a4623547f447d0339328535944d915620394a8b
parent10f86d028093566285f9500da84961c86c8552a1 (diff)
downloadGT5-Unofficial-efb446e212ccb7ff67e392eb46605117564aa235.tar.gz
GT5-Unofficial-efb446e212ccb7ff67e392eb46605117564aa235.tar.bz2
GT5-Unofficial-efb446e212ccb7ff67e392eb46605117564aa235.zip
Add I18n support for GT5's custom vein/asteroid
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java9
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java9
-rw-r--r--src/main/resources/assets/gtneioreplugin/lang/en_US.lang7
-rw-r--r--src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang1
4 files changed, 22 insertions, 4 deletions
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java
index acc00c01ef..9cdc5e7108 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java
@@ -56,7 +56,7 @@ public class PluginAsteroidStat extends PluginBase {
public void drawExtras(int recipe) {
CachedAsteroidStatRecipe crecipe = (CachedAsteroidStatRecipe) this.arecipes.get(recipe);
OreLayerWrapper oreLayer = GTOreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName);
- GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + I18n.format("gtnop." + oreLayer.veinName) + I18n.format("gtnop.ore.asteroid.name"), 2, 18, 0x404040, false);
+ GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedAsteroidName(oreLayer.veinName), 2, 18, 0x404040, false);
GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidPrimary") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.primaryMeta)), 2, 31, 0x404040, false);
GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidSecondary") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.secondaryMeta)), 2, 44, 0x404040, false);
GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidBetween") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.betweenMeta)), 2, 57, 0x404040, false);
@@ -80,6 +80,13 @@ public class PluginAsteroidStat extends PluginBase {
return worldNameTranslatedAsteroid;
}
+ public String getLocalizedAsteroidName(String unlocalizedName) {
+ if (unlocalizedName.startsWith("ore.mix.custom."))
+ return I18n.format("gtnop.ore.custom.name") + I18n.format("gtnop.ore.asteroid.name") + unlocalizedName.substring(15);
+ else
+ return I18n.format("gtnop." + unlocalizedName) + I18n.format("gtnop.ore.asteroid.name");
+ }
+
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals(getOutputId())) {
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java
index 8182233c9b..e2b43cf482 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java
@@ -115,7 +115,7 @@ public class PluginVeinStat extends PluginBase {
public void drawExtras(int recipe) {
CachedVeinStatRecipe crecipe = (CachedVeinStatRecipe) this.arecipes.get(recipe);
OreLayerWrapper oreLayer = GTOreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName);
- GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + I18n.format("gtnop." + oreLayer.veinName) + I18n.format("gtnop.ore.vein.name"), 2, 18, 0x404040, false);
+ GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer.veinName), 2, 18, 0x404040, false);
GuiDraw.drawString(I18n.format("gtnop.gui.nei.primaryOre") + ": " + getGTOreLocalizedName(oreLayer.primaryMeta), 2, 31, 0x404040, false);
GuiDraw.drawString(I18n.format("gtnop.gui.nei.secondaryOre") + ": " + getGTOreLocalizedName(oreLayer.secondaryMeta), 2, 44, 0x404040, false);
GuiDraw.drawString(I18n.format("gtnop.gui.nei.betweenOre") + ": " + getGTOreLocalizedName(oreLayer.betweenMeta), 2, 57, 0x404040, false);
@@ -127,6 +127,13 @@ public class PluginVeinStat extends PluginBase {
GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false);
}
+ public String getLocalizedVeinName(String unlocalizedName) {
+ if (unlocalizedName.startsWith("ore.mix.custom."))
+ return I18n.format("gtnop.ore.custom.name") + I18n.format("gtnop.ore.vein.name") + unlocalizedName.substring(15);
+ else
+ return I18n.format("gtnop." + unlocalizedName) + I18n.format("gtnop.ore.vein.name");
+ }
+
@Override
public String getOutputId() {
return "GTOrePluginVein";
diff --git a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang
index 177bc65345..cbeb074fbd 100644
--- a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang
+++ b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang
@@ -37,9 +37,12 @@ gtnop.world.asteroid.name=GalactiCraft Asteroid
# biome names
gtnop.biome.none.name=None
+
# vein types
-gtnop.ore.vein.name= Vein
-gtnop.ore.asteroid.name= Asteriod
+gtnop.ore.vein.name=Vein
+gtnop.ore.asteroid.name=Asteriod
+gtnop.ore.custom.name=Custom
+
# vein names
gtnop.ore.mix.naquadah=Naquadah
diff --git a/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang b/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang
index 203a30f259..d02326efa8 100644
--- a/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang
+++ b/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang
@@ -40,6 +40,7 @@ gtnop.biome.none.name=无
# vein types
gtnop.ore.vein.name=矿脉
gtnop.ore.asteroid.name=小行星
+gtnop.ore.custom.name=自定义
# vein names