|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.ceryle.util.Localizer
public class Localizer
Provides localization methods for processing messages. All methods are static.
Note that the Utilities class,
and the MessageHandlerImpl class
that calls its localization methods, uses a different
ResourceBundle than this class, which is bound to
Msg.
| Field Summary | |
|---|---|
static String[] |
NumParams
The numbered String-replacement parameters "%0", "%1", through "%9". |
| Constructor Summary | |
|---|---|
Localizer()
|
|
| Method Summary | |
|---|---|
static boolean |
characterMatches(boolean ignoreCase,
char c1,
char c2)
Returns true if the character c1 matches character c2, ignoring case (as much as is provided by Java) if the boolean ignoreCase is true. |
static String |
gsub(String src,
String srch,
String repl,
boolean ignoreCase)
Replace all (non-overlapping) occurrences of a string srch in string
src by replacement repl. |
static int |
indexOf(boolean ignoreCase,
String source,
String substring,
int fromIndex)
Returns the index within String source of the first occurrence of the specified substring, starting at the specified index. |
static String |
localize(String messageId)
Return a String representing the localized message, provided the unique message identifier messageId. |
static String |
localize(String messageId,
String arg1)
Return a String representing the localized message, provided the unique message identifier messageId and one parameter arg1. |
static String |
localize(String messageId,
String arg1,
String arg2)
Return a String representing the localized message, provided the unique message identifier messageId and two parameters arg1 and arg2. |
static String |
localize(String messageId,
String arg1,
String arg2,
String arg3)
Return a String representing the localized message, provided the unique message identifier messageId and three parameters arg1, arg2, and arg3. |
static String |
localize(String messageId,
String arg1,
String arg2,
String arg3,
String arg4)
Return a String representing the localized message, provided the unique message identifier messageId and four parameters arg1, arg2, arg3, and arg4. |
static String |
localize(String messageId,
String arg1,
String arg2,
String arg3,
String arg4,
String arg5)
Return a String representing the localized message, provided the unique message identifier messageId and five parameters arg1, arg2, arg3, arg4, and arg5. |
static String |
localize(String messageId,
String arg1,
String arg2,
String arg3,
String arg4,
String arg5,
String arg6)
Return a String representing the localized message, provided the unique message identifier messageId and six parameters arg1, arg2, arg3, arg4, arg5, and arg6. |
static String |
process(String id,
Object[] args)
Get message text from the default, localized ResourceBundle using id
as key, then substitute arguments into (%1, %2, %3, etc.) placeholders in text. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String[] NumParams
| Constructor Detail |
|---|
public Localizer()
| Method Detail |
|---|
public static String localize(String messageId)
messageId - The unique message identifier.
MessageHandler.localize(String)
public static String localize(String messageId,
String arg1)
messageId - The unique message identifier.arg1 - A parameter string to be inserted at %1.
public static String localize(String messageId,
String arg1,
String arg2)
messageId - The unique message identifier.arg1 - A parameter string to be inserted at %1.arg2 - A parameter string to be inserted at %2.
public static String localize(String messageId,
String arg1,
String arg2,
String arg3)
messageId - The unique message identifier.arg1 - A parameter string to be inserted at %1.arg2 - A parameter string to be inserted at %2.arg3 - A parameter string to be inserted at %3.
public static String localize(String messageId,
String arg1,
String arg2,
String arg3,
String arg4)
messageId - The unique message identifier.arg1 - A parameter string to be inserted at %1.arg2 - A parameter string to be inserted at %2.arg3 - A parameter string to be inserted at %3.arg4 - A parameter string to be inserted at %4.
public static String localize(String messageId,
String arg1,
String arg2,
String arg3,
String arg4,
String arg5)
messageId - The unique message identifier.arg1 - A parameter string to be inserted at %1.arg2 - A parameter string to be inserted at %2.arg3 - A parameter string to be inserted at %3.arg4 - A parameter string to be inserted at %4.arg5 - A parameter string to be inserted at %5.
public static String localize(String messageId,
String arg1,
String arg2,
String arg3,
String arg4,
String arg5,
String arg6)
messageId - The unique message identifier.arg1 - A parameter string to be inserted at %1.arg2 - A parameter string to be inserted at %2.arg3 - A parameter string to be inserted at %3.arg4 - A parameter string to be inserted at %4.arg5 - A parameter string to be inserted at %5.arg6 - A parameter string to be inserted at %6.
public static final String gsub(String src,
String srch,
String repl,
boolean ignoreCase)
srch in string
src by replacement repl. If the pattern isn't found,
the string is returned unchanged.
src - any string.srch - the string to search for.repl - the replacement string.ignoreCase - a boolean determining case sensitivity of matches.
public static String process(String id,
Object[] args)
id
as key, then substitute arguments into (%1, %2, %3, etc.) placeholders in text.
public static int indexOf(boolean ignoreCase,
String source,
String substring,
int fromIndex)
Also, as with java.lang.String's indexOf() method, there is no restriction on the value of fromIndex: if it exceeds either start or end boundary, it is set to that boundary.
This is a copy of the method from org.ceryle.util.Utilities made for portability.
source - the string to search within.substring - the substring to search for.fromIndex - the index to start the search from.
NullPointerException - if source is null
public static boolean characterMatches(boolean ignoreCase,
char c1,
char c2)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||