java.lang.Object
net.i2p.i2ptunnel.ui.Messages

public class Messagesextends Object
Translate strings for this package. This is for the strings in the UI. Bundles are in the war. Note that there are separate bundles for the proxy error messages in the jar, which are not accessed by this class.
  • Field Details

    • BUNDLE_NAME

      private static final String BUNDLE_NAME
      The bundle holding the tunnel manager's translated strings
      See Also:
    • _context

      private final I2PAppContext _context
      Supplies the locale the translated strings are looked up in.
  • Constructor Details

    • Messages

      public Messages()
      Create a messages instance using the global context.
  • Method Details

    • _t

      public String _t(String key)
      Lang in routerconsole.lang property, else current locale.
      Parameters:
      key - the translation key
      Returns:
      the translated string
    • _t

      public static String _t(String key, I2PAppContext ctx)
      Static translation method.
      Parameters:
      key - the translation key
      ctx - the I2P app context
      Returns:
      the translated string
    • _t

      public String _t(String s, Object o)
      Translate a string with a parameter This is a lot more expensive than getString(s, ctx), so use sparingly.
      Parameters:
      s - string to be translated containing {0} The {0} will be replaced by the parameter. Single quotes must be doubled, i.e. ' -> '' in the string.
      o - parameter, not translated. To translate parameter also, use _t("foo {0} bar", _t("baz")) Do not double the single quotes in the parameter. Use autoboxing to call with ints, longs, floats, etc.
      Returns:
      the translated string
    • _t

      public String _t(String s, Object o1, Object o2)
      Translate a string with two parameters.
      Parameters:
      s - string to be translated containing {0} and {1}
      o1 - substituted for {0}
      o2 - substituted for {1}
      Returns:
      the translated string
    • ngettext

      public static String ngettext(String s, String p, int n, I2PAppContext ctx)
      translate (ngettext).
      Parameters:
      s - the singular form
      p - the plural form
      n - the count for pluralization
      ctx - the I2P app context
      Returns:
      the translated string
    • ngettext

      public String ngettext(String s, String p, int n)
      translate (ngettext).
      Parameters:
      s - the singular form
      p - the plural form
      n - the count for pluralization
      Returns:
      the translated string