public final class NlsContext extends Object
Static accessor class to the current locale, "jargon" and currency information. This class behaves as a static class but has threadlocal based storage behind it; this allows the locale information to be different for every request. The actual locale to use for a request can be set by a server on a per-request basis. If no per-request locale is set this uses the default locale.
In addition, this also contains the current "currency locale" which is set once per application, when used. By default most applications will contain monetary amounts in a single currency only, regardless of the language they are being used in. For instance a dutch system can present information in English for a british user, but will still present amounts in euro's, not pounds.
| Modifier and Type | Method and Description |
|---|---|
static NlsCodeTable |
createCodeTable(String name)
Create a coded translation table for code tables.
|
static BundleRef |
getBundleRef(String bundlekey)
Get the BundleRef for the specified bundle key.
|
static String |
getCodeDescription(String tablename,
String code,
String defmsg)
FIXME This needs to use a cached code translation table from the database.
|
static Currency |
getCurrency()
Returns a Currency object for the current currency locale.
|
static Locale |
getCurrencyLocale()
The locale for the currency being handled in the application.
|
static String |
getCurrencySymbol()
Returns the currency symbol (not the currency code, damnit) for the current currency locale.
|
static DateFormat |
getDateFormat(int style) |
static DateFormat |
getDateTimeFormat(int s1,
int s2) |
static Locale |
getDefault()
Returns the default ViewPoint locale.
|
static Locale |
getDefaultCurrencyLocale() |
static String |
getDialect() |
static Locale |
getLocale()
Gets the current locale in use by the request we're executing at this time - this is
the PROPER call to use from normal user code.
|
static void |
setCurrencyLocale(Locale loc)
Sets the currency locale to use for this request.
|
static void |
setDefaultCurrencyLocale(Locale defaultCurrencyLocale) |
static void |
setDialect(String dialect) |
static void |
setLocale(Locale loc)
Sets the current locale.
|
public static Locale getDefault()
public static void setDefaultCurrencyLocale(Locale defaultCurrencyLocale)
public static Locale getDefaultCurrencyLocale()
public static Locale getCurrencyLocale()
The locale for the currency being handled in the application. Can be changed per request, and defaults to the "default locale" (NOT the per request locale!). This is used for applications that use only a single currency throughout the application; if an application uses multiple currencies the application itself must provide services to handle the "current" currency and monetary conversions of currencies.
This will return the default locale if not explicitly set.
public static void setCurrencyLocale(Locale loc)
loc - public static Currency getCurrency()
public static String getCurrencySymbol()
public static String getDialect()
public static void setDialect(String dialect)
public static Locale getLocale()
public static void setLocale(Locale loc)
loc - public static BundleRef getBundleRef(String bundlekey)
bundlekey - The key (package/filename) of the resource bundle without .properties!public static DateFormat getDateFormat(int style)
public static DateFormat getDateTimeFormat(int s1, int s2)
public static NlsCodeTable createCodeTable(String name)
Copyright © 2017 etc.to. All rights reserved.