Finished up localizing the version checker. Ready for .lang submissions

now
This commit is contained in:
pahimar 2013-09-02 20:39:16 -04:00
parent 27de3ccb0d
commit 47ba107515
3 changed files with 24 additions and 94 deletions

View file

@ -4,6 +4,7 @@ import java.io.InputStream;
import java.net.URL;
import java.util.Properties;
import net.minecraft.util.ChatMessageComponent;
import net.minecraftforge.common.Configuration;
import com.pahimar.ee3.configuration.ConfigurationHandler;
@ -13,7 +14,6 @@ import com.pahimar.ee3.lib.Reference;
import com.pahimar.ee3.lib.Strings;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.LanguageRegistry;
/**
* Equivalent-Exchange-3
@ -132,53 +132,39 @@ public class VersionHelper implements Runnable {
public static String getResultMessage() {
if (result == UNINITIALIZED)
return LanguageRegistry.instance().getStringLocalization(Strings.UNINITIALIZED_MESSAGE);
return new ChatMessageComponent().func_111080_a(Strings.UNINITIALIZED_MESSAGE, new Object[0]).toString();
else if (result == CURRENT) {
String returnString = LanguageRegistry.instance().getStringLocalization(Strings.CURRENT_MESSAGE);
returnString = returnString.replace("@REMOTE_MOD_VERSION@", remoteVersion);
returnString = returnString.replace("@MINECRAFT_VERSION@", Loader.instance().getMCVersionString());
return returnString;
return new ChatMessageComponent().func_111080_a(Strings.CURRENT_MESSAGE, new Object[] { remoteVersion, Loader.instance().getMCVersionString() }).toString();
}
else if (result == OUTDATED && remoteVersion != null && remoteUpdateLocation != null) {
String returnString = LanguageRegistry.instance().getStringLocalization(Strings.OUTDATED_MESSAGE);
returnString = returnString.replace("@MOD_NAME@", Reference.MOD_NAME);
returnString = returnString.replace("@REMOTE_MOD_VERSION@", remoteVersion);
returnString = returnString.replace("@MINECRAFT_VERSION@", Loader.instance().getMCVersionString());
returnString = returnString.replace("@MOD_UPDATE_LOCATION@", remoteUpdateLocation);
return returnString;
return new ChatMessageComponent().func_111080_a(Strings.OUTDATED_MESSAGE, new Object[] { Reference.MOD_NAME, remoteVersion, Loader.instance().getMCVersionString(), remoteUpdateLocation }).toString();
}
else if (result == OUTDATED && remoteVersion != null && remoteUpdateLocation != null) {
String returnString = LanguageRegistry.instance().getStringLocalization(Strings.OUTDATED_MESSAGE);
returnString = returnString.replace("@MOD_NAME@", Reference.MOD_NAME);
returnString = returnString.replace("@REMOTE_MOD_VERSION@", remoteVersion);
returnString = returnString.replace("@MINECRAFT_VERSION@", Loader.instance().getMCVersionString());
returnString = returnString.replace("@MOD_UPDATE_LOCATION@", remoteUpdateLocation);
return returnString;
return new ChatMessageComponent().func_111080_a(Strings.OUTDATED_MESSAGE, new Object[] { Reference.MOD_NAME, remoteVersion, Loader.instance().getMCVersionString(), remoteUpdateLocation }).toString();
}
else if (result == ERROR) {
return new ChatMessageComponent().func_111080_a(Strings.GENERAL_ERROR_MESSAGE, new Object[0]).toString();
}
else if (result == FINAL_ERROR) {
return new ChatMessageComponent().func_111080_a(Strings.FINAL_ERROR_MESSAGE, new Object[0]).toString();
}
else if (result == ERROR)
return LanguageRegistry.instance().getStringLocalization(Strings.GENERAL_ERROR_MESSAGE);
else if (result == FINAL_ERROR)
return LanguageRegistry.instance().getStringLocalization(Strings.FINAL_ERROR_MESSAGE);
else if (result == MC_VERSION_NOT_FOUND) {
String returnString = LanguageRegistry.instance().getStringLocalization(Strings.MC_VERSION_NOT_FOUND);
returnString = returnString.replace("@MOD_NAME@", Reference.MOD_NAME);
returnString = returnString.replace("@MINECRAFT_VERSION@", Loader.instance().getMCVersionString());
return returnString;
return new ChatMessageComponent().func_111080_a(Strings.MC_VERSION_NOT_FOUND, new Object[] { Reference.MOD_NAME, Loader.instance().getMCVersionString() }).toString();
}
else {
result = ERROR;
return LanguageRegistry.instance().getStringLocalization(Strings.GENERAL_ERROR_MESSAGE);
return new ChatMessageComponent().func_111080_a(Strings.GENERAL_ERROR_MESSAGE, new Object[0]).toString();
}
}
public static String getResultMessageForClient() {
String returnString = LanguageRegistry.instance().getStringLocalization(Strings.OUTDATED_MESSAGE);
returnString = returnString.replace("@MOD_NAME@", Colours.TEXT_COLOUR_PREFIX_YELLOW + Reference.MOD_NAME + Colours.TEXT_COLOUR_PREFIX_WHITE);
returnString = returnString.replace("@REMOTE_MOD_VERSION@", Colours.TEXT_COLOUR_PREFIX_YELLOW + VersionHelper.remoteVersion + Colours.TEXT_COLOUR_PREFIX_WHITE);
returnString = returnString.replace("@MINECRAFT_VERSION@", Colours.TEXT_COLOUR_PREFIX_YELLOW + Loader.instance().getMCVersionString() + Colours.TEXT_COLOUR_PREFIX_WHITE);
returnString = returnString.replace("@MOD_UPDATE_LOCATION@", Colours.TEXT_COLOUR_PREFIX_YELLOW + VersionHelper.remoteUpdateLocation + Colours.TEXT_COLOUR_PREFIX_WHITE);
return returnString;
return new ChatMessageComponent().func_111080_a(Strings.OUTDATED_MESSAGE,
new Object[] { Colours.TEXT_COLOUR_PREFIX_YELLOW + Reference.MOD_NAME + Colours.TEXT_COLOUR_PREFIX_WHITE,
Colours.TEXT_COLOUR_PREFIX_YELLOW + VersionHelper.remoteVersion + Colours.TEXT_COLOUR_PREFIX_WHITE,
Colours.TEXT_COLOUR_PREFIX_YELLOW + Loader.instance().getMCVersionString() + Colours.TEXT_COLOUR_PREFIX_WHITE,
Colours.TEXT_COLOUR_PREFIX_YELLOW + VersionHelper.remoteUpdateLocation + Colours.TEXT_COLOUR_PREFIX_WHITE })
.toString();
}
public static byte getResult() {
@ -191,7 +177,7 @@ public class VersionHelper implements Runnable {
int count = 0;
LogHelper.info(LanguageRegistry.instance().getStringLocalization(Strings.VERSION_CHECK_INIT_LOG_MESSAGE) + " " + REMOTE_VERSION_XML_FILE);
LogHelper.info(new ChatMessageComponent().func_111080_a(Strings.VERSION_CHECK_INIT_LOG_MESSAGE, new Object[] { REMOTE_VERSION_XML_FILE }).toString());
try {
while (count < Reference.VERSION_CHECK_ATTEMPTS - 1 && (result == UNINITIALIZED || result == ERROR)) {
@ -213,12 +199,10 @@ public class VersionHelper implements Runnable {
catch (InterruptedException e) {
e.printStackTrace();
}
}
public static void execute() {
new Thread(instance).start();
}
}

View file

@ -53,10 +53,10 @@ command.ee3.sounds.turned_off=Playing Equivalent Exchange 3 sounds disabled
itemGroup.EE3=Equivalent Exchange 3
# Version check localizations
version.init_log_message=Initializing remote version check against remote version authority, located at
version.init_log_message=Initializing remote version check against remote version authority, located at: %s
version.uninitialized=Remote version check failed to initialize properly
version.current=Currently using the most up to date version (@REMOTE_MOD_VERSION@) of Equivalent Exchange 3 for @MINECRAFT_VERSION@
version.outdated=A new @MOD_NAME@ version exists (@REMOTE_MOD_VERSION@) for @MINECRAFT_VERSION@. Get it here: @MOD_UPDATE_LOCATION@
version.current=Currently using the most up to date version (%s) of Equivalent Exchange 3 for %s
version.outdated=A new %s version exists (%s) for %s. Get it here: %s
version.general_error=Error while connecting to remote version authority file; trying again
version.final_error=Version check stopping after three unsuccessful connection attempts
version.mc_version_not_found=Unable to find a version of @MOD_NAME@ for @MINECRAFT_VERSION@ in the remote version authority
version.mc_version_not_found=Unable to find a version of %s for %s in the remote version authority

View file

@ -1,54 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties version="1.0">
<comment>English (en_US) Localization File</comment>
<entry key="key.extra">Extra</entry>
<entry key="key.release">Release</entry>
<entry key="key.toggle">Toggle</entry>
<entry key="key.charge">Charge</entry>
<entry key="item.shardMinium.name">Shard of Minium</entry>
<entry key="item.stoneInert.name">Inert Stone</entry>
<entry key="item.stoneMinium.name">Minium Stone</entry>
<entry key="item.stonePhilosophers.name">Philosopher's Stone</entry>
<entry key="item.alchemicalDustAsh.name">Ash</entry>
<entry key="item.alchemicalDustMinium.name">Minium Dust</entry>
<entry key="item.alchemicalDustVerdant.name">Verdant Dust</entry>
<entry key="item.alchemicalDustAzure.name">Azure Dust</entry>
<entry key="item.alchemicalDustAmaranthine.name">Amaranthine Dust</entry>
<entry key="item.alchemicalDustIridescent.name">Iridescent Dust</entry>
<entry key="item.alchemicalBag.name">Alchemical Bag</entry>
<entry key="tile.redWaterStill.name">Red Water (Still)</entry>
<entry key="tile.redWaterFlowing.name">Red Water (Flowing)</entry>
<entry key="tile.calcinator.name">Calcinator</entry>
<entry key="tile.aludel.name">Aludel</entry>
<entry key="tile.alchemicalChest.name">Alchemical Chest</entry>
<entry key="tile.glassBell.name">Glass Bell</entry>
<entry key="container.calcinator">Calcinator</entry>
<entry key="container.aludel">Aludel</entry>
<entry key="container.alchemicalChest">Alchemical Chest</entry>
<entry key="container.alchemicalBag">Alchemical Bag</entry>
<entry key="container.glassBell">Glass Bell</entry>
<entry key="itemGroup.EE3">Equivalent Exchange 3</entry>
<entry key="version.init_log_message">Initializing remote version check against remote version authority, located at</entry>
<entry key="version.uninitialized">Remote version check failed to initialize properly</entry>
<entry key="version.current">Currently using the most up to date version (@REMOTE_MOD_VERSION@) of Equivalent Exchange 3 for @MINECRAFT_VERSION@</entry>
<entry key="version.outdated">A new @MOD_NAME@ version exists (@REMOTE_MOD_VERSION@) for @MINECRAFT_VERSION@. Get it here: @MOD_UPDATE_LOCATION@</entry>
<entry key="version.general_error">Error while connecting to remote version authority file; trying again</entry>
<entry key="version.final_error">Version check stopping after three unsuccessful connection attempts</entry>
<entry key="version.mc_version_not_found">Unable to find a version of @MOD_NAME@ for @MINECRAFT_VERSION@ in the remote version authority</entry>
<entry key="command.ee3.overlay.turned_on">Target transmutation overlay turned on</entry>
<entry key="command.ee3.overlay.turned_off">Target transmutation overlay turned off</entry>
<entry key="command.ee3.overlay.position.top_left">Target transmutation overlay position set to top left</entry>
<entry key="command.ee3.overlay.position.top_right">Target transmutation overlay position set to top right</entry>
<entry key="command.ee3.overlay.position.bottom_left">Target transmutation overlay position set to bottom left</entry>
<entry key="command.ee3.overlay.position.bottom_right">Target transmutation overlay position set to bottom right</entry>
<entry key="command.ee3.overlay.opacity.usage.additional_text">(where ### is a decimal value between 0.0 and 1.0) </entry>
<entry key="command.ee3.overlay.opacity.updated">Target transmutation overlay opacity updated successfully</entry>
<entry key="command.ee3.overlay.scale.usage.additional_text">(where ### is a decimal value greater than 0.0) </entry>
<entry key="command.ee3.overlay.scale.updated">Target transmutation overlay scale updated successfully</entry>
<entry key="command.ee3.particles.turned_on">Equivalent Exchange 3 particles turned on</entry>
<entry key="command.ee3.particles.turned_off">Equivalent Exchange 3 particles turned off</entry>
<entry key="command.ee3.sounds.set_to_all">Playing Equivalent Exchange 3 sounds from all players</entry>
<entry key="command.ee3.sounds.set_to_self">Playing Equivalent Exchange 3 sounds from self only</entry>
<entry key="command.ee3.sounds.turned_off">Playing Equivalent Exchange 3 sounds disabled</entry>
</properties>