java.lang.Object
java.util.ResourceBundle
gnu.gettext.GettextResource

public abstract class GettextResourceextends ResourceBundle
GettextResource Extends ResourceBundle.
  • Field Details

    • verbose

      public static boolean verbose
      Set true to trace catalog lookup decisions to standard output.
    • CONTEXT_GLUE

      private static final String CONTEXT_GLUE
      The separator between msgctxt and msgid.
      See Also:
  • Constructor Details

    • GettextResource

      public GettextResource()
      Constructor for ResourceBundle subclasses that hold translated strings.
  • Method Details

    • gettextnull

      private static String gettextnull(ResourceBundle catalog, String msgid)
      Like gettext(catalog,msgid), except that it returns null when no translation was found.
      Parameters:
      catalog - the ResourceBundle holding the translated message catalogs
      msgid - the key string to be translated, an ASCII string
      Returns:
      the translation, or null when none is found
    • gettext

      public static String gettext(ResourceBundle catalog, String msgid)
      Look up a translated string.
      Parameters:
      catalog - the ResourceBundle holding the translated message catalogs
      msgid - the untranslated key, echoed back when no translation exists
      Returns:
      the translation of msgid, or msgid itself when none exists
    • ngettextnull

      private static String ngettextnull(ResourceBundle catalog, String msgid, long n)
      Like ngettext(catalog,msgid,msgid_plural,n), except that it returns null when no translation was found.
      Parameters:
      catalog - the ResourceBundle holding the translated message catalogs
      msgid - the singular key string to be translated, an ASCII string
      n - the plural selection count, selecting the singular or plural form
      Returns:
      the plural-correct translation, or null when none is found
    • ngettext

      public static String ngettext(ResourceBundle catalog, String msgid, String msgid_plural, long n)
      Returns the plural form for n of the translation of msgid.
      Parameters:
      catalog - the ResourceBundle holding the translated message catalogs
      msgid - the key string to be translated, an ASCII string
      msgid_plural - its English plural form
      n - the item count that selects the singular or the plural form
      Returns:
      the translation of msgid depending on n, or msgid or msgid_plural if none is found
    • pgettext

      public static String pgettext(ResourceBundle catalog, String msgctxt, String msgid)
      Returns the translation of msgid in the context of msgctxt.
      Parameters:
      catalog - the ResourceBundle holding the translated message catalogs
      msgctxt - the context for the key string, an ASCII string
      msgid - the key string to be translated, an ASCII string
      Returns:
      the translation of msgid, or msgid if none is found
    • npgettext

      public static String npgettext(ResourceBundle catalog, String msgctxt, String msgid, String msgid_plural, long n)
      Returns the plural form for n of the translation of msgid in the context of msgctxt.
      Parameters:
      catalog - the ResourceBundle holding the translated message catalogs
      msgctxt - the context for the key string, an ASCII string
      msgid - the key string to be translated, an ASCII string
      msgid_plural - its English plural form
      n - the item count that selects the singular or the plural form
      Returns:
      the translation of msgid depending on n, or msgid or msgid_plural if none is found