gnu.gettext
Class GettextResource

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

public abstract class GettextResource
extends java.util.ResourceBundle

This class implements the main GNU libintl functions in Java.

Using the GNU gettext approach, compiled message catalogs are normal Java ResourceBundle classes and are thus interoperable with standard ResourceBundle based code.

The main differences between the Sun ResourceBundle approach and the GNU gettext approach are:

To compile GNU gettext message catalogs into Java ResourceBundle classes, the msgfmt program can be used.

Author:
Bruno Haible

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.ResourceBundle
java.util.ResourceBundle.Control
 
Field Summary
static boolean verbose
           
 
Fields inherited from class java.util.ResourceBundle
parent
 
Constructor Summary
GettextResource()
           
 
Method Summary
static java.lang.String gettext(java.util.ResourceBundle catalog, java.lang.String msgid)
          Returns the translation of msgid.
static java.lang.String ngettext(java.util.ResourceBundle catalog, java.lang.String msgid, java.lang.String msgid_plural, long n)
          Returns the plural form for n of the translation of msgid.
static java.lang.String npgettext(java.util.ResourceBundle catalog, java.lang.String msgctxt, java.lang.String msgid, java.lang.String msgid_plural, long n)
          Returns the plural form for n of the translation of msgid in the context of msgctxt.
static java.lang.String pgettext(java.util.ResourceBundle catalog, java.lang.String msgctxt, java.lang.String msgid)
          Returns the translation of msgid in the context of msgctxt.
 
Methods inherited from class java.util.ResourceBundle
clearCache, clearCache, containsKey, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getKeys, getLocale, getObject, getString, getStringArray, handleGetObject, handleKeySet, keySet, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

verbose

public static boolean verbose
Constructor Detail

GettextResource

public GettextResource()
Method Detail

gettext

public static java.lang.String gettext(java.util.ResourceBundle catalog,
                                       java.lang.String msgid)
Returns the translation of msgid.

Parameters:
catalog - a ResourceBundle
msgid - the key string to be translated, an ASCII string
Returns:
the translation of msgid, or msgid if none is found

ngettext

public static java.lang.String ngettext(java.util.ResourceBundle catalog,
                                        java.lang.String msgid,
                                        java.lang.String msgid_plural,
                                        long n)
Returns the plural form for n of the translation of msgid.

Parameters:
catalog - a ResourceBundle
msgid - the key string to be translated, an ASCII string
msgid_plural - its English plural form
Returns:
the translation of msgid depending on n, or msgid or msgid_plural if none is found

pgettext

public static java.lang.String pgettext(java.util.ResourceBundle catalog,
                                        java.lang.String msgctxt,
                                        java.lang.String msgid)
Returns the translation of msgid in the context of msgctxt.

Parameters:
catalog - a ResourceBundle
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 java.lang.String npgettext(java.util.ResourceBundle catalog,
                                         java.lang.String msgctxt,
                                         java.lang.String msgid,
                                         java.lang.String msgid_plural,
                                         long n)
Returns the plural form for n of the translation of msgid in the context of msgctxt.

Parameters:
catalog - a ResourceBundle
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
Returns:
the translation of msgid depending on n, or msgid or msgid_plural if none is found