public void loadLocalization(URL localizationFile, String lang, boolean isXML) {
    InputStream langStream = null;
    Properties langPack = new Properties();

    try {
      langStream = localizationFile.openStream();

      if (isXML) {
        langPack.loadFromXML(langStream);
      } else {
        langPack.load(new InputStreamReader(langStream, Charsets.UTF_8));
      }

      addStringLocalization(langPack, lang);
    } catch (IOException e) {
      FMLLog.log(Level.SEVERE, e, "Unable to load localization from file %s", localizationFile);
    } finally {
      try {
        if (langStream != null) {
          langStream.close();
        }
      } catch (IOException ex) {
        // HUSH
      }
    }
  }
 public void addNameForObject(Object objectToName, String lang, String name) {
   String objectName;
   if (objectToName instanceof Item) {
     objectName = ((Item) objectToName).getUnlocalizedName();
   } else if (objectToName instanceof Block) {
     objectName = ((Block) objectToName).getUnlocalizedName();
   } else if (objectToName instanceof ItemStack) {
     objectName =
         ((ItemStack) objectToName).getItem().getUnlocalizedName((ItemStack) objectToName);
   } else {
     throw new IllegalArgumentException(
         String.format("Illegal object for naming %s", objectToName));
   }
   objectName += ".name";
   addStringLocalization(objectName, lang, name);
 }
 public void addStringLocalization(Properties langPackAdditions) {
   addStringLocalization(langPackAdditions, "en_US");
 }
 public void addStringLocalization(String key, String value) {
   addStringLocalization(key, "en_US", value);
 }