1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Sat Nov 03 18:12:01 CET 2001 -->
<title>
Class gnu.gettext.GettextResource
</title>
</head>
<body>
<a name="_top_"></a>
<pre>
<a href="packages.html">All Packages</a> <a href="tree.html">Class Hierarchy</a> <a href="Package-gnu.gettext.html">This Package</a> <a href="Package-gnu.gettext.html">Previous</a> <a href="Package-gnu.gettext.html">Next</a> <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
Class gnu.gettext.GettextResource
</h1>
<pre>
java.lang.Object
|
+----java.util.ResourceBundle
|
+----gnu.gettext.GettextResource
</pre>
<hr>
<dl>
<dt> public abstract class <b>GettextResource</b>
<dt> extends ResourceBundle
</dl>
This class implements the main GNU libintl functions in Java.
<P>
Using the GNU gettext approach, compiled message catalogs are normal
Java ResourceBundle classes and are thus interoperable with standard
ResourceBundle based code.
<P>
The main differences between the Sun ResourceBundle approach and the
GNU gettext approach are:
<UL>
<LI>In the Sun approach, the keys are abstract textual shortcuts.
In the GNU gettext approach, the keys are the English/ASCII version
of the messages.
<LI>In the Sun approach, the translation files are called
"<VAR>Resource</VAR>_<VAR>locale</VAR>.properties" and have non-ASCII
characters encoded in the Java
<CODE>\</CODE><CODE>u<VAR>nnnn</VAR></CODE> syntax. Very few editors
can natively display international characters in this format. In the
GNU gettext approach, the translation files are called
"<VAR>Resource</VAR>.<VAR>locale</VAR>.po"
and are in the encoding the translator has chosen. Many editors
can be used. There are at least three GUI translating tools
(Emacs PO mode, KDE KBabel, GNOME gtranslator).
<LI>In the Sun approach, the function
<CODE>ResourceBundle.getString</CODE> throws a
<CODE>MissingResourceException</CODE> when no translation is found.
In the GNU gettext approach, the <CODE>gettext</CODE> function
returns the (English) message key in that case.
<LI>In the Sun approach, there is no support for plural handling.
Even the most elaborate MessageFormat strings cannot provide decent
plural handling. In the GNU gettext approach, we have the
<CODE>ngettext</CODE> function.
</UL>
<P>
To compile GNU gettext message catalogs into Java ResourceBundle classes,
the <CODE>msgfmt</CODE> program can be used.
<p>
<hr>
<a name="index"></a>
<h2>
<img src="images/variable-index.gif" width=207 height=38 alt="Variable Index">
</h2>
<dl>
<dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#verbose"><b>verbose</b></a>
<dd>
</dl>
<h2>
<img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
</h2>
<dl>
<dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#GettextResource()"><b>GettextResource</b></a>()
<dd>
</dl>
<h2>
<img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
<dt> <img src="images/green-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#gettext(java.util.ResourceBundle, java.lang.String)"><b>gettext</b></a>(ResourceBundle, String)
<dd> Returns the translation of <VAR>msgid</VAR>.
<dt> <img src="images/green-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#ngettext(java.util.ResourceBundle, java.lang.String, java.lang.String, long)"><b>ngettext</b></a>(ResourceBundle, String, String, long)
<dd> Returns the plural form for <VAR>n</VAR> of the translation of
<VAR>msgid</VAR>.
</dl>
<a name="variables"></a>
<h2>
<img src="images/variables.gif" width=153 height=38 alt="Variables">
</h2>
<a name="verbose"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>verbose</b>
<pre>
public static boolean verbose
</pre>
<a name="constructors"></a>
<h2>
<img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="GettextResource"></a>
<a name="GettextResource()"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>GettextResource</b>
<pre>
public GettextResource()
</pre>
<a name="methods"></a>
<h2>
<img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="gettext(java.util.ResourceBundle, java.lang.String)"><img src="images/green-ball.gif" width=12 height=12 alt=" o "></a>
<a name="gettext"><b>gettext</b></a>
<pre>
public static String gettext(ResourceBundle catalog,
String msgid)
</pre>
<dl>
<dd> Returns the translation of <VAR>msgid</VAR>.
<p>
<dd><dl>
<dt> <b>Parameters:</b>
<dd> catalog - a ResourceBundle
<dd> msgid - the key string to be translated, an ASCII string
<dt> <b>Returns:</b>
<dd> the translation of <VAR>msgid</VAR>, or <VAR>msgid</VAR> if
none is found
</dl></dd>
</dl>
<a name="ngettext(java.util.ResourceBundle, java.lang.String, java.lang.String, long)"><img src="images/green-ball.gif" width=12 height=12 alt=" o "></a>
<a name="ngettext"><b>ngettext</b></a>
<pre>
public static String ngettext(ResourceBundle catalog,
String msgid,
String msgid_plural,
long n)
</pre>
<dl>
<dd> Returns the plural form for <VAR>n</VAR> of the translation of
<VAR>msgid</VAR>.
<p>
<dd><dl>
<dt> <b>Parameters:</b>
<dd> catalog - a ResourceBundle
<dd> msgid - the key string to be translated, an ASCII string
<dd> msgid_plural - its English plural form
<dt> <b>Returns:</b>
<dd> the translation of <VAR>msgid</VAR> depending on <VAR>n</VAR>,
or <VAR>msgid</VAR> or <VAR>msgid_plural</VAR> if none is found
</dl></dd>
</dl>
<hr>
<pre>
<a href="packages.html">All Packages</a> <a href="tree.html">Class Hierarchy</a> <a href="Package-gnu.gettext.html">This Package</a> <a href="Package-gnu.gettext.html">Previous</a> <a href="Package-gnu.gettext.html">Next</a> <a href="AllNames.html">Index</a></pre>
</body>
</html>
|