java.lang.Object
java.util.ResourceBundle
gnu.gettext.GettextResource
GettextResource Extends ResourceBundle.
Nested Class Summary
Nested classes/interfaces inherited from class ResourceBundle
ResourceBundle.ControlField Summary
Modifier and TypeFieldDescriptionprivate static final StringThe separator between msgctxt and msgid.static booleanSet true to trace catalog lookup decisions to standard output.Fields inherited from class ResourceBundle
parentConstructor Summary
ConstructorsConstructorDescriptionConstructor for ResourceBundle subclasses that hold translated strings.Method Summary
Modifier and TypeMethodDescriptionstatic Stringgettext(ResourceBundle catalog, String msgid) Look up a translated string.private static Stringgettextnull(ResourceBundle catalog, String msgid) Like gettext(catalog,msgid), except that it returnsnullwhen no translation was found.static Stringngettext(ResourceBundle catalog, String msgid, String msgid_plural, long n) Returns the plural form for n of the translation of msgid.private static Stringngettextnull(ResourceBundle catalog, String msgid, long n) Like ngettext(catalog,msgid,msgid_plural,n), except that it returnsnullwhen no translation was found.static Stringnpgettext(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.static Stringpgettext(ResourceBundle catalog, String msgctxt, String msgid) Returns the translation of msgid in the context of msgctxt.Methods inherited from class ResourceBundle
clearCache, clearCache, containsKey, getBaseBundleName, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getKeys, getLocale, getObject, getString, getStringArray, handleGetObject, handleKeySet, keySet, setParent
Field Details
verbose
public static boolean verboseSet true to trace catalog lookup decisions to standard output.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
Like gettext(catalog,msgid), except that it returnsnullwhen no translation was found.- Parameters:
catalog- the ResourceBundle holding the translated message catalogsmsgid- the key string to be translated, an ASCII string- Returns:
- the translation, or null when none is found
gettext
Look up a translated string.- Parameters:
catalog- the ResourceBundle holding the translated message catalogsmsgid- the untranslated key, echoed back when no translation exists- Returns:
- the translation of msgid, or msgid itself when none exists
ngettextnull
Like ngettext(catalog,msgid,msgid_plural,n), except that it returnsnullwhen no translation was found.- Parameters:
catalog- the ResourceBundle holding the translated message catalogsmsgid- the singular key string to be translated, an ASCII stringn- the plural selection count, selecting the singular or plural form- Returns:
- the plural-correct translation, or null when none is found
ngettext
Returns the plural form for n of the translation of msgid.- Parameters:
catalog- the ResourceBundle holding the translated message catalogsmsgid- the key string to be translated, an ASCII stringmsgid_plural- its English plural formn- 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
Returns the translation of msgid in the context of msgctxt.- Parameters:
catalog- the ResourceBundle holding the translated message catalogsmsgctxt- the context for the key string, an ASCII stringmsgid- 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 catalogsmsgctxt- the context for the key string, an ASCII stringmsgid- the key string to be translated, an ASCII stringmsgid_plural- its English plural formn- 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