|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jcorporate.expresso.core.i18n.Messages
Messages.java The Messages object provides a way to gain access to the appropriate local-language version of a message, and to provide substitution of parameters in the message string if necessary. The appropriate local language is determined by means of the following:
Created on January 10, 2001, 8:35 AM
| Field Summary | |
static String |
LOCALE_KEY
|
| Constructor Summary | |
Messages()
Creates new Class |
|
| Method Summary | |
static void |
establishLocale(HttpServletRequest req)
Figure out a Locale by reading the current request. |
static Locale |
getDefaultLocale()
get default locale (much better to get it from user's request!!) |
static Locale |
getLocale(HttpServletRequest req)
|
static String |
getString(HttpServletRequest req,
String stringCode)
|
static String |
getString(HttpServletRequest req,
String stringCode,
String firstReplace)
Return a string out of our message bundle |
String |
getString(HttpServletRequest req,
String stringCode,
String firstReplace,
String secondReplace)
Return a string out of our message bundle |
String |
getString(HttpServletRequest req,
String stringCode,
String firstReplace,
String secondReplace,
String thirdReplace)
Convenience method to return a string out of our message bundle, using the thres string arguments as the replacement arguments |
static String |
getString(Locale l,
String stringCode)
|
static String |
getString(Locale l,
String stringCode,
Object[] args)
|
static String |
getString(Stack schemaStack,
Locale ourLocale,
String stringCode,
Object[] args)
Convenience method that gets a string using the schemaStack, looping through stack until the key is found |
static String |
getString(String stringCode)
Convenience method to return a specified string from the default schema, with no arguments |
static String |
getString(String schemaClass,
HttpServletRequest req,
String stringCode,
Object[] args)
Convenience method to use the current default schema |
static String |
getString(String schemaClass,
Locale l,
String stringCode)
getString(schema, locale, stringCode) |
static String |
getString(String schemaClass,
Locale l,
String stringCode,
Object[] args)
The "full" form of getString must specify a schema, language and country. |
static String |
getString(String stringCode,
Object[] args)
Convenience method that gets a string with arguments using the default schema (e.g. no specific schema specified) but with the specified arguments |
static String |
getString(String schemaClass,
String stringCode)
get string translation |
static String |
getString(String schemaClass,
String stringCode,
Object[] args)
If we have no information about what language we should be using, we use the defaults out of the properties file if present. |
static String |
getStringByPath(String bundlePath,
String language,
String country,
String stringCode,
Object[] args)
Variation on the above gets a string from a specified message bundle path |
static String |
getStringForUser(int uid,
String dbName,
String schemaClass,
String stringCode,
Object[] args)
use locale based on user ID, which is set as user preference; use with discrimination--it may be better to get locale from request |
static String |
getStringRequired(Stack schemaStack,
Locale ourLocale,
String stringCode,
Object[] args)
Convenience method that gets a string using the schemaStack, looping through it until the key is found |
static String |
getStringRequired(String schemaClass,
Locale l,
String stringCode,
Object[] args)
Return a string out of our message bundle associated with the specified schemaClass, throwing an exception if it's not found |
static String |
getStringRequired(String schemaClass,
String stringCode)
Return a string out of our message bundle associated with the specified schemaClass, throwing an exception if it's not found |
static String |
getStringUnrequired(Stack schemaStack,
Locale ourLocale,
String stringCode,
Object[] args)
Convenience method that gets a string using the schemaStack, looping through it until the key is found |
static void |
setDefaultSchema(String newDefault)
Set the default schema to a class name of a Schema object |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String LOCALE_KEY
| Constructor Detail |
public Messages()
| Method Detail |
public static String getString(String schemaClass,
Locale l,
String stringCode,
Object[] args)
schemaClass - the schema classl - the LocalestringCode - the string codeargs - any arguments.
public static String getStringRequired(String schemaClass,
Locale l,
String stringCode,
Object[] args)
throws IllegalArgumentException
schemaClass - the schema classl - the LocalestringCode - the string codeargs - any arguments.
IllegalArgumentException - if the given string code doesn't exist in the given bundle.
public static String getStringRequired(String schemaClass,
String stringCode)
schemaClass - the schema classstringCode - the string code
IllegalArgumentException - if the given string code doesn't exist in the given bundle.
public static String getStringRequired(Stack schemaStack,
Locale ourLocale,
String stringCode,
Object[] args)
throws IllegalArgumentException
schemaStack - A Stack of schemasourLocale - The specified Locale ObjectstringCode - The string code to retrieveargs - the formatting arguments for the String
IllegalArgumentException - if the given string code doesn't exist in any schema in stack.
public static String getStringUnrequired(Stack schemaStack,
Locale ourLocale,
String stringCode,
Object[] args)
throws IllegalArgumentException
schemaStack - A Stack of schemasourLocale - The specified Locale ObjectstringCode - The string code to retrieveargs - the formatting arguments for the String
IllegalArgumentException
public static String getStringByPath(String bundlePath,
String language,
String country,
String stringCode,
Object[] args)
bundlePath - language - country - stringCode - args -
public static void setDefaultSchema(String newDefault)
newDefault - public static String getString(String stringCode)
stringCode -
public static String getString(String stringCode,
Object[] args)
stringCode - args -
public static String getString(String schemaClass,
String stringCode)
schemaClass - name of schemastringCode - The string code to retrieve
public static String getString(Stack schemaStack,
Locale ourLocale,
String stringCode,
Object[] args)
schemaStack - A Stack of schemasourLocale - The specified Locale ObjectstringCode - The string code to retrieveargs - the formatting arguments for the String
public static String getString(String schemaClass,
HttpServletRequest req,
String stringCode,
Object[] args)
throws ServletException
schemaClass - req - stringCode - args -
ServletException
public static String getString(Locale l,
String stringCode)
public static String getString(Locale l,
String stringCode,
Object[] args)
public static String getString(String schemaClass,
Locale l,
String stringCode)
public static void establishLocale(HttpServletRequest req)
throws ServletException
ServletException
public static Locale getLocale(HttpServletRequest req)
throws ServletException
ServletException
public static String getString(String schemaClass,
String stringCode,
Object[] args)
schemaClass - stringCode - args -
public static Locale getDefaultLocale()
getLocale(javax.servlet.http.HttpServletRequest)
public static String getStringForUser(int uid,
String dbName,
String schemaClass,
String stringCode,
Object[] args)
uid - dbName - schemaClass - stringCode - args -
getString(java.util.Locale, String)
public static String getString(HttpServletRequest req,
String stringCode)
throws ServletException
req - stringCode -
ServletException
public static String getString(HttpServletRequest req,
String stringCode,
String firstReplace)
throws ServletException
req - stringCode - firstReplace -
ServletException
public String getString(HttpServletRequest req,
String stringCode,
String firstReplace,
String secondReplace)
throws ServletException
req - stringCode - firstReplace - secondReplace -
ServletException
public String getString(HttpServletRequest req,
String stringCode,
String firstReplace,
String secondReplace,
String thirdReplace)
throws ServletException
req - stringCode - firstReplace - secondReplace - thirdReplace -
ServletException
|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||