| java.lang.Object com.sun.midp.i18n.Resource
Resource | abstract public class Resource (Code) | | The Resource class retrieves the locale specific values such
as label strings and date formats from the locale specific
subclasses of com.sun.midp.i18n.ResourceBundle class.
The default locale is assumed to be en_US, meaning,
in the absence of any locale information being specified, en_US
will be assumed as the default locale.
A subclass of ResourceBundle namely,
com.sun.midp.l10n.LocalizedStrings
is the default localization file, for a default locale of en_US.
This also acts as a template for future localization and is
easily localizable. The new localized file created should be
accompanied with a locale name following an underscore: for
example, a German one would be named "LocalizedStrings_de".
In this way, as many related locale-specific classes as needed
can be provided.
The location of such locale-specific classes is expected to be
"com.sun.midp.l10n".
|
Method Summary | |
public static String | getDateString(String dayOfWeek, String date, String month, String year) Returns a locale-specific formatted date string. | public static String | getDateTimeString(String dayOfWeek, String date, String month, String year, String hour, String min, String sec, String ampm) Returns a locale-specific formatted date and time string. | public static int | getFirstDayOfWeek() Returns what the first day of the week is; e.g., Sunday in US,
Monday in France. | public static String | getString(int key) Returns a localized string for the integer key.
Parameters: key - used to search the value pair. | public static String | getString(int key, String[] values) Returns a localized string for the argument string after substituting
values for the "%d" tokens in the localized string, where "d" is 1-9
and representing a values 0-8 in an array. | public static String | getTimeString(String hour, String min, String sec, String ampm) Returns a locale-specific formatted time string. | public static boolean | isAMPMafterTime() Returns whether the AM_PM field comes after the time field
or not. |
getDateString | public static String getDateString(String dayOfWeek, String date, String month, String year)(Code) | | Returns a locale-specific formatted date string. By default,
it will return like "Fri, 05 Dec 2000".
Parameters: dayOfWeek - day of week Parameters: date - date Parameters: month - month Parameters: year - year formatted date string |
getDateTimeString | public static String getDateTimeString(String dayOfWeek, String date, String month, String year, String hour, String min, String sec, String ampm)(Code) | | Returns a locale-specific formatted date and time string. By
default, it will like return "Fri, 05 Dec 2000 10:05:59 PM".
Parameters: dayOfWeek - day of week Parameters: date - date Parameters: month - month Parameters: year - year Parameters: hour - hour Parameters: min - minute Parameters: sec - second Parameters: ampm - AM or PM formatted time and date string |
getFirstDayOfWeek | public static int getFirstDayOfWeek()(Code) | | Returns what the first day of the week is; e.g., Sunday in US,
Monday in France.
numeric value for first day of week |
getString | public static String getString(int key)(Code) | | Returns a localized string for the integer key.
Parameters: key - used to search the value pair. the requested localized resource string. |
getString | public static String getString(int key, String[] values)(Code) | | Returns a localized string for the argument string after substituting
values for the "%d" tokens in the localized string, where "d" is 1-9
and representing a values 0-8 in an array. The tokens can be in any
order in the string. If the localized String is not found
the key is used as the localized string. If a "%" is not followed by
1-9 then the "%" is dropped but the next char is put directly into the
output string, so "%%" will be "%" in the output and not count as part
of a token. Another example would be that "%a" would be just be "a".
For example, given "%2 had a little %1." and {"lamb", "Mary"} and there
is no localized string for the key, the result would be:
"Mary had a little lamb."
Parameters: key - an original string in the source code with optionalsubstitution tokens Parameters: values - values to substitute for the tokens in the resource value of named resource with the tokens substituted exception: ArrayIndexOutOfBoundsException - if there are not enough valuesto substitute |
getTimeString | public static String getTimeString(String hour, String min, String sec, String ampm)(Code) | | Returns a locale-specific formatted time string. By default,
it will return like "10:05:59 PM".
Parameters: hour - hour Parameters: min - minute Parameters: sec - second Parameters: ampm - AM or PM formatted time string |
isAMPMafterTime | public static boolean isAMPMafterTime()(Code) | | Returns whether the AM_PM field comes after the time field
or not.
true, if AM/PM is after the time field. |
|
|