|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectatg.core.i18n.LocaleTools
public class LocaleTools
A utility class used to obtain an array of all available locales and a user preferred locale to be used for UI representation of dates. The representation of dates are based on the pre-existing styles defined within SimpleDateFormat.java as follows: DEFAULT, FULL, LONG, MEDIUM, SHORT
Nested Class Summary | |
---|---|
class |
LocaleTools.LocaleHelper
UI helper class implementing utility methods on the locale object. |
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
|
static java.lang.String |
LOCALE_TOOLS_PATH
|
Constructor Summary | |
---|---|
LocaleTools()
Class constructor. |
Method Summary | |
---|---|
LocaleTools.LocaleHelper[] |
getAvailableLocaleHelpers()
Returns an array of LocaleHelper for all available locales. |
java.lang.String |
getDateStyle()
Returns the locale date pattern style. |
java.lang.String |
getDateTimeStyle()
Returns the locale dateTime pattern style. |
static LocaleTools |
getInstance()
Resolves LocaleTools component instance by path, if there is DynamoHttpServletRequest object associated with the current thread. |
static java.util.Locale |
getLocale(java.lang.String pLocale)
The pLocale argument represents the entire locale, with the language, country and variant separated by underbars. |
java.lang.String |
getProfileLocalePropertyName()
Returns the property on the user profile that holds the user preferred locale for representing dates. |
java.lang.String |
getTimeStyle()
Returns the locale time pattern style. |
boolean |
getUseNumberGrouping()
Returns true if grouping is being used with number formatting. |
LocaleTools.LocaleHelper |
getUserFormattingLocaleHelper()
Returns a LocaleHelper for the user preferred locale to be used when displaying formatted dates. |
LocaleTools.LocaleHelper |
getUserLocaleHelper()
Returns the LocaleHelper to use when looking up localized messages for display to the user. |
void |
setDateStyle(java.lang.String pStyle)
Defines the locale date pattern style to use for subsequent calls to LocaleHelper.getDatePattern(). |
void |
setDateTimeStyle(java.lang.String pStyle)
Defines the locale dateTime pattern style to use for subsequent calls to LocaleHelper.getDateTimePattern(). |
void |
setProfileLocalePropertyName(java.lang.String pProfileLocalePropertyName)
Sets the property on the user profile that holds the user preferred locale for representing dates. |
void |
setTimeStyle(java.lang.String pStyle)
Defines the locale time pattern style to use for subsequent calls to LocaleHelper.getTimePattern(). |
void |
setUseNumberGrouping(boolean pUseNumberGrouping)
Set whether grouping is being used with number formatting. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String CLASS_VERSION
public static final java.lang.String LOCALE_TOOLS_PATH
Constructor Detail |
---|
public LocaleTools()
SimpleDateFormat
Method Detail |
---|
public static LocaleTools getInstance()
public void setProfileLocalePropertyName(java.lang.String pProfileLocalePropertyName)
pProfileLocalePropertyName
- The property on the user profile that holds
the user preferred locale for representing dates.public java.lang.String getProfileLocalePropertyName()
public void setDateStyle(java.lang.String pStyle)
<dsp:importbean bean="/atg/core/i18n/LocaleTools"/>
<dsp:setvalue bean="LocaleTools.dateStyle" value="short"/>
<fmt:formatDate value="${date}" pattern="${LocaleTools.userPreferredLocale.datePattern}"/>
pStyle
- The locale date pattern style.public java.lang.String getDateStyle()
public void setDateTimeStyle(java.lang.String pStyle)
<dsp:importbean bean="/atg/core/i18n/LocaleTools"/>
<dsp:setvalue bean="LocaleTools.dateTimeStyle" value="short"/>
<fmt:formatDate value="${dateTime}" pattern="${LocaleTools.userPreferredLocale.dateTimePattern}"/>
pStyle
- The locale dateTime pattern style.public java.lang.String getDateTimeStyle()
public void setTimeStyle(java.lang.String pStyle)
<dsp:importbean bean="/atg/core/i18n/LocaleTools"/>
<dsp:setvalue bean="LocaleTools.timeStyle" value="short"/>
<fmt:formatDate value="${time}" pattern="${LocaleTools.userPreferredLocale.timePattern}"/>
pStyle
- The locale time pattern style.public java.lang.String getTimeStyle()
public void setUseNumberGrouping(boolean pUseNumberGrouping)
pUseNumberGrouping
- booleanpublic boolean getUseNumberGrouping()
public LocaleTools.LocaleHelper[] getAvailableLocaleHelpers()
DateFormat.getAvailableLocales()
public LocaleTools.LocaleHelper getUserLocaleHelper()
ServletUtil.getUserLocale()
public LocaleTools.LocaleHelper getUserFormattingLocaleHelper()
public static java.util.Locale getLocale(java.lang.String pLocale)
http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt
Country cope is a valid ISO Country Code. These
codes are the upper-case, two-letter codes as defined by ISO-3166.
You can find a full list of these codes at a number of sites, such as:
http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |