private void init() throws Exception {
    for (Object language : StringTranslate.getInstance().getLanguageList().keySet()) {
      CoreLoadingPlugin.log.fine(
          "[LanguageEngine] Loading language array for " + (String) language);
      lang.put((String) language, new HashMap<String, String>());
    }

    CoreLoadingPlugin.log.info("[LanguageEngine] Scanning for and loading language XML files...");

    for (Object file : lang.keySet()) {
      String fle1 = LANG_RESOURCE_LOCATION + (String) file + ".xml";
      fle1 = fle1.trim();
      CoreLoadingPlugin.log.fine("[LanguageEngine] Loading xml: " + fle1);
      Properties langPack = new Properties();
      URL urlResource = this.getClass().getResource(fle1);
      try {
        InputStream langStream = urlResource.openStream();
        langPack.loadFromXML(langStream);
        for (Object key : langPack.keySet()) {
          CoreLoadingPlugin.log.fine(
              "[LanguageEngine] Placing " + key + " in lang map as " + langPack.get(key));
          lang.get(file).put((String) key, (String) langPack.get(key));
        }
      } catch (Exception e) {
        CoreLoadingPlugin.log.warning(
            "[LanguageEngine] File " + fle1 + " does not exist or is causing an error!");
      }
    }
  }
Example #2
0
  /** Draws the screen and all the components in it. */
  public void drawScreen(int par1, int par2, float par3) {
    this.drawDefaultBackground();
    StringTranslate stringtranslate = StringTranslate.getInstance();

    if (this.clientHandler == null) {
      this.drawCenteredString(
          this.fontRenderer,
          stringtranslate.translateKey("connect.connecting"),
          this.width / 2,
          this.height / 2 - 50,
          16777215);
      this.drawCenteredString(
          this.fontRenderer, "", this.width / 2, this.height / 2 - 10, 16777215);
    } else {
      this.drawCenteredString(
          this.fontRenderer,
          stringtranslate.translateKey("connect.authorizing"),
          this.width / 2,
          this.height / 2 - 50,
          16777215);
      this.drawCenteredString(
          this.fontRenderer,
          this.clientHandler.field_72560_a,
          this.width / 2,
          this.height / 2 - 10,
          16777215);
    }

    super.drawScreen(par1, par2, par3);
  }
Example #3
0
 /** Adds the buttons (and other controls) to the screen in question. */
 public void initGui() {
   StringTranslate stringtranslate = StringTranslate.getInstance();
   this.buttonList.clear();
   this.buttonList.add(
       new GuiButton(
           0,
           this.width / 2 - 100,
           this.height / 4 + 120 + 12,
           stringtranslate.translateKey("gui.cancel")));
 }
 public String getString(String key) {
   String language = StringTranslate.getInstance().currentLanguage;
   if (lang.get(language).containsKey(key)) {
     return lang.get(language).get(key);
   } else {
     if (!lang.get(language).isEmpty())
       CoreLoadingPlugin.log.warning(
           String.format("[LanguageEngine] Failed to get string for key %s", key));
     return key;
   }
 }
 @SideOnly(Side.CLIENT)
 @Override
 public void addInformation(
     ItemStack itemStack, EntityPlayer player, List list, boolean something) {
   list.add(
       String.valueOf(getNumPhotos(itemStack))
           + " / "
           + String.valueOf(getCapacity())
           + " "
           + StringTranslate.getInstance().translateKey("item.photostorage.count"));
 }
 public String[] getArray(String key) {
   String language = StringTranslate.getInstance().currentLanguage;
   if (lang.get(language).containsKey(key)) {
     if (lang.get(language).get(key).contains(",")) {
       return lang.get(language).get(key).split(", ");
     }
   }
   if (!lang.get(language).isEmpty())
     CoreLoadingPlugin.log.warning(
         String.format("[LanguageEngine] Failed to return array for key %s", key));
   String[] def = new String[100];
   Arrays.fill(def, key);
   return def;
 }
Example #7
0
  @SideOnly(Side.CLIENT)

  /** allows items to add custom lines of information to the mouseover description */
  public void addInformation(
      ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
    if (LuxLevels.instance.getItemStack(par1ItemStack.getItemDamage()) == null) return;
    int id = LuxLevels.instance.getItemStack(par1ItemStack.getItemDamage()).itemID;
    int damage = LuxLevels.instance.getItemStack(par1ItemStack.getItemDamage()).getItemDamage();

    if (id < 0) return;

    Item temp = Item.itemsList[id];

    if (temp != null) {
      String name1 = StatCollector.translateToLocal(temp.getItemName());

      if (temp.getHasSubtypes()) {
        name1 = StatCollector.translateToLocal(temp.getItemNameIS(new ItemStack(temp, 1, damage)));
      }

      if (name1 == null) name1 = "";

      String name = ("" + StringTranslate.getInstance().translateNamedKey(name1)).trim();

      par3List.set(0, name + " " + (String) par3List.get(0));

      LuxPacket tempPacket = LuxLevels.instance.GetLuxPacket(id, damage);

      if (tempPacket != null) {
        for (byte c = 0; c < 7; c++)
          if (tempPacket.luxLevel[c] > 0)
            par3List.add(
                LuxHelper.color_str[c]
                    + LuxHelper.color_abb[c]
                    + " "
                    + LuxHelper.display(tempPacket.luxLevel[c]));
      }
    }
  }
Example #8
0
 private String translate_do(String var1) {
   String var2 = StringTranslate.getInstance().getCurrentLanguage();
   return var1;
 }
 /** Translates and formats the given string key with the given arguments. */
 public String translateString(String par1Str, Object... par2ArrayOfObj) {
   return StringTranslate.getInstance().translateKeyFormat(par1Str, par2ArrayOfObj);
 }